SOLID Principles

Single Responsibility Principle A class should have only one single reason to change which means it should only do one thing. Open Closed Principle A class should be open for extension but closed for modification. You should add new functionality to existing classes by extending them. We should refrain from modifying existing classes. Liskov Substitution […]

MVC Architecture (Model-View-Controller)

MVC is an architectural design pattern that is used to develop applications. It states that the application should be logically divided into 3 components namely: model, view, and controller. Model The model layer is responsible for handling data. It is connected to the data source and helps in performing data-related operations View The view layer […]

Strategy Pattern

The Strategy Pattern defines family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Suppose you are working on a payment gateway Suppose your app requires a payment gateway like PayTm Now in order to make code more easily updatable we can create a […]

Singleton Pattern

The Singleton Pattern ensures a class has only one instance and provides a global point of access to it. To achieve it we have to do the following Make constructor private Create a public method to get an instance the method will check if the instance is already created then return the same instance or […]

Case types in Programming

Programming case types While programming or even in real world naming things is one of the most complex task you can have. Its quite exhauting. Also, if you wan to be a better developer then naming your variables, classes or methods plays a very important role for the future changes and debugging you have to […]