Example implementations of SOLID Principles and common Design Patterns
- There should never be more than one reason for a class to change.
- Focused, single functionality
- Addresses a specific concern
- Entities (Classes, Modules, Methods, ets.) should be open for extension, but closed for modification
- Open for Extension: Extend existing behavior and
- Closed for Modification: Existing code remains unchanged
- Should be able to substitute base class objects with child class objects and this should not alter behavior or characteristics of the program
- Clients should not be forced to depend on interfaces that they do not use
- Signs ofInterface Pollution:
- Large Interfaces
- Classes have empty method implementations
- Method implementations throw UnsupportedOperationException (or similar)
- implementations return null or default/dummy values
- High level modules should not depend on low level modules
- Both should depend on abstraction
- Abstraction should not depend on details
- Details should depend on abstraction
- Deal with the process of creating objects of classes
- Deal with how classes and objects are arranged or composed
- Describe how classes and objects interact and communicate with each other