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: 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 […]


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: 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: Service Locator folder: service-locator permalink: /patterns/service-locator/ categories: Architectural tags: Game programming – Performance Intent Encapsulate the processes involved in obtaining a service with a strong abstraction layer. Class diagram Applicability The service locator pattern is applicable whenever we want to locate/fetch various services using JNDI which, typically, is a redundant and expensive […]


layout: pattern title: Service Layer folder: service-layer permalink: /patterns/service-layer/ categories: Architectural tags: – Data access Intent Service Layer is an abstraction over domain logic. Typically applications require multiple kinds of interfaces to the data they store and logic they implement: data loaders, user interfaces, integration gateways, and others. Despite their different purposes, these interfaces often […]


layout: pattern title: Serverless folder: serverless permalink: /patterns/serverless/ categories: Architectural tags: – Cloud distributed Serverless Serverless eliminates the need to plan for infrastructure and let’s you focus on your application. Following are optimization katas you should be aware of while building a serverless applications The Lean function Concise logic – Use functions to transform, not […]


layout: pattern title: Servant folder: servant permalink: /patterns/servant/ categories: Behavioral tags: – Decoupling Intent 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 […]


layout: pattern title: Semaphore folder: semaphore permalink: /patterns/semaphore/ categories: Concurrency tags: – Performance Also known as Counting Semaphore Intent Create a lock which mediates access to a pool of resources. Only a limited number of threads, specified at the creation of the semaphore, can access the resources at any given time. A semaphore which only […]


layout: pattern title: Saga folder: saga permalink: /patterns/saga/ categories: Concurrency tags: – Cloud distributed Also known as This pattern has a similar goal with two-phase commit (XA transaction) Intent This pattern is used in distributed services to perform a group of operations atomically. This is an analog of transaction in a database but in terms […]