Double Buffer
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.
Extension objects
Intent Anticipate that an object’s interface needs to be extended in the future. Additional interfaces are defined by extension objects. Class diagram Applicability Use the Extension Objects pattern when: you need to support the addition of new or unforeseen interfaces to existing classes and you don’t want to impact clients that don’t need this new interface. Extension Objects lets you keep related operations together by defining them in a separate class a class representing a key abstraction plays different roles for different clients.
Feature Toggle
Also known as Feature Flag Intent Used to switch code execution paths based on properties or groupings. Allowing new features to be released, tested and rolled out. Allowing switching back to the older feature quickly if needed. It should be noted that this pattern, 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.
Game Loop
Intent A game loop runs continuously during gameplay. Each turn of the loop, it processes user input without blocking, updates the game state, and renders the game. It tracks the passage of time to control the rate of gameplay. This pattern decouples progression of game time from user input and processor speed. Applicability This pattern is used in every game engine. Explanation Real world example Game loop is the main process of all the game rendering threads.
Identity Map
Intent Ensures that each object gets loaded only once by keeping every loaded object in a map. Looks up objects using the map when referring to them. Explanation Real world example We are writing a program which the user may use to find the records of a given person in a database. In plain words Construct an Identity map which stores the records of recently searched for items in the database.
Intercepting Filter
Intent Provide pluggable filters to conduct necessary pre-processing and post-processing to requests from a client to a target Class diagram Applicability Use the Intercepting Filter pattern when a system uses pre-processing or post-processing requests a system should do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers you want a modular approach to configuring pre-processing and post-processing schemes Tutorials Introduction to Intercepting Filter Pattern in Java Real world examples javax.
Intent Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. Explanation Real-world example The halfling kids are learning basic math at school. They start from the very basics “1 + 1”, “4 - 2”, “5 + 5”, and so forth. In plain words Interpreter pattern interprets sentences in the desired language. Wikipedia says In computer programming, the interpreter pattern is a design pattern that specifies how to evaluate sentences in a language.
Also known as Cursor Intent Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. Explanation Real-world example Treasure chest contains a set of magical items. There multiple types of items such as rings, potions, and weapons. The items can be browsed by type using an iterator the treasure chest provides. In plain words Containers can provide a representation agnostic iterator interface to provide access to the elements.
Leader Election
Intent Leader Election pattern is commonly used in cloud system design. It can help to ensure that task instances select 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 Applicability Use this pattern when the tasks in a distributed application, such as a cloud-hosted solution, require careful coordination and there is no natural leader.