diff --git a/abstract-document/README.md b/abstract-document/README.md index 2adb3732b..e9a2bed94 100644 --- a/abstract-document/README.md +++ b/abstract-document/README.md @@ -12,6 +12,7 @@ tags: ## Intent Achieve flexibility of untyped languages and keep the type-safety +## Class diagram ![alt text](./etc/abstract-document.png "Abstract Document Traits and Domain") @@ -26,4 +27,4 @@ Use the Abstract Document Pattern when ## Credits * [Wikipedia: Abstract Document Pattern](https://en.wikipedia.org/wiki/Abstract_Document_Pattern) -* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf) \ No newline at end of file +* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf) diff --git a/abstract-factory/README.md b/abstract-factory/README.md index f6719af45..a4fc5cc74 100644 --- a/abstract-factory/README.md +++ b/abstract-factory/README.md @@ -157,6 +157,9 @@ public static void main(String[] args) { } ``` +## Class diagram +![alt text](./etc/abstract-factory.urm.png "Abstract Factory class diagram") + ## Applicability Use the Abstract Factory pattern when diff --git a/abstract-factory/etc/abstract-factory.urm.png b/abstract-factory/etc/abstract-factory.urm.png new file mode 100644 index 000000000..836858a2c Binary files /dev/null and b/abstract-factory/etc/abstract-factory.urm.png differ diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index 83b618601..d855cfd73 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -9,11 +9,12 @@ tags: - Difficulty-Intermediate --- -![alt text](./etc/acyclic-visitor.png "Acyclic Visitor") - ## Intent Allow new functions to be added to existing class hierarchies without affecting those hierarchies, and without creating the troublesome dependency cycles that are inherent to the GOF VISITOR Pattern. +## Class diagram +![alt text](./etc/acyclic-visitor.png "Acyclic Visitor") + ## Applicability This pattern can be used: * When you need to add a new function to an existing hierarchy without the need to alter or affect that hierarchy. diff --git a/adapter/README.md b/adapter/README.md index 0076e962c..b1ad775cf 100644 --- a/adapter/README.md +++ b/adapter/README.md @@ -97,6 +97,9 @@ var captain = new Captain(new FishingBoatAdapter()); captain.row(); ``` +## Class diagram +![alt text](./etc/adapter.urm.png "Adapter class diagram") + ## Applicability Use the Adapter pattern when diff --git a/adapter/etc/adapter.urm.png b/adapter/etc/adapter.urm.png new file mode 100644 index 000000000..341ad6769 Binary files /dev/null and b/adapter/etc/adapter.urm.png differ diff --git a/aggregator-microservices/README.md b/aggregator-microservices/README.md index e65f26d9a..c3498d315 100644 --- a/aggregator-microservices/README.md +++ b/aggregator-microservices/README.md @@ -18,6 +18,8 @@ More variations of the aggregator are: - Chained Microservice Design Pattern: In this case each microservice is dependent/ chained to a series of other microservices. +## Class diagram + ![alt text](./etc/aggregator-microservice.png "Aggregator Microservice") ## Applicability diff --git a/ambassador/README.md b/ambassador/README.md index 2d3edeafa..862c579a0 100644 --- a/ambassador/README.md +++ b/ambassador/README.md @@ -150,6 +150,9 @@ public class App { } ``` +## Class diagram +![alt text](./etc/ambassador.urm.png "Ambassador class diagram") + ## Applicability Ambassador is applicable when working with a legacy remote service that cannot be modified or would be extremely difficult to modify. Connectivity features can diff --git a/ambassador/etc/ambassador.urm.png b/ambassador/etc/ambassador.urm.png new file mode 100644 index 000000000..9b50a02ad Binary files /dev/null and b/ambassador/etc/ambassador.urm.png differ diff --git a/api-gateway/README.md b/api-gateway/README.md index 23014ae0b..2fd04900e 100644 --- a/api-gateway/README.md +++ b/api-gateway/README.md @@ -15,6 +15,7 @@ tags: Aggregate calls to microservices in a single location: the API Gateway. The user makes a single call to the API Gateway, and the API Gateway then calls each relevant microservice. +## Class diagram ![alt text](./etc/api-gateway.png "API Gateway") ## Applicability diff --git a/async-method-invocation/README.md b/async-method-invocation/README.md index 2d99820c5..f1faa396d 100644 --- a/async-method-invocation/README.md +++ b/async-method-invocation/README.md @@ -17,6 +17,7 @@ is not blocked while waiting results of tasks. The pattern provides parallel processing of multiple independent tasks and retrieving the results via callbacks or waiting until everything is done. +# Class diagram ![alt text](./etc/async-method-invocation.png "Async Method Invocation") ## Applicability diff --git a/balking/README.md b/balking/README.md index fb5c83d5b..36a3efcb9 100644 --- a/balking/README.md +++ b/balking/README.md @@ -13,6 +13,7 @@ tags: Balking Pattern is used to prevent an object from executing certain code if it is an incomplete or inappropriate state +## Class diagram ![alt text](./etc/balking.png "Balking") ## Applicability diff --git a/bridge/README.md b/bridge/README.md index 8d13d1b72..c48e1025c 100644 --- a/bridge/README.md +++ b/bridge/README.md @@ -179,6 +179,9 @@ hammer.unwield(); // The item's glow fades. ``` +## Class diagram +![alt text](./etc/bridge.urm.png "Bridge class diagram") + ## Applicability Use the Bridge pattern when diff --git a/bridge/etc/bridge.urm.png b/bridge/etc/bridge.urm.png new file mode 100644 index 000000000..785585bf8 Binary files /dev/null and b/bridge/etc/bridge.urm.png differ diff --git a/builder/README.md b/builder/README.md index a061f8afa..c6190ef17 100644 --- a/builder/README.md +++ b/builder/README.md @@ -113,6 +113,9 @@ And then it can be used as: var mage = new Hero.Builder(Profession.MAGE, "Riobard").withHairColor(HairColor.BLACK).withWeapon(Weapon.DAGGER).build(); ``` +## Class diagram +![alt text](./etc/builder.urm.png "Builder class diagram") + ## Applicability Use the Builder pattern when diff --git a/builder/etc/builder.urm.png b/builder/etc/builder.urm.png new file mode 100644 index 000000000..d77808d36 Binary files /dev/null and b/builder/etc/builder.urm.png differ diff --git a/business-delegate/README.md b/business-delegate/README.md index e6e249122..5debebbba 100644 --- a/business-delegate/README.md +++ b/business-delegate/README.md @@ -15,6 +15,7 @@ presentation and business tiers. By using the pattern we gain loose coupling between the tiers and encapsulate knowledge about how to locate, connect to, and interact with the business objects that make up the application. +## Class diagram ![alt text](./etc/business-delegate.png "Business Delegate") ## Applicability diff --git a/bytecode/README.md b/bytecode/README.md index d2fc45e1e..13d8013d6 100644 --- a/bytecode/README.md +++ b/bytecode/README.md @@ -12,6 +12,9 @@ tags: ## Intent Allows to encode behaviour as instructions for virtual machine. +## Class diagram +![alt text](./etc/bytecode.urm.png "Bytecode class diagram") + ## Applicability Use the Bytecode pattern when you have a lot of behavior you need to define and your game’s implementation language isn’t a good fit because: diff --git a/bytecode/etc/bytecode.urm.png b/bytecode/etc/bytecode.urm.png new file mode 100644 index 000000000..82036a78a Binary files /dev/null and b/bytecode/etc/bytecode.urm.png differ diff --git a/caching/README.md b/caching/README.md index 7184d51d4..34fe0222a 100644 --- a/caching/README.md +++ b/caching/README.md @@ -15,6 +15,7 @@ To avoid expensive re-acquisition of resources by not releasing the resources immediately after their use. The resources retain their identity, are kept in some fast-access storage, and are re-used to avoid having to acquire them again. +## Class diagram ![alt text](./etc/caching.png "Caching") ## Applicability diff --git a/callback/README.md b/callback/README.md index a408fd5e0..27af6337c 100644 --- a/callback/README.md +++ b/callback/README.md @@ -16,6 +16,7 @@ Callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time. +## Class diagram ![alt text](./etc/callback.png "Callback") ## Applicability diff --git a/chain/README.md b/chain/README.md index db1ee1825..7fdc4243b 100644 --- a/chain/README.md +++ b/chain/README.md @@ -141,6 +141,9 @@ king.makeRequest(new Request(RequestType.TORTURE_PRISONER, "torture prisoner")); king.makeRequest(new Request(RequestType.COLLECT_TAX, "collect tax")); // Orc soldier handling request "collect tax" ``` +## Class diagram +![alt text](./etc/chain.urm.png "Chain of Responsibility class diagram") + ## Applicability Use Chain of Responsibility when diff --git a/chain/etc/chain.urm.png b/chain/etc/chain.urm.png new file mode 100644 index 000000000..c3a4c80ba Binary files /dev/null and b/chain/etc/chain.urm.png differ diff --git a/circuit-breaker/README.md b/circuit-breaker/README.md index 6a1c631c7..8e840ce1e 100644 --- a/circuit-breaker/README.md +++ b/circuit-breaker/README.md @@ -165,6 +165,8 @@ How does the above pattern prevent failures? Let's understand via this finite st - If the number of failures cross a certain threshold, we move to the **open** state, which acts just like an open circuit and prevents remote service calls from being made, thus saving resources. (Here, we return the response called ```stale response from API```) - Once we exceed the retry timeout period, we move to the **half-open** state and make another call to the remote service again to check if the service is working so that we can serve fresh content. A *failure* sets it back to **open** state and another attempt is made after retry timeout period, while a *success* sets it to **closed** state so that everything starts working normally again. +## Class diagram +![alt text](./etc/circuit-breaker.urm.png "Circuit Breaker class diagram") ## Applicability Use the Circuit Breaker pattern when diff --git a/circuit-breaker/etc/circuit-breaker.urm.png b/circuit-breaker/etc/circuit-breaker.urm.png new file mode 100644 index 000000000..9278ce216 Binary files /dev/null and b/circuit-breaker/etc/circuit-breaker.urm.png differ diff --git a/collection-pipeline/README.md b/collection-pipeline/README.md index 9d2f2693b..3f223dd07 100644 --- a/collection-pipeline/README.md +++ b/collection-pipeline/README.md @@ -14,6 +14,7 @@ tags: Collection Pipeline introduces Function Composition and Collection Pipeline, two functional-style patterns that you can combine to iterate collections in your code. In functional programming, it's common to sequence complex operations through a series of smaller modular functions or operations. The series is called a composition of functions, or a function composition. When a collection of data flows through a function composition, it becomes a collection pipeline. Function Composition and Collection Pipeline are two design patterns frequently used in functional-style programming. +## Class diagram ![alt text](./etc/collection-pipeline.png "Collection Pipeline") ## Applicability diff --git a/combinator/README.md b/combinator/README.md index e22450321..98d353050 100644 --- a/combinator/README.md +++ b/combinator/README.md @@ -18,6 +18,8 @@ The functional pattern representing a style of organizing libraries centered aro Putting it simply, there is some type T, some functions for constructing "primitive" values of type T, and some "combinators" which can combine values of type T in various ways to build up more complex values of type T. +## Class diagram +![alt text](./etc/combinator.urm.png "Combinator class diagram") ## Applicability Use the combinator pattern when: diff --git a/combinator/etc/combinator.urm.png b/combinator/etc/combinator.urm.png new file mode 100644 index 000000000..80fdd3634 Binary files /dev/null and b/combinator/etc/combinator.urm.png differ diff --git a/command/README.md b/command/README.md index 41e8b78e1..bbe149df0 100644 --- a/command/README.md +++ b/command/README.md @@ -19,6 +19,7 @@ Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. +## Class diagram ![alt text](./etc/command.png "Command") ## Applicability diff --git a/commander/README.md b/commander/README.md index 71ef7fe9c..0cee5dc77 100644 --- a/commander/README.md +++ b/commander/README.md @@ -13,6 +13,9 @@ tags: > Used to handle all problems that can be encountered when doing distributed transactions. +## Class diagram +![alt text](./etc/commander.urm.png "Commander class diagram") + ## Applicability This pattern can be used when we need to make commits into 2 (or more) databases to complete transaction, which cannot be done atomically and can thereby create problems. diff --git a/commander/etc/commander.urm.png b/commander/etc/commander.urm.png new file mode 100644 index 000000000..6b5ebba75 Binary files /dev/null and b/commander/etc/commander.urm.png differ diff --git a/composite/README.md b/composite/README.md index 017a5079c..ba939b803 100644 --- a/composite/README.md +++ b/composite/README.md @@ -154,6 +154,9 @@ var elfMessage = new Messenger().messageFromElves(); elfMessage.print(); // Much wind pours from your mouth. ``` +## Class diagram +![alt text](./etc/composite.urm.png "Composite class diagram") + ## Applicability Use the Composite pattern when diff --git a/composite/etc/composite.urm.png b/composite/etc/composite.urm.png new file mode 100644 index 000000000..93c160f64 Binary files /dev/null and b/composite/etc/composite.urm.png differ diff --git a/converter/README.md b/converter/README.md index 5cde646ee..824d47e38 100644 --- a/converter/README.md +++ b/converter/README.md @@ -15,8 +15,6 @@ conversion between corresponding types, allowing a clean implementation in which need to be aware of each other. Moreover, the Converter Pattern introduces bidirectional collection mapping, reducing a boilerplate code to minimum. -![alt text](./etc/converter.png "Converter Pattern") - ## Explanation Real world example @@ -82,6 +80,9 @@ UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com"); User user = userConverter.convertFromDto(dtoUser); ``` +## Class diagram +![alt text](./etc/converter.png "Converter Pattern") + ## Applicability Use the Converter Pattern in the following situations: diff --git a/cqrs/README.md b/cqrs/README.md index 111c1ccd4..b9cbeacd8 100644 --- a/cqrs/README.md +++ b/cqrs/README.md @@ -12,6 +12,7 @@ tags: ## Intent CQRS Command Query Responsibility Segregation - Separate the query side from the command side. +## Class diagram ![alt text](./etc/cqrs.png "CQRS") ## Applicability diff --git a/dao/README.md b/dao/README.md index 785a1c362..e1120fbf2 100644 --- a/dao/README.md +++ b/dao/README.md @@ -13,6 +13,7 @@ tags: Object provides an abstract interface to some type of database or other persistence mechanism. +## Class diagram ![alt text](./etc/dao.png "Data Access Object") ## Applicability diff --git a/data-bus/README.md b/data-bus/README.md index 257192e25..428c4db96 100644 --- a/data-bus/README.md +++ b/data-bus/README.md @@ -16,6 +16,7 @@ Allows send of messages/events between components of an application without them needing to know about each other. They only need to know about the type of the message/event being sent. +## Class diagram ![data bus pattern uml diagram](./etc/data-bus.urm.png "Data Bus pattern") ## Applicability diff --git a/data-locality/README.md b/data-locality/README.md index 6a72a4519..8811e59ac 100644 --- a/data-locality/README.md +++ b/data-locality/README.md @@ -15,6 +15,8 @@ Accelerate memory access by arranging data to take advantage of CPU caching. Modern CPUs have caches to speed up memory access. These can access memory adjacent to recently accessed memory much quicker. Take advantage of that to improve performance by increasing data locality keeping data in contiguous memory in the order that you process it. +## Class diagram +![alt text](./etc/data-locality.urm.png "Data Locality pattern class diagram") ## Applicability diff --git a/data-locality/etc/data-locality.urm.png b/data-locality/etc/data-locality.urm.png new file mode 100644 index 000000000..d19873739 Binary files /dev/null and b/data-locality/etc/data-locality.urm.png differ diff --git a/data-mapper/README.md b/data-mapper/README.md index 075e8eece..f23d5a62a 100644 --- a/data-mapper/README.md +++ b/data-mapper/README.md @@ -12,6 +12,7 @@ tags: ## Intent A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself +## Class diagram ![alt text](./etc/data-mapper.png "Data Mapper") ## Applicability diff --git a/data-transfer-object/README.md b/data-transfer-object/README.md index ad9b9f4e2..c02379527 100644 --- a/data-transfer-object/README.md +++ b/data-transfer-object/README.md @@ -15,6 +15,7 @@ tags: Pass data with multiple attributes in one shot from client to server, to avoid multiple calls to remote server. +## Class diagram ![alt text](./etc/data-transfer-object.urm.png "data-transfer-object") ## Applicability diff --git a/decorator/README.md b/decorator/README.md index c003325fd..6adb5d057 100644 --- a/decorator/README.md +++ b/decorator/README.md @@ -109,6 +109,9 @@ clubbedTroll.attack(); // The troll tries to grab you! The troll swings at you w clubbedTroll.fleeBattle(); // The troll shrieks in horror and runs away! ``` +## Class diagram +![alt text](./etc/decorator.urm.png "Decorator pattern class diagram") + ## Applicability Use Decorator diff --git a/decorator/etc/decorator.urm.png b/decorator/etc/decorator.urm.png new file mode 100644 index 000000000..141c0563f Binary files /dev/null and b/decorator/etc/decorator.urm.png differ diff --git a/delegation/README.md b/delegation/README.md index e5c0c6376..b18c6f7f3 100644 --- a/delegation/README.md +++ b/delegation/README.md @@ -16,6 +16,7 @@ Proxy Pattern It is a technique where an object expresses certain behavior to the outside but in reality delegates responsibility for implementing that behaviour to an associated object. +## Class diagram ![alt text](./etc/delegation.png "Delegate") ## Applicability diff --git a/dependency-injection/README.md b/dependency-injection/README.md index 735f589b1..ba81dc703 100644 --- a/dependency-injection/README.md +++ b/dependency-injection/README.md @@ -17,6 +17,7 @@ pattern separates the creation of a client's dependencies from its own behavior, which allows program designs to be loosely coupled and to follow the inversion of control and single responsibility principles. +## Class diagram ![alt text](./etc/dependency-injection.png "Dependency Injection") ## Applicability diff --git a/dirty-flag/README.md b/dirty-flag/README.md index bea4d324b..885c7f03b 100644 --- a/dirty-flag/README.md +++ b/dirty-flag/README.md @@ -14,6 +14,7 @@ tags: To avoid expensive re-acquisition of resources. The resources retain their identity, are kept in some fast-access storage, and are re-used to avoid having to acquire them again. +## Class diagram ![alt text](./etc/dirty-flag.png "Dirty Flag") ## Applicability diff --git a/double-buffer/README.md b/double-buffer/README.md index 9cd5ebfa8..d187ee2e2 100644 --- a/double-buffer/README.md +++ b/double-buffer/README.md @@ -12,6 +12,9 @@ tags: ## Intent Double buffering is a term used to describe a device that has two buffers. The usage of multiple buffers increases the overall throughput of a device and helps prevents bottlenecks. This example shows using double buffer pattern on graphics. It is used to show one image or frame while a separate frame is being buffered to be shown next. This method makes animations and games look more realistic than the same done in a single buffer mode. +## Class diagram +![alt text](./etc/double-buffer.urm.png "Double Buffer pattern class diagram") + ## Applicability This pattern is one of those ones where you’ll know when you need it. If you have a system that lacks double buffering, it will probably look visibly wrong (tearing, etc.) or will behave incorrectly. But saying, “you’ll know when you need it” doesn’t give you much to go on. More specifically, this pattern is appropriate when all of these are true: @@ -25,4 +28,4 @@ This pattern is one of those ones where you’ll know when you need it. If you h ## Credits -* [Game Programming Patterns - Double Buffer]([http://gameprogrammingpatterns.com/double-buffer.html](http://gameprogrammingpatterns.com/double-buffer.html)) \ No newline at end of file +* [Game Programming Patterns - Double Buffer]([http://gameprogrammingpatterns.com/double-buffer.html](http://gameprogrammingpatterns.com/double-buffer.html)) diff --git a/double-buffer/etc/double-buffer.urm.png b/double-buffer/etc/double-buffer.urm.png new file mode 100644 index 000000000..072ec4dad Binary files /dev/null and b/double-buffer/etc/double-buffer.urm.png differ diff --git a/double-checked-locking/README.md b/double-checked-locking/README.md index da1fdd1a2..d1077951a 100644 --- a/double-checked-locking/README.md +++ b/double-checked-locking/README.md @@ -16,6 +16,7 @@ locking criterion (the "lock hint") without actually acquiring the lock. Only if the locking criterion check indicates that locking is required does the actual locking logic proceed. +## Class diagram ![alt text](./etc/double_checked_locking_1.png "Double Checked Locking") ## Applicability diff --git a/double-dispatch/README.md b/double-dispatch/README.md index ae87208a2..dfc86a827 100644 --- a/double-dispatch/README.md +++ b/double-dispatch/README.md @@ -14,6 +14,7 @@ tags: Double Dispatch pattern is a way to create maintainable dynamic behavior based on receiver and parameter types. +## Class diagram ![alt text](./etc/double-dispatch.png "Double Dispatch") ## Applicability diff --git a/eip-aggregator/README.md b/eip-aggregator/README.md index a1dc18ea8..2b55b4e09 100644 --- a/eip-aggregator/README.md +++ b/eip-aggregator/README.md @@ -17,7 +17,8 @@ the best parameters. Aggregator allows you to merge messages based on defined criteria and parameters. It gathers original messages, applies aggregation strategy and upon fulfilling given criteria, releasing merged messages. - + +## Diagram ![alt text](./etc/aggregator.gif "Splitter") ## Applicability @@ -30,4 +31,3 @@ Use the Aggregator pattern when * [Gregor Hohpe, Bobby Woolf - Enterprise Integration Patterns](http://www.enterpriseintegrationpatterns.com/patterns/messaging/Aggregator.html) * [Apache Camel - Documentation](http://camel.apache.org/aggregator2.html) - diff --git a/eip-message-channel/README.md b/eip-message-channel/README.md index 606619619..f43072f52 100644 --- a/eip-message-channel/README.md +++ b/eip-message-channel/README.md @@ -14,6 +14,7 @@ tags: When two applications communicate using a messaging system they do it by using logical addresses of the system, so called Message Channels. +## Class diagram ![alt text](./etc/message-channel.png "Message Channel") ## Applicability diff --git a/eip-publish-subscribe/README.md b/eip-publish-subscribe/README.md index 90ac02c9b..f9ec20fdf 100644 --- a/eip-publish-subscribe/README.md +++ b/eip-publish-subscribe/README.md @@ -13,6 +13,7 @@ tags: ## Intent Broadcast messages from sender to all the interested receivers. +## Class diagram ![alt text](./etc/publish-subscribe.png "Publish Subscribe Channel") ## Applicability diff --git a/eip-splitter/README.md b/eip-splitter/README.md index 51a917bad..a2eedbb38 100644 --- a/eip-splitter/README.md +++ b/eip-splitter/README.md @@ -17,6 +17,7 @@ service/sold goods, price etc.). Such bundled messages may not be accepted by ot pattern comes in handy. It will take the whole document, split it based on given criteria and send individual items to the endpoint. +## Diagram ![alt text](./etc/sequencer.gif "Splitter") ## Applicability @@ -29,4 +30,3 @@ Use the Splitter pattern when * [Gregor Hohpe, Bobby Woolf - Enterprise Integration Patterns](http://www.enterpriseintegrationpatterns.com/patterns/messaging/Sequencer.html) * [Apache Camel - Documentation](http://camel.apache.org/splitter.html) - diff --git a/eip-wire-tap/README.md b/eip-wire-tap/README.md index 31cbd9123..b4609975e 100644 --- a/eip-wire-tap/README.md +++ b/eip-wire-tap/README.md @@ -15,6 +15,7 @@ In most integration cases there is a need to monitor the messages flowing throug by intercepting the message and redirecting it to a different location like console, filesystem or the database. It is important that such functionality should not modify the original message and influence the processing path. +## Diagram ![alt text](./etc/wiretap.gif "Wire Tap") ## Applicability diff --git a/event-aggregator/README.md b/event-aggregator/README.md index ac07869e7..79965bce1 100644 --- a/event-aggregator/README.md +++ b/event-aggregator/README.md @@ -18,6 +18,7 @@ requires a separate subscription. An Event Aggregator acts as a single source of events for many objects. It registers for all the events of the many objects allowing clients to register with just the aggregator. +## Class diagram ![alt text](./etc/classes.png "Event Aggregator") ## Applicability diff --git a/event-asynchronous/README.md b/event-asynchronous/README.md index 4c26e0a3c..68684e6ed 100644 --- a/event-asynchronous/README.md +++ b/event-asynchronous/README.md @@ -19,6 +19,7 @@ of the complex issues inherent in multithreaded design. Using a class that suppo 3. Wait for resources to become available without stopping ("hanging") your application. 4. Communicate with pending asynchronous operations using the familiar events-and-delegates model. +## Class diagram ![alt text](./etc/event-asynchronous.png "Event-based Asynchronous") ## Applicability diff --git a/event-driven-architecture/README.md b/event-driven-architecture/README.md index e2f06cf5a..5fcce357f 100644 --- a/event-driven-architecture/README.md +++ b/event-driven-architecture/README.md @@ -13,6 +13,7 @@ tags: ## Intent Send and notify state changes of your objects to other applications using an Event-driven Architecture. +## Class diagram ![alt text](./etc/eda.png "Event Driven Architecture") ## Applicability diff --git a/event-queue/README.md b/event-queue/README.md index 081c01449..b4d7a071f 100644 --- a/event-queue/README.md +++ b/event-queue/README.md @@ -17,6 +17,7 @@ It puts all the requests in a queue and process them asynchronously. Gives the resource for the event when it is the next in the queue and in same time removes it from the queue. +## Class diagram ![alt text](./etc/model.png "Event Queue") ## Applicability diff --git a/event-sourcing/README.md b/event-sourcing/README.md index 1079405fa..9e577af6c 100644 --- a/event-sourcing/README.md +++ b/event-sourcing/README.md @@ -13,6 +13,7 @@ tags: ## Intent Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects. This can simplify tasks in complex domains, by avoiding the need to synchronize the data model and the business domain, while improving performance, scalability, and responsiveness. It can also provide consistency for transactional data, and maintain full audit trails and history that can enable compensating actions. +## Class diagram ![alt text](./etc/event-sourcing.png "Event Sourcing") ## Applicability diff --git a/execute-around/README.md b/execute-around/README.md index f669f18ff..9af46812e 100644 --- a/execute-around/README.md +++ b/execute-around/README.md @@ -16,6 +16,7 @@ should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource. +## Class diagram ![alt text](./etc/execute-around.png "Execute Around") ## Applicability diff --git a/extension-objects/README.md b/extension-objects/README.md index 9b5c93a22..5b0da5cf4 100644 --- a/extension-objects/README.md +++ b/extension-objects/README.md @@ -13,6 +13,7 @@ tags: Anticipate that an object’s interface needs to be extended in the future. Additional interfaces are defined by extension objects. +## Class diagram ![Extension_objects](./etc/extension_obj.png "Extension objects") ## Applicability diff --git a/facade/README.md b/facade/README.md index d6c64500c..89a6a32e9 100644 --- a/facade/README.md +++ b/facade/README.md @@ -197,6 +197,9 @@ facade.endDay(); // Dwarven tunnel digger goes to sleep. ``` +## Class diagram +![alt text](./etc/facade.urm.png "Facade pattern class diagram") + ## Applicability Use the Facade pattern when diff --git a/facade/etc/facade.urm.png b/facade/etc/facade.urm.png new file mode 100644 index 000000000..8e3ec7aca Binary files /dev/null and b/facade/etc/facade.urm.png differ diff --git a/factory-kit/README.md b/factory-kit/README.md index c25701047..f374886d4 100644 --- a/factory-kit/README.md +++ b/factory-kit/README.md @@ -13,6 +13,7 @@ tags: ## Intent Define a factory of immutable content with separated builder and factory interfaces. +## Class diagram ![alt text](./etc/factory-kit.png "Factory Kit") ## Applicability diff --git a/factory-method/README.md b/factory-method/README.md index be5ead3e7..37ab74393 100644 --- a/factory-method/README.md +++ b/factory-method/README.md @@ -62,6 +62,9 @@ blacksmith.manufactureWeapon(WeaponType.AXE); // Elvish weapons are created ``` +## Class diagram +![alt text](./etc/factory-method.urm.png "Factory Method pattern class diagram") + ## Applicability Use the Factory Method pattern when diff --git a/factory-method/etc/factory-method.urm.png b/factory-method/etc/factory-method.urm.png new file mode 100644 index 000000000..7c97aff91 Binary files /dev/null and b/factory-method/etc/factory-method.urm.png differ diff --git a/feature-toggle/README.md b/feature-toggle/README.md index c466b8a94..b4ba16cb4 100644 --- a/feature-toggle/README.md +++ b/feature-toggle/README.md @@ -18,6 +18,7 @@ and rolled out. Allowing switching back to the older feature quickly if needed. can easily introduce code complexity. There is also cause for concern that the old feature that the toggle is eventually going to phase out is never removed, causing redundant code smells and increased maintainability. +## Class diagram ![alt text](./etc/feature-toggle.png "Feature Toggle") ## Applicability @@ -29,4 +30,4 @@ Use the Feature Toggle pattern when ## Credits -* [Martin Fowler 29 October 2010 (2010-10-29).](http://martinfowler.com/bliki/FeatureToggle.html) \ No newline at end of file +* [Martin Fowler 29 October 2010 (2010-10-29).](http://martinfowler.com/bliki/FeatureToggle.html) diff --git a/fluentinterface/README.md b/fluentinterface/README.md index 767792da7..08e1275e9 100644 --- a/fluentinterface/README.md +++ b/fluentinterface/README.md @@ -21,6 +21,7 @@ A fluent interface can be implemented using any of * Static Factory Methods and Imports * Named parameters - can be simulated in Java using static factory methods. +## Class diagram ![Fluent Interface](./etc/fluentinterface.png "Fluent Interface") ## Applicability diff --git a/flux/README.md b/flux/README.md index 7ac312c44..43e791509 100644 --- a/flux/README.md +++ b/flux/README.md @@ -15,6 +15,7 @@ user interacts with a view, the view propagates an action through a central dispatcher, to the various stores that hold the application's data and business logic, which updates all of the views that are affected. +## Class diagram ![alt text](./etc/flux.png "Flux") ## Applicability diff --git a/flyweight/README.md b/flyweight/README.md index e008fc346..ff2ddcfe6 100644 --- a/flyweight/README.md +++ b/flyweight/README.md @@ -110,6 +110,9 @@ factory.createPotion(PotionType.HOLY_WATER).drink(); // You feel blessed. (Potio factory.createPotion(PotionType.HEALING).drink(); // You feel healed. (Potion=648129364) ``` +## Class diagram +![alt text](./etc/flyweight.urm.png "Flyweight pattern class diagram") + ## Applicability The Flyweight pattern's effectiveness depends heavily on how and where it's used. Apply the Flyweight pattern when all of the following are diff --git a/flyweight/etc/flyweight.urm.png b/flyweight/etc/flyweight.urm.png new file mode 100644 index 000000000..299cdb7bd Binary files /dev/null and b/flyweight/etc/flyweight.urm.png differ diff --git a/front-controller/README.md b/front-controller/README.md index a462a08e0..3126e5e24 100644 --- a/front-controller/README.md +++ b/front-controller/README.md @@ -14,6 +14,7 @@ Introduce a common handler for all requests for a web site. This way we can encapsulate common functionality such as security, internationalization, routing and logging in a single place. +## Class diagram ![alt text](./etc/front-controller.png "Front Controller") ## Applicability diff --git a/game-loop/README.md b/game-loop/README.md index 5df86e045..566ea37f3 100644 --- a/game-loop/README.md +++ b/game-loop/README.md @@ -34,7 +34,9 @@ The variable-step game loop chooses a time step to advance based on how much rea For fixed-step game loop, a certain amount of real time has elapsed since the last turn of the game loop. This is how much game time need to be simulated for the game’s “now” to catch up with the player’s. +## Class diagram +![alt text](./etc/game-loop.urm.png "Game Loop pattern class diagram") ## Credits -* [Game Programming Patterns - Game Loop](http://gameprogrammingpatterns.com/game-loop.html) \ No newline at end of file +* [Game Programming Patterns - Game Loop](http://gameprogrammingpatterns.com/game-loop.html) diff --git a/game-loop/etc/game-loop.urm.png b/game-loop/etc/game-loop.urm.png new file mode 100644 index 000000000..b7ffc11d2 Binary files /dev/null and b/game-loop/etc/game-loop.urm.png differ diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index 35044f9b2..28ffa9d98 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -12,6 +12,7 @@ tags: ## Intent Use Guarded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. +## Class diagram ![Guarded Suspension diagram](./etc/guarded-suspension.png) ## Applicability diff --git a/half-sync-half-async/README.md b/half-sync-half-async/README.md index ef463edad..4ad350d59 100644 --- a/half-sync-half-async/README.md +++ b/half-sync-half-async/README.md @@ -14,6 +14,7 @@ The Half-Sync/Half-Async pattern decouples synchronous I/O from asynchronous I/O in a system to simplify concurrent programming effort without degrading execution efficiency. +## Class diagram ![Half-Sync/Half-Async class diagram](./etc/half-sync-half-async.png) ## Applicability diff --git a/hexagonal/README.md b/hexagonal/README.md index 1e6f897d0..eb5ef0987 100644 --- a/hexagonal/README.md +++ b/hexagonal/README.md @@ -18,6 +18,7 @@ tags: ## Intent Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases. +## Class diagram ![Hexagonal Architecture class diagram](./etc/hexagonal.png) ## Applicability diff --git a/intercepting-filter/README.md b/intercepting-filter/README.md index c28713895..660d67e3d 100644 --- a/intercepting-filter/README.md +++ b/intercepting-filter/README.md @@ -12,11 +12,10 @@ tags: ## Intent Provide pluggable filters to conduct necessary pre-processing and post-processing to requests from a client to a target - + +## Class diagram ![alt text](./etc/intercepting-filter.png "Intercepting Filter") - - ## Applicability Use the Intercepting Filter pattern when diff --git a/interpreter/README.md b/interpreter/README.md index be6517962..634945005 100644 --- a/interpreter/README.md +++ b/interpreter/README.md @@ -15,6 +15,7 @@ Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. +## Class diagram ![alt text](./etc/interpreter_1.png "Interpreter") ## Applicability diff --git a/iterator/README.md b/iterator/README.md index 723e7f03c..3dfcb1085 100644 --- a/iterator/README.md +++ b/iterator/README.md @@ -17,6 +17,7 @@ Cursor Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. +## Class diagram ![alt text](./etc/iterator_1.png "Iterator") ## Applicability diff --git a/layers/README.md b/layers/README.md index 3214a9e61..66a5c9c32 100644 --- a/layers/README.md +++ b/layers/README.md @@ -15,15 +15,6 @@ tags: Layers is an architectural pattern where software responsibilities are divided among the different layers of the application. -![alt text](./etc/layers.png "Layers") - -## Applicability -Use the Layers architecture when - -* you want clearly divide software responsibilities into different parts of the program -* you want to prevent a change from propagating throughout the application -* you want to make your application more maintainable and testable - ## Explanation Real world example @@ -102,6 +93,16 @@ public class CakeViewImpl implements View { } ``` +## Class diagram +![alt text](./etc/layers.png "Layers") + +## Applicability +Use the Layers architecture when + +* you want clearly divide software responsibilities into different parts of the program +* you want to prevent a change from propagating throughout the application +* you want to make your application more maintainable and testable + ## Credits * [Pattern Oriented Software Architecture Vol I-V](http://www.amazon.com/Pattern-Oriented-Software-Architecture-Volume-Patterns/dp/0471958697) diff --git a/lazy-loading/README.md b/lazy-loading/README.md index d40061293..8156b3524 100644 --- a/lazy-loading/README.md +++ b/lazy-loading/README.md @@ -17,6 +17,7 @@ initialization of an object until the point at which it is needed. It can contribute to efficiency in the program's operation if properly and appropriately used. +## Class diagram ![alt text](./etc/lazy-loading.png "Lazy Loading") ## Applicability diff --git a/leader-election/README.md b/leader-election/README.md index 36c2670df..15f2f9341 100644 --- a/leader-election/README.md +++ b/leader-election/README.md @@ -12,6 +12,9 @@ tags: ## Intent Leader Election pattern is commonly used in cloud system design. It can help to ensure that task instances selec the leader instance correctly and do not conflict with each other, cause contention for shared resources, or inadvertently interfere with the work that other task instances are performing. +## Class diagram +![alt text](./etc/leader-election.urm.png "Leader Election pattern class diagram") + ## Applicability Use this pattern when diff --git a/leader-election/etc/leader-election.urm.png b/leader-election/etc/leader-election.urm.png new file mode 100644 index 000000000..85a90b75b Binary files /dev/null and b/leader-election/etc/leader-election.urm.png differ diff --git a/marker/README.md b/marker/README.md index 6f5fc1e91..70e92480e 100644 --- a/marker/README.md +++ b/marker/README.md @@ -12,6 +12,7 @@ tags: ## Intent Using empty interfaces as markers to distinguish special treated objects. +## Class diagram ![alt text](./etc/MarkerDiagram.png "Marker Interface") ## Applicability diff --git a/master-worker-pattern/README.md b/master-worker-pattern/README.md index f8b550936..239b83fde 100644 --- a/master-worker-pattern/README.md +++ b/master-worker-pattern/README.md @@ -17,6 +17,9 @@ tags: > Used for centralised parallel processing. +## Class diagram +![alt text](./etc/master-worker-pattern.urm.png "Master-Worker pattern class diagram") + ## Applicability This pattern can be used when data can be divided into multiple parts, all of which need to go through the same computation to give a result, which need to be aggregated to get the final result. diff --git a/master-worker-pattern/etc/master-worker-pattern.urm.png b/master-worker-pattern/etc/master-worker-pattern.urm.png new file mode 100644 index 000000000..a4c7a16d3 Binary files /dev/null and b/master-worker-pattern/etc/master-worker-pattern.urm.png differ diff --git a/mediator/README.md b/mediator/README.md index 3452082ef..4e38d833c 100644 --- a/mediator/README.md +++ b/mediator/README.md @@ -15,6 +15,7 @@ Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. +## Class diagram ![alt text](./etc/mediator_1.png "Mediator") ## Applicability diff --git a/memento/README.md b/memento/README.md index 463b5fec0..34555f550 100644 --- a/memento/README.md +++ b/memento/README.md @@ -17,6 +17,7 @@ Token Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. +## Class diagram ![alt text](./etc/memento.png "Memento") ## Applicability diff --git a/model-view-controller/README.md b/model-view-controller/README.md index bc96f7ab1..acc3c07a9 100644 --- a/model-view-controller/README.md +++ b/model-view-controller/README.md @@ -15,6 +15,7 @@ the model, the view and the controller. Let the model manage the data, the view display the data and the controller mediate updating the data and redrawing the display. +## Class diagram ![alt text](./etc/model-view-controller.png "Model-View-Controller") ## Applicability diff --git a/model-view-presenter/README.md b/model-view-presenter/README.md index a3b921ce4..ede8e3bae 100644 --- a/model-view-presenter/README.md +++ b/model-view-presenter/README.md @@ -13,6 +13,7 @@ tags: Apply a "Separation of Concerns" principle in a way that allows developers to build and test user interfaces. +## Class diagram ![alt text](./etc/model-view-presenter_1.png "Model-View-Presenter") ## Applicability diff --git a/module/README.md b/module/README.md index 39f4dbffd..316458e0b 100644 --- a/module/README.md +++ b/module/README.md @@ -12,6 +12,7 @@ tags: ## Intent Module pattern is used to implement the concept of software modules, defined by modular programming, in a programming language with incomplete direct support for the concept. +## Class diagram ![alt text](./etc/module.png "Module") ## Applicability diff --git a/monad/README.md b/monad/README.md index 41edd3d92..cf751929c 100644 --- a/monad/README.md +++ b/monad/README.md @@ -19,6 +19,7 @@ operations: bind - that takes monadic object and a function from plain object to monadic value and returns monadic value return - that takes plain type object and returns this object wrapped in a monadic value. +## Class diagram ![alt text](./etc/monad.png "Monad") ## Applicability @@ -32,4 +33,4 @@ Use the Monad in any of the following situations * [Design Pattern Reloaded by Remi Forax](https://youtu.be/-k2X7guaArU) * [Brian Beckman: Don't fear the Monad](https://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads) -* [Monad on Wikipedia](https://en.wikipedia.org/wiki/Monad_(functional_programming)) \ No newline at end of file +* [Monad on Wikipedia](https://en.wikipedia.org/wiki/Monad_(functional_programming)) diff --git a/monostate/README.md b/monostate/README.md index 3576dc659..93cf6a45b 100644 --- a/monostate/README.md +++ b/monostate/README.md @@ -15,6 +15,7 @@ Borg ## Intent Enforces a behaviour like sharing the same state amongst all instances. +## Class diagram ![alt text](./etc/monostate.png "MonoState") ## Applicability diff --git a/multiton/README.md b/multiton/README.md index 0462ff0ec..105dd9d91 100644 --- a/multiton/README.md +++ b/multiton/README.md @@ -16,6 +16,7 @@ Registry Ensure a class only has limited number of instances, and provide a global point of access to them. +## Class diagram ![alt text](./etc/multiton.png "Multiton") ## Applicability diff --git a/mute-idiom/README.md b/mute-idiom/README.md index bb674b648..7df0ae110 100644 --- a/mute-idiom/README.md +++ b/mute-idiom/README.md @@ -14,7 +14,7 @@ tags: Provide a template to suppress any exceptions that either are declared but cannot occur or should only be logged; while executing some business logic. The template removes the need to write repeated `try-catch` blocks. - +## Class diagram ![alt text](./etc/mute-idiom.png "Mute Idiom") ## Applicability diff --git a/mutex/README.md b/mutex/README.md index 84755872f..14b465a60 100644 --- a/mutex/README.md +++ b/mutex/README.md @@ -16,6 +16,7 @@ Binary Semaphore ## Intent Create a lock which only allows a single thread to access a resource at any one instant. +## Class diagram ![alt text](./etc/mutex.png "Mutex") ## Applicability diff --git a/naked-objects/README.md b/naked-objects/README.md index eb1c083b1..3d3cdaab9 100644 --- a/naked-objects/README.md +++ b/naked-objects/README.md @@ -14,6 +14,7 @@ The Naked Objects architectural pattern is well suited for rapid prototyping. Using the pattern, you only need to write the domain objects, everything else is autogenerated by the framework. +## Class diagram ![alt text](./etc/naked-objects.png "Naked Objects") ## Applicability diff --git a/null-object/README.md b/null-object/README.md index 0ed28a0af..1be72a1b7 100644 --- a/null-object/README.md +++ b/null-object/README.md @@ -19,6 +19,7 @@ implements the expected interface, but whose method body is empty. The advantage of this approach over a working default implementation is that a Null Object is very predictable and has no side effects: it does nothing. +## Class diagram ![alt text](./etc/null-object.png "Null Object") ## Applicability diff --git a/object-mother/README.md b/object-mother/README.md index 125ecdfe5..bd4c14e1c 100644 --- a/object-mother/README.md +++ b/object-mother/README.md @@ -12,6 +12,7 @@ tags: ## Object Mother Define a factory of immutable content with separated builder and factory interfaces. +## Class diagram ![alt text](./etc/object-mother.png "Object Mother") ## Applicability diff --git a/object-pool/README.md b/object-pool/README.md index cf36d9880..f6b80539b 100644 --- a/object-pool/README.md +++ b/object-pool/README.md @@ -16,6 +16,7 @@ short periods of time it is advantageous to utilize the Object Pool pattern. The Object Pool provides a cache for instantiated objects tracking which ones are in use and which are available. +## Class diagram ![alt text](./etc/object-pool.png "Object Pool") ## Applicability diff --git a/observer/README.md b/observer/README.md index afeb0b37d..12a0a4677 100644 --- a/observer/README.md +++ b/observer/README.md @@ -19,6 +19,7 @@ Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. +## Class diagram ![alt text](./etc/observer.png "Observer") ## Applicability diff --git a/page-object/README.md b/page-object/README.md index 16c021dfb..13586e064 100644 --- a/page-object/README.md +++ b/page-object/README.md @@ -13,7 +13,7 @@ tags: Page Object encapsulates the UI, hiding the underlying UI widgetry of an application (commonly a web application) and providing an application-specific API to allow the manipulation of UI components required for tests. In doing so, it allows the test class itself to focus on the test logic instead. - +## Class diagram ![alt text](./etc/page-object.png "Page Object") diff --git a/partial-response/README.md b/partial-response/README.md index f81dffaa1..ebec3d97a 100644 --- a/partial-response/README.md +++ b/partial-response/README.md @@ -15,6 +15,7 @@ tags: Send partial response from server to client on need basis. Client will specify the the fields that it need to server, instead of serving all details for resource. +## Class diagram ![alt text](./etc/partial-response.urm.png "partial-response") ## Applicability diff --git a/pipeline/README.md b/pipeline/README.md index e990affd6..2afa6da9a 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -13,6 +13,9 @@ tags: ## Intent Allows processing of data in a series of stages by giving in an initial input and passing the processed output to be used by the next stages. +## Class diagram +![alt text](./etc/pipeline.urm.png "Pipeline pattern class diagram") + ## Applicability Use the Pipeline pattern when you want to @@ -34,4 +37,4 @@ Use the Pipeline pattern when you want to * [The Pipeline Pattern — for fun and profit](https://medium.com/@aaronweatherall/the-pipeline-pattern-for-fun-and-profit-9b5f43a98130) * [The Pipeline design pattern (in Java)](https://medium.com/@deepakbapat/the-pipeline-design-pattern-in-java-831d9ce2fe21) -* [Pipelines | Microsoft Docs](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/ff963548(v=pandp.10)) \ No newline at end of file +* [Pipelines | Microsoft Docs](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/ff963548(v=pandp.10)) diff --git a/pipeline/etc/pipeline.urm.png b/pipeline/etc/pipeline.urm.png new file mode 100644 index 000000000..4110f1624 Binary files /dev/null and b/pipeline/etc/pipeline.urm.png differ diff --git a/poison-pill/README.md b/poison-pill/README.md index 0815b376e..a4f842086 100644 --- a/poison-pill/README.md +++ b/poison-pill/README.md @@ -14,6 +14,7 @@ tags: Poison Pill is known predefined data item that allows to provide graceful shutdown for separate distributed consumption process. +## Class diagram ![alt text](./etc/poison-pill.png "Poison Pill") ## Applicability diff --git a/priority-queue/README.md b/priority-queue/README.md index bc8d7b8cf..37a6e908d 100644 --- a/priority-queue/README.md +++ b/priority-queue/README.md @@ -15,6 +15,9 @@ Prioritize requests sent to services so that requests with a higher priority are ## Explanation Applications may delegate specific tasks to other services; for example, to perform background processing or to integrate with other applications or services. In the cloud, a message queue is typically used to delegate tasks to background processing. In many cases the order in which requests are received by a service is not important. However, in some cases it may be necessary to prioritize specific requests. These requests should be processed earlier than others of a lower priority that may have been sent previously by the application. +## Class diagram +![alt text](./etc/priority-queue.urm.png "Priority Queue pattern class diagram") + ## Applicability Use the Property pattern when diff --git a/priority-queue/etc/priority-queue.urm.png b/priority-queue/etc/priority-queue.urm.png new file mode 100644 index 000000000..e0b4295a5 Binary files /dev/null and b/priority-queue/etc/priority-queue.urm.png differ diff --git a/private-class-data/README.md b/private-class-data/README.md index 981208fa3..7937697c2 100644 --- a/private-class-data/README.md +++ b/private-class-data/README.md @@ -15,6 +15,7 @@ Private Class Data design pattern seeks to reduce exposure of attributes by limiting their visibility. It reduces the number of class attributes by encapsulating them in single Data object. +## Class diagram ![alt text](./etc/private-class-data.png "Private Class Data") ## Applicability diff --git a/producer-consumer/README.md b/producer-consumer/README.md index 1bb84c35f..12147af42 100644 --- a/producer-consumer/README.md +++ b/producer-consumer/README.md @@ -16,6 +16,7 @@ Producer Consumer Design pattern is a classic concurrency pattern which reduces coupling between Producer and Consumer by separating Identification of work with Execution of Work. +## Class diagram ![alt text](./etc/producer-consumer.png "Producer Consumer") ## Applicability diff --git a/promise/README.md b/promise/README.md index fa9556547..3eb5efcb6 100644 --- a/promise/README.md +++ b/promise/README.md @@ -20,6 +20,7 @@ allows you to associate dependent promises to an asynchronous action's eventual failure reason. Promises are a way to write async code that still appears as though it is executing in a synchronous way. +## Class diagram ![alt text](./etc/promise.png "Promise") ## Applicability diff --git a/property/README.md b/property/README.md index 0ac5c7a6c..60d82434e 100644 --- a/property/README.md +++ b/property/README.md @@ -13,6 +13,7 @@ tags: Create hierarchy of objects and new objects using already existing objects as parents. +## Class diagram ![alt text](./etc/property.png "Property") ## Applicability diff --git a/prototype/README.md b/prototype/README.md index 4cb8c0365..fe796183c 100644 --- a/prototype/README.md +++ b/prototype/README.md @@ -62,6 +62,9 @@ cloned.setName("Dolly"); System.out.println(cloned.getName()); // Dolly ``` +## Class diagram +![alt text](./etc/prototype.urm.png "Prototype pattern class diagram") + ## Applicability Use the Prototype pattern when a system should be independent of how its products are created, composed and represented; and diff --git a/prototype/etc/prototype.urm.png b/prototype/etc/prototype.urm.png new file mode 100644 index 000000000..b23c6d1cf Binary files /dev/null and b/prototype/etc/prototype.urm.png differ diff --git a/proxy/README.md b/proxy/README.md index 71eba2280..e94ebfbc6 100644 --- a/proxy/README.md +++ b/proxy/README.md @@ -109,6 +109,9 @@ proxy.enter(new Wizard("Green wizard")); // Green wizard is not allowed to enter proxy.enter(new Wizard("Brown wizard")); // Brown wizard is not allowed to enter! ``` +## Class diagram +![alt text](./etc/proxy.urm.png "Proxy pattern class diagram") + ## Applicability Proxy is applicable whenever there is a need for a more versatile or sophisticated reference to an object than a simple pointer. Here diff --git a/proxy/etc/proxy.urm.png b/proxy/etc/proxy.urm.png new file mode 100644 index 000000000..a0c94fc7c Binary files /dev/null and b/proxy/etc/proxy.urm.png differ diff --git a/queue-load-leveling/README.md b/queue-load-leveling/README.md index 13821a54e..f965448b2 100644 --- a/queue-load-leveling/README.md +++ b/queue-load-leveling/README.md @@ -16,9 +16,9 @@ intermittent heavy loads that may otherwise cause the service to fail or the tas This pattern can help to minimize the impact of peaks in demand on availability and responsiveness for both the task and the service. +## Class diagram ![alt text](./etc/queue-load-leveling.gif "queue-load-leveling") - ## Applicability * This pattern is ideally suited to any type of application that uses services that may be subject to overloading. diff --git a/reactor/README.md b/reactor/README.md index ba96f9c68..e18595656 100644 --- a/reactor/README.md +++ b/reactor/README.md @@ -14,6 +14,7 @@ tags: ## Intent The Reactor design pattern handles service requests that are delivered concurrently to an application by one or more clients. The application can register specific handlers for processing which are called by reactor on specific events. Dispatching of event handlers is performed by an initiation dispatcher, which manages the registered event handlers. Demultiplexing of service requests is performed by a synchronous event demultiplexer. +## Class diagram ![Reactor](./etc/reactor.png "Reactor") ## Applicability diff --git a/reader-writer-lock/README.md b/reader-writer-lock/README.md index 40b711361..30cbc0dc5 100644 --- a/reader-writer-lock/README.md +++ b/reader-writer-lock/README.md @@ -11,21 +11,22 @@ tags: - Performance --- -**Intent:** +## Intent Suppose we have a shared memory area with the basic constraints detailed above. It is possible to protect the shared data behind a mutual exclusion mutex, in which case no two threads can access the data at the same time. However, this solution is suboptimal, because it is possible that a reader R1 might have the lock, and then another reader R2 requests access. It would be foolish for R2 to wait until R1 was done before starting its own read operation; instead, R2 should start right away. This is the motivation for the Reader Writer Lock pattern. +## Class diagram ![alt text](./etc/reader-writer-lock.png "Reader writer lock") -**Applicability:** +## Applicability Application need to increase the performance of resource synchronize for multiple thread, in particularly there are mixed read/write operations. -**Real world examples:** +## Real world examples * [Java Reader Writer Lock](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReadWriteLock.html) -**Credits** +## Credits * [Readers–writer lock](https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock) diff --git a/repository/README.md b/repository/README.md index b1f4fb97f..400e37eb0 100644 --- a/repository/README.md +++ b/repository/README.md @@ -17,6 +17,7 @@ to minimize scattering and duplication of query code. The Repository pattern is especially useful in systems where number of domain classes is large or heavy querying is utilized. +## Class diagram ![alt text](./etc/repository.png "Repository") ## Applicability @@ -35,4 +36,4 @@ Use the Repository pattern when * [Don’t use DAO, use Repository](http://thinkinginobjects.com/2012/08/26/dont-use-dao-use-repository/) * [Advanced Spring Data JPA - Specifications and Querydsl](https://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/) -* [Repository Pattern Benefits and Spring Implementation](https://stackoverflow.com/questions/40068965/repository-pattern-benefits-and-spring-implementation) \ No newline at end of file +* [Repository Pattern Benefits and Spring Implementation](https://stackoverflow.com/questions/40068965/repository-pattern-benefits-and-spring-implementation) diff --git a/resource-acquisition-is-initialization/README.md b/resource-acquisition-is-initialization/README.md index 821f220d7..3591cf915 100644 --- a/resource-acquisition-is-initialization/README.md +++ b/resource-acquisition-is-initialization/README.md @@ -13,6 +13,7 @@ tags: ## Intent Resource Acquisition Is Initialization pattern can be used to implement exception safe resource management. +## Class diagram ![alt text](./etc/resource-acquisition-is-initialization.png "Resource Acquisition Is Initialization") ## Applicability diff --git a/retry/README.md b/retry/README.md index 1b9987e66..59958403c 100644 --- a/retry/README.md +++ b/retry/README.md @@ -18,8 +18,6 @@ Transparently retry certain operations that involve communication with external resources, particularly over the network, isolating calling code from the retry implementation details. -![alt text](./etc/retry.png "Retry") - ## Explanation The `Retry` pattern consists retrying operations on remote resources over the network a set number of times. It closely depends on both business and technical @@ -131,6 +129,9 @@ attempts were left. [1] Please note that *Hystrix* is a complete implementation of the *Circuit Breaker* pattern, of which the *Retry* pattern can be considered a subset of. +## Class diagram +![alt text](./etc/retry.png "Retry") + ## Applicability Whenever an application needs to communicate with an external resource, particularly in a cloud environment, and if the business requirements allow it. diff --git a/role-object/README.md b/role-object/README.md index 0e960140c..e5378afde 100644 --- a/role-object/README.md +++ b/role-object/README.md @@ -18,6 +18,9 @@ Adapt an object to different client’s needs through transparently attached rol the object has to play in that client’s context. The object manages its role set dynamically. By representing roles as individual objects, different contexts are kept separate and system configuration is simplified. +## Class diagram +![alt text](./etc/role-object.urm.png "Role Object pattern class diagram") + ## Applicability Use the Role Object pattern, if: - you want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface. diff --git a/role-object/etc/role-object.urm.png b/role-object/etc/role-object.urm.png new file mode 100644 index 000000000..65201c68a Binary files /dev/null and b/role-object/etc/role-object.urm.png differ diff --git a/saga/README.md b/saga/README.md index 546ad598b..bfb39461a 100644 --- a/saga/README.md +++ b/saga/README.md @@ -35,6 +35,9 @@ In this approach, there is a Saga orchestrator that manages all the transactions the participant services to execute local transactions based on events. This orchestrator can also be though of as a Saga Manager. +## Class diagram +![alt text](./etc/saga.urm.png "Saga pattern class diagram") + ## Applicability Use the Saga pattern, if: - you need to perform a group of operations related to different microservices atomically diff --git a/saga/etc/saga.urm.png b/saga/etc/saga.urm.png new file mode 100644 index 000000000..025be6bbd Binary files /dev/null and b/saga/etc/saga.urm.png differ diff --git a/semaphore/README.md b/semaphore/README.md index 46ccd7b8e..a59d7b398 100644 --- a/semaphore/README.md +++ b/semaphore/README.md @@ -19,6 +19,7 @@ of the semaphore, can access the resources at any given time. A semaphore which only allows one concurrent access to a resource is called a binary semaphore. +## Class diagram ![alt text](./etc/semaphore.png "Semaphore") ## Applicability diff --git a/servant/README.md b/servant/README.md index 3e82ab2cf..67470b678 100644 --- a/servant/README.md +++ b/servant/README.md @@ -14,6 +14,7 @@ Servant is used for providing some behavior to a group of classes. Instead of defining that behavior in each class - or when we cannot factor out this behavior in the common parent class - it is defined once in the Servant. +## Class diagram ![alt text](./etc/servant-pattern.png "Servant") ## Applicability diff --git a/serverless/README.md b/serverless/README.md index 16589b7bd..46e646f06 100644 --- a/serverless/README.md +++ b/serverless/README.md @@ -59,6 +59,9 @@ dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity. +## Class diagram +![alt text](./etc/serverless.urm.png "Serverless pattern class diagram") + ## Serverless framework [Serverless](https://serverless.com/) is a toolkit for deploying and operating serverless architectures. diff --git a/serverless/etc/serverless.urm.png b/serverless/etc/serverless.urm.png new file mode 100644 index 000000000..18149d562 Binary files /dev/null and b/serverless/etc/serverless.urm.png differ diff --git a/service-layer/README.md b/service-layer/README.md index 9b685d4e3..9abb6294a 100644 --- a/service-layer/README.md +++ b/service-layer/README.md @@ -17,6 +17,7 @@ others. Despite their different purposes, these interfaces often need common interactions with the application to access and manipulate its data and invoke its business logic. The Service Layer fulfills this role. +## Class diagram ![alt text](./etc/service-layer.png "Service Layer") ## Applicability diff --git a/service-locator/README.md b/service-locator/README.md index 974a2a5fe..0be75f117 100644 --- a/service-locator/README.md +++ b/service-locator/README.md @@ -14,6 +14,7 @@ tags: Encapsulate the processes involved in obtaining a service with a strong abstraction layer. +## Class diagram ![alt text](./etc/service-locator.png "Service Locator") ## Applicability diff --git a/sharding/README.md b/sharding/README.md index 3184e405e..aeeb71828 100644 --- a/sharding/README.md +++ b/sharding/README.md @@ -13,6 +13,9 @@ tags: Sharding pattern means divide the data store into horizontal partitions or shards. Each shard has the same schema, but holds its own distinct subset of the data. A shard is a data store in its own right (it can contain the data for many entities of different types), running on a server acting as a storage node. +## Class diagram +![alt text](./etc/sharding.urm.png "Sharding pattern class diagram") + ## Applicability This pattern offers the following benefits: @@ -23,4 +26,4 @@ This pattern offers the following benefits: ## Credits -* [Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications - Sharding Pattern](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589797(v=pandp.10)?redirectedfrom=MSDN) \ No newline at end of file +* [Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications - Sharding Pattern](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589797(v=pandp.10)?redirectedfrom=MSDN) diff --git a/sharding/etc/sharding.urm.png b/sharding/etc/sharding.urm.png new file mode 100644 index 000000000..e7f412af3 Binary files /dev/null and b/sharding/etc/sharding.urm.png differ diff --git a/singleton/README.md b/singleton/README.md index 52aca8e16..d82f7d862 100644 --- a/singleton/README.md +++ b/singleton/README.md @@ -48,6 +48,9 @@ EnumIvoryTower enumIvoryTower2 = EnumIvoryTower.INSTANCE; assertEquals(enumIvoryTower1, enumIvoryTower2); // true ``` +## Class diagram +![alt text](./etc/singleton.urm.png "Singleton pattern class diagram") + ## Applicability Use the Singleton pattern when diff --git a/singleton/etc/singleton.urm.png b/singleton/etc/singleton.urm.png new file mode 100644 index 000000000..46584af40 Binary files /dev/null and b/singleton/etc/singleton.urm.png differ diff --git a/spatial-partition/README.md b/spatial-partition/README.md index 6e55f9544..5206708bc 100644 --- a/spatial-partition/README.md +++ b/spatial-partition/README.md @@ -14,11 +14,6 @@ As explained in the book [Game Programming Patterns](http://gameprogrammingpatte > efficiently locate objects by storing them in a data structure organized by their positions. -## Applicability -This pattern can be used: -* When you need to keep track of a large number of objects' positions, which are getting updated every frame. -* When it is acceptable to trade memory for speed, since creating and updating data structure will use up extra memory. - ## Explanation Say, you are building a war game with hundreds, or maybe even thousands of players, who are clashing on the battle field. Each player's position is getting updated every frame. The simple way to handle all interactions taking place on the field is to check each player's position against every other player's position: @@ -48,7 +43,14 @@ The idea behind the Spatial Partition design pattern is to enable quick location In our implementation, we use the Quadtree data structure which will reduce the time complexity of finding the objects within a certain range from O(n^2) to O(nlogn), decreasing the computations required significantly in case of large number of objects. +## Class diagram +![alt text](./etc/spatial-partition.urm.png "Spatial Partition pattern class diagram") + +## Applicability +This pattern can be used: +* When you need to keep track of a large number of objects' positions, which are getting updated every frame. +* When it is acceptable to trade memory for speed, since creating and updating data structure will use up extra memory. + ## Credits * [Game Programming Patterns/Spatial Partition](http://gameprogrammingpatterns.com/spatial-partition.html) by Bob Nystrom * [Quadtree tutorial](https://www.youtube.com/watch?v=OJxEcs0w_kE) by Daniel Schiffman - diff --git a/spatial-partition/etc/spatial-partition.urm.png b/spatial-partition/etc/spatial-partition.urm.png new file mode 100644 index 000000000..5172bdb36 Binary files /dev/null and b/spatial-partition/etc/spatial-partition.urm.png differ diff --git a/specification/README.md b/specification/README.md index 1764f448b..8c32a7875 100644 --- a/specification/README.md +++ b/specification/README.md @@ -19,14 +19,6 @@ candidate, from the candidate object that it is matched against. As well as its usefulness in selection, it is also valuable for validation and for building to order. -![alt text](./etc/specification.png "Specification") - -## Applicability -Use the Specification pattern when - -* You need to select a subset of objects based on some criteria, and to refresh the selection at various times. -* You need to check that only suitable objects are used for a certain role (validation). - ## Explanation Real world example @@ -190,6 +182,15 @@ Instead, we just create an instance of ``AbstractSelector`` "on the spot", using | Composite Specification | There are a lot of selection criteria that can be combined in multiple ways, hence it is not feasible to create a class for each selector | + Very flexible, without requiring many specialized classes | - Somewhat more difficult to comprehend | | | | + Supports logical operations | - You still need to create the base classes used as leaves | +## Class diagram +![alt text](./etc/specification.png "Specification") + +## Applicability +Use the Specification pattern when + +* You need to select a subset of objects based on some criteria, and to refresh the selection at various times. +* You need to check that only suitable objects are used for a certain role (validation). + ## Related patterns * Repository diff --git a/state/README.md b/state/README.md index 549afa61f..726d842ae 100644 --- a/state/README.md +++ b/state/README.md @@ -17,6 +17,7 @@ Objects for States Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. +## Class diagram ![alt text](./etc/state_1.png "State") ## Applicability diff --git a/step-builder/README.md b/step-builder/README.md index bc636e37a..b4394496d 100644 --- a/step-builder/README.md +++ b/step-builder/README.md @@ -13,6 +13,7 @@ tags: An extension of the Builder pattern that fully guides the user through the creation of the object with no chances of confusion. The user experience will be much more improved by the fact that he will only see the next step methods available, NO build method until is the right time to build the object. +## Class diagram ![alt text](./etc/step-builder.png "Step Builder") ## Applicability diff --git a/strategy/README.md b/strategy/README.md index 4c7147bed..b6f41c027 100644 --- a/strategy/README.md +++ b/strategy/README.md @@ -18,6 +18,7 @@ Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. +## Class diagram ![alt text](./etc/strategy_1.png "Strategy") ## Applicability diff --git a/subclass-sandbox/README.md b/subclass-sandbox/README.md index b4c8952b0..8fb034279 100644 --- a/subclass-sandbox/README.md +++ b/subclass-sandbox/README.md @@ -12,6 +12,9 @@ tags: ## Intent The subclass sandbox pattern describes a basic idea, while not having a lot of detailed mechanics. You will need the pattern when you have several similar subclasses. If you have to make a tiny change, then change the base class, while all subclasses shouldn't have to be touched. So the base class has to be able to provide all of the operations a derived class needs to perform. +## Class diagram +![alt text](./etc/subclass-sandbox.urm.png "Subclass Sandbox pattern class diagram") + ## Applicability The Subclass Sandbox pattern is a very simple, common pattern lurking in lots of codebases, even outside of games. If you have a non-virtual protected method laying around, you’re probably already using something like this. Subclass Sandbox is a good fit when: diff --git a/subclass-sandbox/etc/subclass-sandbox.urm.png b/subclass-sandbox/etc/subclass-sandbox.urm.png new file mode 100644 index 000000000..db81e12cc Binary files /dev/null and b/subclass-sandbox/etc/subclass-sandbox.urm.png differ diff --git a/template-method/README.md b/template-method/README.md index 22c2ac2c3..b1ad04fb6 100644 --- a/template-method/README.md +++ b/template-method/README.md @@ -17,6 +17,7 @@ an algorithm without changing the algorithm's structure. To make sure that subclasses don’t override the template method, the template method should be declared `final`. +## Class diagram ![alt text](./etc/template-method_1.png "Template Method") ## Applicability diff --git a/thread-pool/README.md b/thread-pool/README.md index 9806fa8e0..445fba07b 100644 --- a/thread-pool/README.md +++ b/thread-pool/README.md @@ -17,6 +17,7 @@ the system spend more time creating and destroying the threads than executing the actual tasks. Thread Pool solves this problem by reusing existing threads and eliminating the latency of creating new threads. +## Class diagram ![alt text](./etc/thread-pool.png "Thread Pool") ## Applicability diff --git a/throttling/README.md b/throttling/README.md index 73d982bff..ad0361f39 100644 --- a/throttling/README.md +++ b/throttling/README.md @@ -12,6 +12,9 @@ tags: ## Intent Ensure that a given client is not able to access service resources more than the assigned limit. +## Class diagram +![alt text](./etc/throttling-pattern.png "Throttling pattern class diagram") + ## Applicability The Throttling pattern should be used: diff --git a/tls/README.md b/tls/README.md index 3fb5e9a6b..ac4aa2490 100644 --- a/tls/README.md +++ b/tls/README.md @@ -13,6 +13,7 @@ tags: ## Intent Securing variables global to a thread against being spoiled by other threads. That is needed if you use class variables or static variables in your Callable object or Runnable object that are not read-only. +## Class diagram ![alt text](./etc/tls.png "Thread Local Storage") ## Applicability diff --git a/tolerant-reader/README.md b/tolerant-reader/README.md index be0085f2c..5ba0fd09f 100644 --- a/tolerant-reader/README.md +++ b/tolerant-reader/README.md @@ -15,6 +15,7 @@ robust communication systems. The idea is to be as tolerant as possible when reading data from another service. This way, when the communication schema changes, the readers must not break. +## Class diagram ![alt text](./etc/tolerant-reader.png "Tolerant Reader") ## Applicability diff --git a/trampoline/README.md b/trampoline/README.md index dc0bb270c..77b4daa7b 100644 --- a/trampoline/README.md +++ b/trampoline/README.md @@ -18,10 +18,11 @@ It is possible by representing a computation in one of 2 states : done | more (completed with result, or a reference to the reminder of the computation, something like the way a java.util.Supplier does). - ## Explanation Trampoline pattern allows to define recursive algorithms by iterative loop. +## Class diagram +![alt text](./etc/trampoline.urm.png "Trampoline pattern class diagram") ## Applicability Use the Trampoline pattern when @@ -41,5 +42,3 @@ Trampolines in Java usually involve the creation of a GenericListener to pass ev ## Credits * [library 'cyclops-react' uses the pattern](https://github.com/aol/cyclops-react) - - diff --git a/trampoline/etc/trampoline.urm.png b/trampoline/etc/trampoline.urm.png new file mode 100644 index 000000000..f2e9c7439 Binary files /dev/null and b/trampoline/etc/trampoline.urm.png differ diff --git a/twin/README.md b/twin/README.md index 3795236bb..cc7198ff4 100644 --- a/twin/README.md +++ b/twin/README.md @@ -13,6 +13,7 @@ tags: Twin pattern is a design pattern which provides a standard solution to simulate multiple inheritance in java +## Class diagram ![alt text](./etc/twin.png "Twin") ## Applicability diff --git a/typeobjectpattern/README.md b/typeobjectpattern/README.md index 97aa64e0b..4cc49e9b7 100644 --- a/typeobjectpattern/README.md +++ b/typeobjectpattern/README.md @@ -1,6 +1,6 @@ --- layout: pattern -title: Type-object +title: Type-Object folder: typeobjectpattern permalink: /patterns/typeobjectpattern/ categories: Game Programming Patterns/Behavioral Patterns @@ -14,15 +14,18 @@ As explained in the book Game Programming Patterns by Robert Nystrom, type objec > Allowing flexible creation of new “classes” by creating a single class, each instance of which represents a different type of object +## Explanation +Say, we are working on a game which has a hero and many monsters which are going to attack the hero. These monsters have certain attributes like attack, points etc. and come in different 'breeds' like zombie or ogres. The obvious answer is to have a base Monster class which has some fields and methods, which may be overriden by subclasses like the Zombie or Ogre class. But as we continue to build the game, there may be more and more breeds of monsters added and certain attributes may need to be changed in the existing monsters too. The OOP solution of inheriting from the base class would not be an efficient method in this case. +Using the type-object pattern, instead of creating many classes inheriting from a base class, we have 1 class with a field which represents the 'type' of object. This makes the code cleaner and object instantiation also becomes as easy as parsing a json file with the object properties. + +## Class diagram +![alt text](./etc/typeobjectpattern.urm.png "Type-Object pattern class diagram") + ## Applicability This pattern can be used when: * We don’t know what types we will need up front. * We want to be able to modify or add new types without having to recompile or change code. * Only difference between the different 'types' of objects is the data, not the behaviour. - -## Explanation -Say, we are working on a game which has a hero and many monsters which are going to attack the hero. These monsters have certain attributes like attack, points etc. and come in different 'breeds' like zombie or ogres. The obvious answer is to have a base Monster class which has some fields and methods, which may be overriden by subclasses like the Zombie or Ogre class. But as we continue to build the game, there may be more and more breeds of monsters added and certain attributes may need to be changed in the existing monsters too. The OOP solution of inheriting from the base class would not be an efficient method in this case. -Using the type-object pattern, instead of creating many classes inheriting from a base class, we have 1 class with a field which represents the 'type' of object. This makes the code cleaner and object instantiation also becomes as easy as parsing a json file with the object properties. ## Credits * [Game Programming Patterns/Type Object](http://gameprogrammingpatterns.com/type-object.html) by Robert Nystrom diff --git a/typeobjectpattern/etc/typeobjectpattern.urm.png b/typeobjectpattern/etc/typeobjectpattern.urm.png new file mode 100644 index 000000000..477dac5f2 Binary files /dev/null and b/typeobjectpattern/etc/typeobjectpattern.urm.png differ diff --git a/unit-of-work/README.md b/unit-of-work/README.md index b2fbde8ff..a7c911220 100644 --- a/unit-of-work/README.md +++ b/unit-of-work/README.md @@ -16,6 +16,7 @@ tags: When a business transaction is completed, all the these updates are sent as one big unit of work to be persisted in a database in one go so as to minimize database trips. +## Class diagram ![alt text](etc/unit-of-work.urm.png "unit-of-work") ## Applicability diff --git a/update-method/README.md b/update-method/README.md index 50cba44f3..73c5fe358 100644 --- a/update-method/README.md +++ b/update-method/README.md @@ -12,6 +12,14 @@ tags: ## Intent Update method pattern simulates a collection of independent objects by telling each to process one frame of behavior at a time. +## Explanation +The game world maintains a collection of objects. Each object implements an update method that simulates one frame of the object’s behavior. Each frame, the game updates every object in the collection. + +To learn more about how the game loop runs and when the update methods are invoked, please refer to Game Loop Pattern. + +## Class diagram +![alt text](./etc/update-method.urm.png "Update Method pattern class diagram") + ## Applicability If the Game Loop pattern is the best thing since sliced bread, then the Update Method pattern is its butter. A wide swath of games featuring live entities that the player interacts with use this pattern in some form or other. If the game has space marines, dragons, Martians, ghosts, or athletes, there’s a good chance it uses this pattern. @@ -25,11 +33,6 @@ Update methods work well when: - The objects need to be simulated over time. -## Explanation -The game world maintains a collection of objects. Each object implements an update method that simulates one frame of the object’s behavior. Each frame, the game updates every object in the collection. - -To learn more about how the game loop runs and when the update methods are invoked, please refer to Game Loop Pattern. - ## Credits -* [Game Programming Patterns - Update Method](http://gameprogrammingpatterns.com/update-method.html) \ No newline at end of file +* [Game Programming Patterns - Update Method](http://gameprogrammingpatterns.com/update-method.html) diff --git a/update-method/etc/update-method.urm.png b/update-method/etc/update-method.urm.png new file mode 100644 index 000000000..ddc47b5fe Binary files /dev/null and b/update-method/etc/update-method.urm.png differ diff --git a/value-object/README.md b/value-object/README.md index 83223d8a2..4fa384037 100644 --- a/value-object/README.md +++ b/value-object/README.md @@ -14,6 +14,7 @@ Provide objects which follow value semantics rather than reference semantics. This means value objects' equality are not based on identity. Two value objects are equal when they have the same value, not necessarily being the same object. +## Class diagram ![alt text](./etc/value-object.png "Value Object") ## Applicability diff --git a/visitor/README.md b/visitor/README.md index bda789a18..f7a1dc17a 100644 --- a/visitor/README.md +++ b/visitor/README.md @@ -15,6 +15,7 @@ Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. +## Class diagram ![alt text](./etc/visitor_1.png "Visitor") ## Applicability