Cover image for Strategy in PHP [Design pattern with examples]

Strategy in PHP [Design pattern with examples]

anastasionico profile image anastasionico Updated on ・1 min read

I have been coding (seriously) for almost 10 years now,
Like everyone, as soon as I started to make my first little projects work I thought I was already amazing.

What a natural talent!

Only a while later I realized that the career of a web developer is composite by several milestones.

From your first "Hello World" to learning a framework and getting your head around the MVC principles.

Reaching these milestones let you say: "Today I have improved my skills".

One of these milestones that defined a programmer as a better programmer than before was when he finally understand the concept of composition.

you see,
In Object-oriented Programming 101, you learn the advantages of inheritance.
but what they do not tell you is that this practice is not very scalable and there is a better way to write your code.

It is incredibly crucial to develop a project and be confident that you WON'T CRY when you need to update it a few months from now.

for this reason:
In this week's article, you are going to discover why Composition is so important and how to use it while implementing the Strategy design pattern.


Posted on by:

anastasionico profile



An Italian coder and design enthusiast. I publish content on my blog that helps web developers improve their skills


Editor guide

Work in progress?


Just realized I've uploaded the with missing part, thanks for letting me be aware of it