Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SOLID Principles of Object Oriented Programming

Tarun Telang
September 22, 2022

SOLID Principles of Object Oriented Programming

SOLID principles make our code more understandable, maintainable, and extendable. They also help us avoid code smells.

Tarun Telang

September 22, 2022
Tweet

Other Decks in Programming

Transcript

  1. SOLID Principles of Object-Oriented Programming Tarun Telang

  2. Low-Level Design (LLD) SOLID Principles A low-level design is a

    design that is detailed enough to be translated into a working implementation of software.
  3. Clean Code * Clean code is code that is easy

    to read and understand. * It is well-written, organized, and consistent. * Clean code is also easy to maintain and extend. * It is also easily testable.
  4. Clean Code •Readable •Understandable •Maintainable •Extensible •Testable

  5. S: Single Responsibility O: Open / Closed L: Liskov Substitution

    I: Interface Segregation D: Dependency Inversion
  6. Single Responsibility Principle SRP is a design principle that states

    that a class should have one and only one responsibility. This responsibility can be divided into two parts: 1) the functionality of the class, and 2) the information that the class knows or owns.
  7. Benefits of SRP 1) Reduced complexity 2) Reduced coupling 3)

    Increased cohesion
  8. Open/Closed Principle Open/Closed principle states that a class should be

    open for extension but closed for modification.
  9. Liskov Substitution Principle (LSP) LSP states that a subtype should

    be able to substitute for its supertype.
  10. Interface segregation principle (ISP) (ISP) states that a client should

    NOT be forced to implement an interface it does not use. An interface should be divided into smaller interfaces, each defining a single responsibility.
  11. Dependency Inversion Principle (DIP) High-level modules should not depend on

    low-level modules. Both should depend on abstractions (e.g. interfaces).