Home » Beitrag verschlagwortet mit 'Java Design'

Schlagwort-Archive: Java Design

Java Design Principles

See additionally: Java Design Patterns

SOLID Principles

PrincipleMeaning
Single ResponsablilityClass shall do only one thing, have only one reason to change.
Open – CloseClasses/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 SegregationBetter several small interfaces with dedicated functions than fewer interfaces with a mix of functions.
Dependency InjectionHigh level modules shall not depend on low level module.
Better both modules depend on an interface.
SOLID Principles

Other Principles

PrincipleMeaning
Don’t repeat yourselfdito
Encapsulate what changesdito
Favor composition over inheritanceIf 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 implementationsdito