✍️
Notes.md
  • Table of contents
  • React.Js
    • React Hooks
    • Old :- React : Using Classes
  • Blockchain
    • Solidity
    • Custom ERC20 token
    • Contract
  • Tools and Tech
    • Docker
    • Git version Control
  • Java
    • Data & Data Types
    • IO in Java
    • Data Structures
      • Array in Java
      • Collections in Java
      • Map in Java
      • Enums in Java
      • Linked List in Java
      • List in Java
      • Queues & Stacks
      • Set in Java
      • TreeSet and TreeMap
    • Object Oriented Programming
      • Object Class Methods and Constructor
      • Immutable Class & Objects
      • Constructors
      • Visibility
      • Generics
    • Threads in Java
    • Useful Stuff Java
      • Lambda & Stream
    • Keywords in Java
      • Annotations
      • Comparators
      • Packages in Java
    • Miscellaneous
    • Articles to refer to
  • Golang
    • Competitive Programming in Go
    • Testing simple web server
    • Learning Go : Part 1
    • Maps vs slices
    • Golang Garbage Collector 101
    • Things Golang do differently
    • Go Things
  • Linux
    • Shell programming
    • Linux Commands Part 1 - 4
    • Linux Commands Part 5 - 8
    • Linux Commands Part 9 - 10
  • Software Design
    • Solid Design
    • OOPS
    • Design Patterns
      • Creational Design Pattern
        • Builder DP
        • Factory DP
        • Singleton DP
      • Adapter DP
      • Bridge DP
      • Iterator DP
      • State DP
      • Strategy DP
      • Behavioral Design Pattern
        • Observer DP
      • Structural Design Pattern
        • Facade DP
  • Cloud
    • Google Cloud Platform
      • GCP Core Infrastructure
      • Cloud Networking
  • Spring Boot
    • Spring Basics
      • Spring Beans
      • Important Annotations
      • Important Spring Things
      • Maven Things
      • Spring A.O.P
    • Spring Boot Controller
      • Response Entity Exception Handling
    • Spring Things
    • Spring MVC
    • Spring Data
      • Redis
      • Spring Data JPA
      • JDBC
    • Apache Camel
  • Miscellaneous
    • Troubleshooting and Debugging
Powered by GitBook
On this page

Was this helpful?

  1. Software Design

Solid Design

not liquid

  • s: Single Responsibility Principle

    • Each class should have only one sole purpose, and not be filled with excessive functionality

    • ex : loan class, there can be multiple loans, car, personal, home.

    • ex : send otp class, there can be multiple ways to send otp, email, sms, whatsapp.

  • o: Open & Close Principle

    • Classes should be open for extension, closed for modification.

    • In other words, you should not have to rewrite an existing class for implementing new features.

    • ex: using interfaces, can can implement create new class to implement new features.

  • l: Leskov's Subsititution Principle

    • This means that every subclass or derived class should be substitutable for their base or parent class.

    • ex: we have 3 social media: facebook, instagram & whatsapp

      • whatsapp doesnt support features like publish posts

      • there is no calling on instagram

    • we create interface that contain common functionality, have our classes extend from them

    • for specific features, we create new interfaces for them

  • i: Interfae Segragation Principle

    • Interfaces should not force classes to implement what they can’t do.

    • Large interfaces should be divided into small ones.

  • d: Dependency Inversion Principle

    • The principle states that we must use abstraction (abstract classes and interfaces) instead of concrete implementation.

    • High level modules should not depend on the low level module but both should depend on the abstraction.

    • ex: when perform payment, it doesnt matter whether you visa or mastercard, debit or credit card, payment provider will take it.

    • instead of taking input a specific class, take a interface which can be implemented by classes

PreviousSoftware DesignNextOOPS

Last updated 2 years ago

Was this helpful?

For examples with code :

https://medium.com/@javatechie/solid-design-principle-java-ae96a48db97