- Modular Programming with PHP 7
- Branko Ajzele
- 235字
- 2021-07-14 10:06:00
Chapter 3. SOLID Design Principles
Building modular software requires strong knowledge of the class design. There are numerous guidelines out there, addressing the way we name our classes, number of variables they should have, what the size of methods should be, and so on. The PHP ecosystem managed to pack these into official PSR standard, more precisely PSR-1: Basic Coding Standard and PSR-2: Coding Style Guide. These are all general programming guidelines that keep our code readable, understandable, and maintainable.
Aside from programming guidelines, there are more specific design principles that we can apply during the class design. Ones that address the notions of low coupling, high cohesion, and strong encapsulation. We call them SOLID design principles, a term coined by Robert Cecil Martin in the early 2000s.
SOLID is an acronym for the following five principles:
- S: Single responsibility principle (SRP)
- O: Open/closed principle (OCP)
- L: Liskov substitution principle (LSP)
- I: Interface Segregation Principle (ISP)
- D: Dependency inversion principle (DIP)
Over a decade old, the idea of SOLID principles is far from obsolete, as they are at the heart of good class design. Throughout this chapter, we will look into each of these principles, getting to understand them by observing some of the obvious violations that break them.
In this chapter, we will be covering the following topics:
- Single responsibility principle
- Open/closed principle
- Liskov substitution principle
- Interface Segregation Principle
- Dependency inversion principle
- Implementing Modern DevOps
- Game Programming Using Qt Beginner's Guide
- PostgreSQL 11從入門到精通(視頻教學版)
- Spring+Spring MVC+MyBatis整合開發實戰
- Java EE 8 Application Development
- PHP 7從零基礎到項目實戰
- 青少年學Python(第2冊)
- Java 11 and 12:New Features
- Learning Redux
- Neo4j權威指南 (圖數據庫技術叢書)
- LabVIEW案例實戰
- F# for Machine Learning Essentials
- NLTK Essentials
- 零基礎學Java項目開發
- C編程從入門到實踐