SOLID (object-oriented design)SOLID is a mnemonic acronym for a group of five good principles (rules) in computer programming. SOLID allows programmers to write code that is easier to understand and change later on. SOLID is often used with systems that use an object-oriented design. [source?] SOLID was promoted by Robert C. Martin but the name itself was created by Michael Feathers. [1][better source needed] In essence, SOLID principles guide developers towards creating code that is more maintainable, flexible, and reusable. By adhering to these principles, one can build software systems that are easier to understand, modify, and extend over time. [source?] SOLID PrinciplesSingle responsibility principle (SRP)Class has one job to do. Each change in requirements can be done by changing just one class.[source?] Importance
Open/closed principle (OCP)Class is happy (open) to be used by others. Class is not happy (closed) to be changed by others.[source?] Importance
Liskov substitution principle (LSP)Class can be replaced by any of its children. Children classes inherit parent's behaviours.[source?] Importance
Interface segregation principle (ISP)When classes promise each other something, they should separate these promises (interfaces) into many small promises, so it's easier to understand.[source?] Importance
Dependency inversion principle (DIP)When classes talk to each other in a very specific way, they both depend on each other to never change. Instead classes should use promises (interfaces, parents), so classes can change as long as they keep the promise.[source?] Importance
Related pagesReferences
|
Portal di Ensiklopedia Dunia