OOP Design Patterns — Introduction

Dinesha Karunathilake
1 min readApr 22, 2021

Change is the inevitable character of anything and software is no exception. The job of a good engineer is to design the systems in a way to cope up with the change and for it to be maintainable. We have enough examples of codebases becoming unmaintainable after a few years they were written when the original developers have forgotten how the code was written or left the company. This emphasizes the importance of giving the importance of the design phase and making the right decisions at the design phase.

Basics of ObjectOriented Programming are not new to any of us: Abstraction, Inheritance, Polymorphism, Encapsulation. This will make us think at the object level, not pattern level. With time previous developers have found ways in which they have solved the common issues in code maintainability. They are the Design Patterns and they mostly based on the following principles.

  • Encapsulate what varies
  • Favor composition over inheritances
  • Program to interfaces not implementations
  • Always strive for loosely coupled designs between objects that interact

and on the SOLID design principles

  • Single Responsibility Principle
  • Open/Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

Learning Design Patterns and knowing them will get us one step ahead, making us think in pattern level.

--

--