Aggregate Pattern

Aggregate Pattern

Aggregates are a design pattern that play a big role in domain-driven development. In many systems, the relationships between entities can become so interwoven that attempting to eager-load an entity and all of its related entities from persistence results in … Continued
Entity

Entity

An Entity is an object that has some intrinsic identity, apart from the rest of its state. Even if its properties are the same as another instance of the same type, it remains distinct because of its unique identity. As … Continued
Null Object Pattern

Null Object Pattern

The Null Object Pattern was described in the Gang of Four’s Design Patterns book. The intent of this pattern is to reduce the need to add checks and special behavior for handling null instances of certain variables that tend to … Continued
Kinds of Models

Kinds of Models

In a Model-View-Controller (MVC) application, the Model is responsible for the application’s state and non-UI specific behavior. In simple applications, there may be just one kind of model class that is used by persistence, presentation, and any business logic. However, … Continued
Guard Clause

Guard Clause

Complexity in code makes it harder to understand what the code is doing. The smallest unit of our code tends to be the function or method. You should be able to look at a given function and quickly determine what … Continued
Design Patterns

Design Patterns

Design patterns are common approaches to solving similar problems. The 1995 book Design Patterns, by the so-called Gang of Four (GoF), describes 23 patterns. Pluralsight’s design patterns library includes 32 different patterns, including most of the original GoF patterns. Some design … Continued
Builder Design Pattern

Builder Design Pattern

The Builder design pattern is a creational pattern, similar to the Factory pattern (Factory Method, Abstract Factory). Unlike the Factory pattern, which typically only offers one method for creating an object, the Builder pattern offers multiple methods that can be … Continued
Repository Pattern

Repository Pattern

The Repository Pattern has gained quite a bit of popularity since it was first introduced as a part of Domain-Driven Design in 2004. Essentially, it provides an abstraction of data, so that your application can work with a simple abstraction … Continued
Adapter Design Pattern

Adapter Design Pattern

The Adapter Design Pattern, also known as the Wrapper, allows two classes to work together that otherwise would have incompatible interfaces.  In this case, this software design pattern maps particularly well to the real-world example of an electrical power adapter, … Continued
Strategy Design Pattern

Strategy Design Pattern

The Strategy Design Pattern allows an object to have some or all of its behavior defined in terms of another object which follows a particular interface.  A particular instance of this interface is provided to the client when it is … Continued