27 Apr 2007, 09:29

Essence of Software Design (Java)

Share

Ich habe mir vor einiger Zeit einige wichtige Design-Prinzipien für das Software Design, insb. in Java, zusammengefasst und einige oft gebrauchte Design-Patterns und Entwurfsrichlinien erläutert.

Zu finden ist das ganze unter The Essence of Software Design.

Die wichtigsten Prinzipien:

  • Open-Closed-Principle (OCP) - A class should be open for extension but closed for modification.
  • Liskov Substitution Principle (LSP) - An instance of a class should function as an instance of its superclass.
    Typical violations of LSP:
    • Derivates that override a method of the super-class by an empty method potentially violate LSP
    • Derivates that throw additional exceptions violate LSP

  • Dependency Inversion Principle (DIP) - High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. DO NOT DEPEND ON A CONCRETE CLASS. All relationsships in a program should terminate on an abstract class or an interface.