일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- design pattern
- $event.target.value
- MVVM
- vuejs
- v-model vs v-bind
- java
- v-show vs v-if
- Linux
- executable jar
- Factory Method Pattern
- camel case error
- builder pattern
- kebab case
- Spring Boot
- click.native
- zen of python
- ubuntu
- mount point
- maven
- Singleton pattern
- data
- Python
- IPv6
- prototype pattern
- Today
- Total
목록design pattern (5)
Eddie's Blog
유형: 생성자 패턴 클래스의 인스턴스가 하나임을 보장하고 전역적 접근을 허용하게 한다. 1. static 키워드를 통한 instance 즉시 생성 public class EagerInitializedSingleton { private static final EagerInitializedSingleton instance = new EagerInitializedSingleton(); public static EagerInitializedSingleton getInstance() { return instance; } private EagerInitializedSingleton() {} /* more methods */ } public class StaticBlockSingleton { private stati..
유형: 생성자 패턴 다양한 객체를 생성하기 위해 Prototypical(prototype을 구현한) 인스턴스를 사용하고, 이 Prototype의 복제를 통해 새로운 객체를 생성한다. // prototype public abstract class PlayableContent implements Cloneable { public abstract void play(); @Override protected Object clone() { Object clone = null; try { clone = super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return clone; } } // concrete prototypes p..
유형: 생성자 패턴 생성할 대상의 객체(Product의 구현체)와 그것의 생성을 위임하는 Factory를 모두 추상화하고, 대상 객체의 구현 객체는 Factory의 하위 클래스인 Factory 구현체에서 결정하도록 한다. 대상의 생성과 작동을 모두 추상화하고 Factory에 위임하여 사용자는 대상의 구현체(eg. Car, Computer)에 대해 신경 쓰지 않고 Factory로 부터 대상의 작동을 보장받는다. 필요한 적절한 Factory 구현체만을 사용하여 loose-coupling에 도달할 수 있다. // factories public abstract class AbstractProductFactory { protected Product product; public AbstractProductFacto..
유형: 생성자 패턴 복잡한 객체의 구성 요소들을 조합해 생성하는 패턴으로, 그 생성과 조합에 대한 책임을 객체가 직접 지지않고 Builder에게 위임한다. 필요한 구성 요소의 조합에 따라 각각의 생성자가 필요 public class Person { private String firstName; private String middleName; private String lastName; private Integer age; private String mothersName; private Double height; private Double weight; public Person(String firstName, String middleName, String lastName, int age, double he..
유형: 생성자 패턴 연관 혹은 의존 객체의 집합(families)을 생성하는데 있어서 그에 대한 구현 클래스를 특정하지 않고 인터페이스를 제공한다. // abstract interface public interface Animal { String getAnimal(); String makeSound(); } // concrete animal implementation public class Cat implements Animal { @Override public String getAnimal() { return "Cat"; } @Override public String makeSound() { return "Meow"; } } public class Dog implements Animal { @Overr..