Please enable JavaScript.
Coggle requires JavaScript to display documents.
I know I don't know, Basic Storage, Compute, GoF, FCJ, Technology, AWS…
I know I don't know
CQRS
-
Benefit
- allows each operation optimized separately
- improved performance, scalability
-
-
-
-
GoF
Behavioral
Identify common communication pattern between objects and realize these patterns. By doing so, these patterns increase flexibility in carying out this communication.
-
Observer*: C# sẵn class IObserver, IDispose. VD. về subscrible.
Define dependency between object so that whenever an object changes its state, all its dependents are notified.
-
-
-
Strategy/ Policy pattern: nhìn quen quen kiểu Creational - Abstract Factory
Allow you switch the algorithm or strategy based upon the situation.
-
-
-
-
Structural
Answer "how to build software components", define relationship between entities, how the entities can use each other
Decorator "trang trí": vd. simpleCoffee, milkCoffee, whipCoffee, các class milk/ whip sẽ là decorator cho simpleCoffee, là các addons dựa trên simple coffee
dynamically change the behavior of an object at run time by warpping them in an object of a decorator class
Facade: "mặt tiền", vd. hit power button giấu hết các method thực hiện một nhóm hành vi, simplified interface to a complex subsytem
Composite: class Organiztion là composite cho class Developer/ Designer.
The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Lets client treat the individual objects in a uniform manner.
Flyweight: lá trà, hạn chế tạo object mới, minimize memory usage/ computational expensives by sharing as much as possible with similar objects.
Bridge: apply theme cho các WebPage, chỉ cần kế thừa ITheme. Website with difference page, user can change theme => create separate theme and load them based on the user's preferences.
"decouple an abstraction from its implementation so that the two can vary independently"
Proxy: tạo lớp để cover lên lớp sẵn có, a class reperesents the functionality of another class. LabDoor với SecuredDoor.
Adapter: là cái để chuyển đổi cho tương thích thôi, như real word example. VD. Hunter chỉ có thể săn ILion, bổ sung thêm WildDog thì làm sao Hunter săn?
Warp otherwise imcompatiple object in an adapter to make it compatible with another class.
Creational
Abstract Factory: thằng này cao cấp hơn thằng Factory Method, bao lại hết.
Factory of factories, provide a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes.
-
Factory Method: cc. các logic trong class Developer, Design
Provides a way to delegate the instantiation logic to child classes
Prototype: cừu dolly, C# có cái method MemberwiseClone() gọi là shallowcopy
Create object based on an existing object through cloning
Simple Factory: simply generates an instance for client without exposing any instantiation logic to the client
Singleton: chỉ có duy nhất 1 instance của class được tạo ra, trong C# có support lock hay là Lazy<T> (C# version 6.0 above) để thực hiện kiểm tra thread-safety. VD. chỉ có 1 task manager/ activity monitor được mở mà thôi.
Ensure that only one object of a particular class is ever created.
FCJ
-
Pre-requirement
-
-
-
Vẽ arc
-
-
-
Bg: trắng, border: FF8000
-
-
-
-
Design pattern is a reusable solution to a commonly occuring problem within a context in software design. A design pattern is not a finalized design that can be transformed into machine code. It's a template for solving a problem that can be leveraged in different situation.
Patterns are best practices that can be used to solve common problems when designing an application. Object-oriented patterns typically show interaction between objects, without specifying the final application classes that a involved. Patterns that imply object-orientation or a more generally mutable state are not as applictionable in functional programming languages.