The 5 SOLID principles with examples [in PHP]

Nico Anastasio
2 min readOct 22, 2019

Last week one of the account managers in the company I work for asked me to edit a little feature we have on one of the websites we manage,

Turn out I spent almost a week on that task.

If that happened to you, this is the time to change!

This website is very old and it is not actively managed, it was developed a long time ago then passed from developer to developer.

I must say, I work on it only once or twice a year.

The task itself was really easy and should have been a quick fix…

The reality?

It took 2 days only to understand what I was looking at.

Why do we like messes?

I realized that this is a common problem while deciding to refactor some code.

I really did not enjoy spending my time there, taking note of which interface was doing what, where a class was invoked and why there were methods 200 lines long.

As web developers, we are creators we want to see stuff on a web page that was blank only a few minutes before.

We must do in conscientiously though!

The way to write good code

Software engineers have been there for years and some of them have developed theories and principles that have been proved right times and times again.

One of the most famous and engineer that has done it is Robert Martin,
he has created a set of 5 principles that, if followed, will make every program scalable and most important incredibly easy to read.

That is called S.O.L.I.D.

What can you do?

It’s time to stop wasting days try to understand code written ages ago.

You can do it, and it only requires to follow 5 principles.

Read the full article here

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Nico Anastasio
Nico Anastasio

Written by Nico Anastasio

Experienced programmer empowering developers to write flawless code. Explore my blog: anastasionico.uk/blog. Need captivating articles? nico@anastasionico.uk.

No responses yet

Write a response