Liskov Substitution Principle

liskov substitution

We’re moving forward with our study of the SOLID design principles, and now we have made it to the L. The L stands for Liskov Substitution Principle or LSP and is named after the creator of the principle, Barbara Liskov. The formal definition is very verbose, so in this tutorial, we will cover the topic as if we are writing the first draft for the book, “The Liskov Substitution Principle For Dummies.” Let’s learn a bit more about this principle now.…

Open Closed Principle

open closed principle

The Open Closed Principle is another concept in our study of the solid design approaches in the object oriented style. You may have heard the idea that code should be open for extension but closed for modification. Ok. Really what this means is that when writing code, we should aim for the ability to change behavior without having to actually change the code. Another way of saying this is to program in a way so that the code does not need to be changed each time the requirements of the project change.…

Single Responsibility Principle

single responsibility principle

The Single Responsibility Principle focuses on the concept of keeping a function, method, or class, focused on a narrow behavior that it does well. When we think about a given API, we can say it is a good API if it does one thing and never changes. Now when we say API, we really are referring to any function, method, or class however all of this holds true for the more traditional thinking of what an application programming interface is.…

Interface Examples For Object Oriented PHP

Interface Examples For Object Oriented PHP

In this tutorial, we’ll take a look at Interface Examples while programming in Object Oriented PHP. Interfaces are one of the main building blocks of the SOLID pattern. When I first saw the word SOLID, as in someone referring to SOLID programming, I thought they meant it was solid, as in cool or legitimate. :-) LOL. Or course in reality, SOLID is the idea of the group of design patterns, conventions, and philosophies made popular by Uncle Bob Martin.…

Autoloading For Code Organization

composer autoload

Autoloading helps us to organize our code in a clean fashion. This makes it easier to understand how all of the pieces fit together. In fact, I would go as far as to say that code organization is half the battle. With the introduction of Composer to the PHP community, we now have a way to handle code organization like never before. As we know, Composer is The Dependency Manager for PHP.…