Back to basics: SOLID – Single Responsiblity Principle (SRP)

Published on

Sep 8, 2016

SOLID: Single Responsibility Principle (SRP)

Did you say "solid"?

You may have heard of SOLID, or at least “programming principles” in your dev live. If not, this is a great occasion to get in touch with very interesting theory about Oriented Object Programming! SOLID is an acronym representing a list of programming principles that are good to follow to have a flexible, extensible and structured code, like a list of good practices.

Good practices

These should stand as basics and practices, not laws. By the way, any theoretical principle should be respected until proven insufficient (but don't worry, this does not happen often). In many cases, all the SOLID principles can be respected, if you have any doubt, you can refer to some of the famous open-source projects like Symfony, or Drupal.

"S" for SRP

The first letter "S" stands for Single Responsibility Principle, it sort of explains how a module (or a Class, in OOP) should have one and a single reason to change, meaning it must have only one single role. View the whole SRP presentation here: SOLID: Single Responsibility Principle

All the SOLID articles on KNPLabs:

Written by

KNP Labs
KNP Labs

Comments