SOLID (object-oriented design)
mnemonic acronym for 5 principles of object-oriented design: Single responsibility principle; open/closed principle; Liskov substitution principle; Interface segregation; Dependency inversion principle
SOLID is an 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.
SOLID was promoted by Robert C. Martin but the name itself was created by Michael Feathers.[1]
SOLID Principles
- Single responsibility principle - Class has one job to do. Each change in requirements can be done by changing just one class.
- Open/closed principle - Class is happy (open) to be used by others. Class is not happy (closed) to be changed by others.
- Liskov substitution principle - Class can be replaced by any of its children. Children classes inherit parent's behaviours.
- Interface segregation principle - When classes promise each other something, they should separate these promises (interfaces) into many small promises, so it's easier to understand.
- Dependency inversion principle - 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.
References
🔥 Top keywords: Main PageSpecial:SearchXXXTentacionDespicable Me 4File:ASCII-Table-wide.svgHelp:IntroductionPeriodic tableWikipedia:AboutHelp:ContentsSpecial:RecentChangesProvinces and territories of CanadaJames Earl JonesSOLID (object-oriented design)List of people who have walked on the Moon24-hour clockList of U.S. states and territories by time zoneList of U.S. statesCristiano RonaldoHelp:Authority controlSupreme Court of the United StatesList of mathematical symbolsUnited StatesGrassBismillahir Rahmanir RaheemList of countries by continentsAdolf Hitler Uunona0Arab slave tradeProphets of IslamSlash (punctuation)List of fruitsList of colorsColourFile:Sexual intercourse with internal ejaculation.webmList of countriesJosef FritzlList of cities in MexicoLisa SparxxxNames of large numbers