layout: pattern title: Subclass Sandbox folder: subclass-sandbox permalink: /patterns/subclass-sandbox/ categories: Behavioral tags: – Game programming 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 […]


layout: pattern title: Template method folder: template-method permalink: /patterns/template-method/ categories: Behavioral tags: – Gang of Four Intent Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure. To make sure that subclasses don’t override the template […]


layout: pattern title: Thread Pool folder: thread-pool permalink: /patterns/thread-pool/ categories: Concurrency tags: – Performance Intent It is often the case that tasks to be executed are short-lived and the number of tasks is large. Creating a new thread for each task would make the system spend more time creating and destroying the threads than executing […]


layout: pattern title: Step Builder folder: step-builder permalink: /patterns/step-builder/ categories: Creational tags: – Instantiation Intent 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 […]


layout: pattern title: Strategy folder: strategy permalink: /patterns/strategy/ categories: Behavioral tags: – Gang of Four Also known as Policy Intent 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 Applicability Use the Strategy pattern when Many related classes differ […]


layout: pattern title: Specification folder: specification permalink: /patterns/specification/ categories: Behavioral tags: – Data access Also known as Filter, Criteria Intent Specification pattern separates the statement of how to match a 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 […]


layout: pattern title: State folder: state permalink: /patterns/state/ categories: Behavioral tags: – Gang of Four Also known as Objects for States Intent Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. Class diagram Applicability Use the State pattern in either of the following cases […]


layout: pattern title: Sharding folder: sharding permalink: /patterns/sharding/ categories: Behavioral tags: Performance – Cloud distributed Intent 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 […]


layout: pattern title: Singleton folder: singleton permalink: /patterns/singleton/ categories: Creational tags: – Gang of Four Intent Ensure a class only has one instance, and provide a global point of access to it. Explanation Real world example There can only be one ivory tower where the wizards study their magic. The same enchanted ivory tower is […]


layout: pattern title: Spatial Partition folder: spatial-partition permalink: /patterns/spatial-partition/ categories: Behavioral tags: Performance – Game programming Intent As explained in the book Game Programming Patterns by Bob Nystrom, spatial partition pattern helps to efficiently locate objects by storing them in a data structure organized by their positions. Explanation Say, you are building a war game […]