Automatically remove your image background. Try it now!
What is a design principle?
A basic tool or technique that when applied to designing or writing code makes that code more flexible, maintainable or extensible
What does SOLID stand for
Single responsibility principle
Liskov substitution principle
Interface segregation principle
Dependency inversion principle
Define the single responsibility principle
The SRP states that every object should have a single responsibility and all of the object's methods are focussed on carrying out that responsibility
Define the open/closed principle
Classes should be open to extension and closed to modification
When should OCP be used?
When code makes decisions depending on type
Define the dependency inversion principle
1. High level modules should not depend on low level modules. Both should depend on abstractions.
1. Abstractions should not depend on details. Details should depend on abstractions.
Define the Liskov substitution principle
Subtypes must be substitutable for their based types
When to use delegation?
When you want to use another class's functionality, but don't want to change the functionality
Three techniques for reusing behaviour without inheritance
Define the interface segregation principle
No client should be forced to depend on methods that it does not use