728x90

전체 글 114

[JAVA] Effective JAVA - Item 4 : Enforce noninstantiability with a private constructor

정적 메소드와 정적 필드는 보통 객체지향 개발에서 지양하는 방식이지만 다음 세가지 상황에서는 필요한 경우가 있다.1. 기본 타입 값이나 배열 관련 메소드들을 모아둘 때2. 특정 인터페이스를 구현하는 객체를 생성해주는 정적 메소드를 모아두고 싶을때3. final 클래스와 관련한 메소드를 모아둘 때 이런 정적 멤버만 담아둔 클래스는 인스턴스로 쓰려고 만든 것이 아니지만,컴파일러가 자동으로 기본 생성자를 만들어두고, 사용자는 이 생성자가 자동 생성자인지 구분이 안되는 이슈가 있다. 추상 클래스를 만들면 해결이 될 수 있다고 생각할수 있지만,하위 클래스를 만들어 인스턴스화를 해버리면 우회가 되기 때문에 이에 대한 근본적인 해결책이 아니다. 그렇다면 해결책은 무엇일까? 바로 private 생성자를 추가하는 것이다..

[JAVA] Effective JAVA - Item 3 : Enforce the singleton property with a privateconstructor or an enum type

what is 'Singleton'? A class that is instantiated exactly onceSingletons typically represent either a stateless object such as a function or system component that is intrinsically unique. The limit of singletons- Making a class a singleton can make it difficult to test its clients There are two common ways to implement singletons(Both are based on keeping the constructor private and exporting a ..

[JAVA] Effective JAVA - Item 2 : Consider a builder when faced with many constructor parameters

Case : scale well to large numbers of optional parameters-> static factories and contructors not good for this case then how to solve this case? The answer is : Builder Traditionally programmers have used the 'telescoping constructor'but, there have some problem Hard to write client codeHarder to read it and also you can say 'how about use JavaBeans'but there are still have some issues.Inconsist..

[JAVA] Effective JAVA - Item 1 : Consider static factory methods instead of constructor

The way for a class to allow a client to obtain an instance1. public contructors2. static factory method From now on, let me explain why we have to consider static factory methods instead of constructors. Advantage 1Static factory methods have names(unlike constructors) well-chosen name is good forEasier to useResulting client code easier to readEnd up calling the wrong one by mistakeAdvantage 2..

[Server] 이벤트 브로커 (kafka) vs 메시지 브로커 (rabbitmq)

1. pub/sub 구조란 ?브로커를 알기위해선 pub/sub 구조를 먼저 알아야 한다.pub -> publisher (발행)sub -> subscriber (구독)이라 하여 발행 - 구독 모델이라고 표현 하는 곳도 있다. 단어 뜻만 놓고 보면 어떤 이벤트를 발행하는 곳과 그 이벤트를 구독하는 곳 이런 식으로 구성되어있다고 생각할수 있다.이벤트(메시지)를 발행해서 특정 채널 또는 토픽에 이벤트를 전송하고특정 채널 혹은 토픽을 구독하는 곳에서 발행자와 관계없이 발행된 이벤트를 얻을 수 있는 것이다. 예를 들어보자 마트 할인 알림이 필요한 사람이 있다고 하자.이 사람은 오로지 할인 정보만을 원하고, 정보 제공자에겐 일말의 관심이 없다. 발행자는 "마트 할인 정보"에 정보를 넣으면 수신자는 해당 채널에서 할인..

개인공부/BE 2025.02.10

[Server] 클라우드 네이티브란?

용어의 정의클라우드 제공 모델에서 제공하는 분산 컴퓨팅을 활용하기 위해 애플리케이션을 구축 및 실행하는 개념기본적으로 클라우드 네이티브 앱은 클라우드가 제공하는 확장성, 탄력성, 복원성, 유연성을 활용하도록 설계, 구축  클라우드 네이티브의 관건은 민첩성을 유지하면서 빠르게 움직이는 것으로쿠버네티스, 도커, 카프카와 같은 기술을 사용하여 최신 애플리케이션 개발을 지원하고클라우드 네이티브 애플리케이션을 구축, 배포, 관리할 수 있는 종합적인 표준 기반 플랫폼을 제공. 클라우드 네이티브 애플리케이션의 이점독립성각각의 애플리케이션을 개별적으로 관리하고 배치가능 (서로 독립적 구축)복원성설계에 따라 인프라스트럭쳐가 중단되어도 온라인상태 유지가능표준 기반오픈소스 및 표준 기술에 기반하는 경우가 많아 벤더 종속성이..

개인공부/BE 2025.01.24

[SQL] 1581. Customer Who Visited but Did Not Make Any Transactions (Easy)

join 세번째 문제https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/description/?envType=study-plan-v2&envId=top-sql-50⬆️ 문제 전문 링크는 여기 Table: Visits+-------------+---------+| Column Name | Type |+-------------+---------+| visit_id | int || customer_id | int |+-------------+---------+visit_id is the column with unique values for this table.This table cont..

알고리즘 2025.01.07
728x90
반응형