Prinsip-Prinsip OOP Design

7:29 PTG 0 Comments A+ a-

 The Best Pactices for OOD:


Command Query Separation Every method should either be a command that performs an action, or a query that returns data to the caller, but not both.
Hollywood Principal Don't call us, we'll call you
DRY Don't Repeat Yourself
SRP A class should have only one reason to change
Program to an Interface not an Implementation Do not mix relationships to classes, instead mix them to interfaces.
OCP Open/Closed Principal. Classes should be open for extension but not modification
DIP Dependency Inversion Principle: Depend on abstractions rather than concrete classes
YAGNI You Aint Gonna Need It Later. Always implement things when you actually need them.
COC Convention over configuration. Decrease the number of decisions that developers need to make, gaining simplicity without losing flexibility.
Encapsulation Hiding information that could potentially be overwritten
Encapsulate what Varies Separate what varies from what remains the same.
KISS Keep It Super Simple
Loose Coupling The Dependency to which each module relies on each one of the other modules.
Interchangeability The ability to replace an object by another object without affecting code using the it.
Favor Composition over Inheritance Classes become polymorphic and code is reusable by including other classes which implement the desired functionality instead of through inheritance.
Fragile Base Class Seemingly safe modifications to a base class, when inherited by the derived classes, may cause the derived classes to malfunction.
Common Closure Principal Classes that change together must be placed in the same packag