2. The SOLID Design Principles
• Single Responsibility Principle
• Open / Close Principle
• Liskov Substitution Principle
• Interface Segregations Principle
• Dependency Inversion Principle
3. Single Responsibility
Principle
• The SRP states that each class or
similar unit of code should have one
responsibility only and, therefore, only
one reason to change.
4. Open / Close Principle
• The OCP states that all classes and
similar units of source code should be
open for extension but closed for
modification.
5. Liskov Substitution Principle
• The LSP specifies that functions that
use pointers of references to base
classes must be able to use objects of
derived classes without knowing it.
6. Interface Segregations
Principle
• The ISP specifies that clients should not
be forced to depend upon interfaces
that they do not use. Instead, those
interfaces should be minimised.
7. Dependency Inversion
Principle
• The DIP states that high level modules
should not depend upon low level
modules and that abstractions should
not depend upon details.
8. Lets Do Code…
• Your Manager ask you to create a cake.
CakeMaker.js
9. Lets Do Code…
• You wrote a code. Test it. All works
fine.
• After one week Manager comes again
and ask functional expansions for your
code.
• Here add more functionalities without
changing existing code
12. Lets Do Code…
• Here you instantiate javascript object
without polluting global space.
− Window.cakeMaker
• Then you add more functionalities to
the object
13. Summary
• Using javascript immediate functions
− Satisfy SOLID principles
− Gain high maintainable code
− Gain high reusability code