Distributed Transaction Management with REST and Try Confirm/Cancel Pattern

Apr 03, 2019

This article introduces how to manage transactions effectively in distributed REST services with Try Confirm/Cancel (TCC) pattern. It also provides a repository that is a simplified Java implementation for anyone who is interested in learning the TCC... Read more

Wrap A Command with Builder Pattern

Dec 19, 2018

This article shows a well-designed way to wrap a command and expose it through API with the classic Builder pattern. In this tutorial, you will learn how to write the Builder pattern, and how to direct standard output stream and standard error stream... Read more

Building an Efficient Cache

Sep 26, 2018

To build a cache could be as simple as to just to use a key-value pair kind data structure. It works sufficient most of the time in a single-threaded application. However, when there are many clients access the same cache while the computation being ... Read more

Behavioral Patterns - Visitor Pattern Exercise

Jul 17, 2018

The Visitor Pattern represents an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. In this exercise, we will create a bookstore in... Read more

Behavioral Patterns - Template Method Pattern Exercise

Jul 11, 2018

The Template Method Pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure. In this exercise, we ... Read more

Behavioral Patterns - Strategy Pattern Exercise

Jul 03, 2018

The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. In this exercise, we will use the Strategy Pattern to create a simpli... Read more

Behavioral Patterns - State Pattern Exercise

Jun 26, 2018

The State Pattern allows an object to alter its behavior when its internal state changes. It tremendously reduces the complexity when introducing more states later to the object. In this exercise, we will use the State Pattern to create a modern vend... Read more

Behavioral Patterns - Observer Pattern Exercise

Jun 20, 2018

The Observer Pattern is widely used to solve one-to-many object state changes notification problems. The pub/sub model uses the Observer Pattern as the base pattern. It is also used in the event-driven systems. In this exercise, we will create a naiv... Read more

Behavioral Patterns - Memento Pattern Exercise

Jun 20, 2018

The Memento Pattern is used to record the internal state of an object. It is used to create a state machine and also makes undo or redo operation very easy with this pattern. In this exercise, we will use a scenario of account and account manager to ... Read more

Behavioral Patterns - Mediator Pattern Exercise

May 18, 2018

The Mediator Pattern defines an object that encapsulates how a set of objects interact. In this exercise, we will create a mediator that helps us handle the cross-cutting business logic in the Command Pattern Exercise.... Read more