Strategy Pattern

This post will be all about the Strategy Pattern.

The intent is says that

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

Again, like all computer science definitions this sounds confusion. So let’s break it down in pieces (literally).

Continue reading Strategy Pattern

Adapter Pattern

This post is about the Adapter Pattern. Like the Decorator Pattern this one is also a Structural pattern.

What this patterns does is it allows the client to use different types of classes throughcommon adapter. These classes are called adaptee and they don’t have to change in any way to conform to our client.

Instead, an adapter is created to, well, adapt (no pun intended) to our client objectives.

Continue reading Adapter Pattern

Interface Segregation Principle

The I in SOLID is for Interface Segregation Principle (ISP).

This is the fourth principle, and it’s a very easy one to understand, it’s all about decoupling your classes and extensions. The intent is that:

Clients should not be forced to depend upon interfaces that they don’t use.

Continue reading Interface Segregation Principle