Tag: object orientated programming

Dependency Inversion Principle

The Dependency Inversion Principle is a component of The SOLID Principles. These principles set out simple rules to follow that allow us to create maintainable and easily extensible codebases. The dependency inversion principle states that any entity should depend on abstractions rather than concrete implementations. This basically means that when…

Continue Reading Dependency Inversion Principle

Interface Segregation Principle

The Interface Segregation Principle is a component of The SOLID Principles. The SOLID principles are useful tips and rules to follow when writing software and code to create a maintainable and easily extensible codebase. The interface segregation principle states that any object or class should not be forced to override…

Continue Reading Interface Segregation Principle

Liskov Substitution Principle

The Liskov Substitution Principle is a component of The SOLID Principles which helps you create maintainable and extensible code. This principle states that any class should be able to be substituted for any of its subclasses without any issues. This basically just means that if you have a parent class…

Continue Reading Liskov Substitution Principle

Open-Closed Principle

The Open-Closed Principle is a component of The SOLID Principles. These principles can help you write software that is easy to extend and maintain whilst also avoiding code smells and bad design in your codebase. The open-closed principle states that any object should be open for extension but closed for…

Continue Reading Open-Closed Principle

Single Responsibility Principle (SRP)

The Single Responsibility Principle (SRP) is one of the aspects of The SOLID Principles. It states that every class or object should have one purpose, one responsibility and effectively one reason for existence. This principle is concerned mainly with object-orientated programming but it can and should be thought about at…

Continue Reading Single Responsibility Principle (SRP)

The SOLID Principles

The SOLID principles are a set of 5 rules to follow for Object-Orientated Programming (OOP). These rules or principles can be used to create software that is easy to extend and maintain while avoiding code smells and allowing simple refactoring. Obviously, these 5 principles are not a silver bullet and…

Continue Reading The SOLID Principles

Interfaces and Abstract Classes

Interfaces and abstract classes are used within object orientated programming to extend other classes and add additional functionality without rewriting or duplicating code. The difference between interfaces and abstract classes when compared to creating a normal base class is that you cannot instantiate an interface or abstract class. If you…

Continue Reading Interfaces and Abstract Classes

Inheritance and Polymorphism

Inheritance is way to base one class on another class, like a template built from an existing template. You could create a class called ‘Dog’ that acts as a template for all Dog objects. We could then create another class called ‘Animal’ that is a parent class of our ‘Dog’…

Continue Reading Inheritance and Polymorphism

Classes and Objects

A class is a template used to create objects within code. Classes are the foundational elements of Object Orientated Programming (OOP). Imagine like a blueprint for a house, the blueprint isn’t a house but is used to create a house object. When you create an object from a class it…

Continue Reading Classes and Objects