随笔分类 -  Pattern Design

摘要:Purpose: To separate strategies and to enable fast switching between them. Also this pattern is a good alternative to inheritance (instead of having a 阅读全文
posted @ 2019-06-10 05:37 Victor!!!! 阅读(89) 评论(0) 推荐(0)
摘要:Purpose: To implement a loosely coupled architecture in order to get better testable, maintainable and extendable code. Usage: DatabaseConfiguration g 阅读全文
posted @ 2019-06-08 08:06 Victor!!!! 阅读(144) 评论(0) 推荐(0)
摘要:Purpose: To dynamically add new functionality to class instance. Booking.php BookingDecorator.php DoubleRoomBooking.php ExtraBed.php WiFi.php Tests/De 阅读全文
posted @ 2019-05-10 18:00 Victor!!!! 阅读(164) 评论(0) 推荐(0)
摘要:Purpose: A Data Mapper, is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (ofen a relational databas 阅读全文
posted @ 2019-05-09 17:37 Victor!!!! 阅读(230) 评论(0) 推荐(0)
摘要:Purpose: To treat a group of objects the same way as a single instance of the object. RenderableInterface.php Form.php InputElement.php TextElement.ph 阅读全文
posted @ 2019-05-09 14:47 Victor!!!! 阅读(257) 评论(0) 推荐(0)
摘要:Purpose: Decouple an abstraction from its implementation so that the two can vary independently FormatterInterface.php PlainTextFormatter.php HtmlForm 阅读全文
posted @ 2019-05-08 18:12 Victor!!!! 阅读(181) 评论(0) 推荐(0)
摘要:Purpose: To translate one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not becaus 阅读全文
posted @ 2019-05-08 17:25 Victor!!!! 阅读(121) 评论(0) 推荐(0)
摘要:Structural Design Patterns are Design Patterns that ease the design by identifying a simple way to realize relationships between entities. 阅读全文
posted @ 2019-05-08 16:38 Victor!!!! 阅读(216) 评论(0) 推荐(0)
摘要:Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situati 阅读全文
posted @ 2019-05-08 16:34 Victor!!!! 阅读(330) 评论(0) 推荐(0)
摘要:Purpose: Similiar to the AbstractFactory, this pattern is used to create series of related or dependent objects. The difference between this and abstr 阅读全文
posted @ 2019-05-08 15:51 Victor!!!! 阅读(172) 评论(0) 推荐(0)
摘要:Purpose: This is considered to be an ANTI-PATTERN! We could use dependency injection to replace this pattern. To have only one instance of object in t 阅读全文
posted @ 2019-05-08 15:34 Victor!!!! 阅读(149) 评论(0) 推荐(0)
摘要:Purpose: It differs from the static factory because it is not static. Therefore, you can have multiple factories, differently parameterized, you can s 阅读全文
posted @ 2019-05-08 14:50 Victor!!!! 阅读(130) 评论(0) 推荐(0)
摘要:Purpose: To avoid the cost of creating objects the standard way (new Foo()) and instead create a prototype and clone it. BookPrototype.php BarBookProt 阅读全文
posted @ 2019-05-08 10:25 Victor!!!! 阅读(211) 评论(0) 推荐(0)
摘要:Purpose: The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use - a "pool" rather th 阅读全文
posted @ 2019-05-07 17:49 Victor!!!! 阅读(242) 评论(0) 推荐(0)
摘要:Purpose To have only a list of named instances that are used, like a singleton but with n instances. Multiton.php 阅读全文
posted @ 2019-05-07 17:22 Victor!!!! 阅读(168) 评论(0) 推荐(0)
摘要:Purpose The good point over the SimpleFactory is you can subclass it to implement different ways to create objects. For simple cases, this abstract cl 阅读全文
posted @ 2019-05-07 16:09 Victor!!!! 阅读(159) 评论(0) 推荐(0)
摘要:Purpose: Builder is an interface that build parts of a complex object. Sometimes, if the builder has a better knowledge of what it builds, this interf 阅读全文
posted @ 2019-05-07 15:57 Victor!!!!
摘要:Creational Creational Design Patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to 阅读全文
posted @ 2019-05-07 15:05 Victor!!!! 阅读(129) 评论(0) 推荐(0)