6 of 59 menu

SOLID principles

Objective principles‑oriented programming SOLID are necessary when creating functional, long-term supported software based on object‑oriented programming (OOP).

The main principles of SOLID:

  • Single responsibility principle - each object has only one responsibility (goal), which in turn should be represented by a separate class. For example, retrieving data from a database and its subsequent validation should have different classes so that these two processes do not mix with each other.
  • Open-closed principle - classes should be open to change and add new tasks, and at the same time closed to changes in the core code. Therefore, other modules and functions can be added to the class, but the source code should remain unchanged.
  • Liskov substitution principle - all created descendants must preserve and exhibit the behavior (tasks performed) of their parent.
  • Interface segregation principle - large interfaces need to be divided into smaller, more focused ones, so as not to overload users with unnecessary information.
  • Dependency inversion principle - high-level objects, such as classes, should not depend on lower-level modules, but they should all depend on abstractions.

See also

  • principle DRY,
    which is the division of software into small components
  • principle KISS,
    which involves abandoning the complication of software
  • principle YAGNI,
    which involves the rejection of redundant software functionality
  • principle CQS,
    which specifies only one command for each function
  • principle LoD,
    which is used in software development
  • responsibility separation principle,
    which is used in software development
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline