반응형 Java14 Strategy Pattern Strategy pattern is useful when we want our application to be flexible. Made up of strategy and context. Source code : https://github.com/Tonyzorz/DesignPatterns/tree/master/bin/behavior/strategy 2020. 2. 28. Chapter 1 https://github.com/Tonyzorz/HeadFirstDesignPattern Tonyzorz/HeadFirstDesignPattern Head first design pattern. Contribute to Tonyzorz/HeadFirstDesignPattern development by creating an account on GitHub. github.com Design principles: - Identify the aspects of your application that vary and separte them frmo what stays the same. - Program to an interface, not an implementation. - Favor composition .. 2020. 2. 27. Builder Design Pattern When instantiating a class in client program, passing many arguments to a constructor can cause errors in many situations and bothersome. ex. having to remember constructor's parameter sequence. Builder design pattern solves this issue by building step by step, allowing client to designate only needed variables. 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 .. 2020. 2. 25. Abstract Factory Design Pattern Using Factory design pattern within factory design pattern. Great for predefined objects but if new object has to be added, whole code needs to be adjusted. 2020. 2. 24. Factory Design Pattern Using a super class with multiple sub classes, and depending on input returns one sub class. Factory pattern allows no actual instantiation on client code. source : https://www.journaldev.com/1392/factory-design-pattern-in-java 2020. 2. 22. Singleton Pattern Singleton pattern only allows for one instance of the class to be created and exist in JVM. - Gof Creational Pattern - Only one instance of class - Must have global access point to create the instance - Singleton pattern is used for logging, drivers objects and caching and thread pool. Singleton pattern could be implemented in different ways but must have the following: 1. private constructor to.. 2020. 2. 19. 이전 1 2 3 다음 반응형