SOLID is a mnemonic for five design principles intended to make your code more flexible, maintainable, and reusable.

Single Responsibility Principle:

A class should be responsible for a single functionality of your code. Therefore a Class should have only one reason to change.

Example:

Single Responsibility

Without applying the SRP, we risk breaking the working code while modifying other functions that don’t belong in the Document class.

Open/Closed Principle:

A class should open for extension but closed for modification. We should always aim to write a Class in which we can extend its behavior on-demand and not modify its code repetitively.

Example:

WAEL KASSEM

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store