際際滷

際際滷Share a Scribd company logo
SOLID PRINCIPLES
Presented By : Gaurav Mishra
SOLID
SOLID are five basic principles which help to create good software
architecture. SOLID is an acronym where:-
 S stands for SRP (Single responsibility principle)
 O stands for OCP (Open closed principle)
 L stands for LSP (Liskov substitution principle)
 I stands for ISP ( Interface segregation principle)
 D stands for DIP ( Dependency inversion principle)
1 - Single responsibility principle
SRP says that a class should have only one responsibility and
not multiple.
Solid Principles
Solid Principles
2-Open closed principle
 Open/Closed principle says that a class should be open for
extension but closed for modification. Which means that
you can add new features through inheritance but should
not change the existing classes.
Solid Principles
Solid Principles
3-Liskov substitution principle
 " The Liskov Substitution Principle says that the object of a derived
class should be able to replace an object of the base class without
bringing any errors in the system or modifying the behavior of the
base class. "
 it means that we must make sure that new derived classes are
extending the base classes without changing their behavior.
 objects in a program should be replaceable with instances of their subtypes
without altering the correctness of that program.
Solid Principles
Solid Principles
Solid Principles
4-Interface segregation principle
 The Interface Segregation Principle states that clients should not be
forced to implement interfaces they don't use. Instead of one fat
interface many small interfaces are preferred based on groups of
methods, each one serving one submodule.
 No client should be forced to depend on methods it does not use.
 Many client-specific interfaces are better than one general-purpose interface.
 Show only those method/functionality to the client which they want rather than
showing all the functionality
Solid Principles
Solid Principles
5-Dependency inversion principle
 DIP states that how two modules should depend on each
other.
 A. High-level modules should not depend on low-level modules. Both should depend on
abstractions.
 B. Abstractions should not depend upon details. Details should depend upon
abstractions.
Solid Principles
Solid Principles
Solid Principles
Solid Principles
Solid Principles

More Related Content

Solid Principles

  • 2. SOLID SOLID are five basic principles which help to create good software architecture. SOLID is an acronym where:- S stands for SRP (Single responsibility principle) O stands for OCP (Open closed principle) L stands for LSP (Liskov substitution principle) I stands for ISP ( Interface segregation principle) D stands for DIP ( Dependency inversion principle)
  • 3. 1 - Single responsibility principle SRP says that a class should have only one responsibility and not multiple.
  • 6. 2-Open closed principle Open/Closed principle says that a class should be open for extension but closed for modification. Which means that you can add new features through inheritance but should not change the existing classes.
  • 9. 3-Liskov substitution principle " The Liskov Substitution Principle says that the object of a derived class should be able to replace an object of the base class without bringing any errors in the system or modifying the behavior of the base class. " it means that we must make sure that new derived classes are extending the base classes without changing their behavior. objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • 13. 4-Interface segregation principle The Interface Segregation Principle states that clients should not be forced to implement interfaces they don't use. Instead of one fat interface many small interfaces are preferred based on groups of methods, each one serving one submodule. No client should be forced to depend on methods it does not use. Many client-specific interfaces are better than one general-purpose interface. Show only those method/functionality to the client which they want rather than showing all the functionality
  • 16. 5-Dependency inversion principle DIP states that how two modules should depend on each other. A. High-level modules should not depend on low-level modules. Both should depend on abstractions. B. Abstractions should not depend upon details. Details should depend upon abstractions.