Home » Beitrag verschlagwortet mit 'Java Design'
Schlagwort-Archive: Java Design
Java Design Principles
See additionally: Java Design Patterns
SOLID Principles
Principle | Meaning |
---|---|
Single Responsablility | Class shall do only one thing, have only one reason to change. |
Open – Close | Classes/Objects shall be: Open for extension (sub classing). Closed for modification. |
Liskov Substitution | A subclass must be applicable without problems in any place where its super class or interface is applicable. |
Interface Segregation | Better several small interfaces with dedicated functions than fewer interfaces with a mix of functions. |
Dependency Injection | High level modules shall not depend on low level module. Better both modules depend on an interface. |
Other Principles
Principle | Meaning |
---|---|
Don’t repeat yourself | dito |
Encapsulate what changes | dito |
Favor composition over inheritance | If classes in the real world has different natures then don’t solve this by putting that natures into the same class. Rather create separate classes to implement those natures. |
Program against interfaces on implementations | dito |