The governing principles of SOLID programming
The principles that govern SOLID programming are as follows:
- S: Single-responsibility principle
- O: Open-closed principle
- L: Liskov substitution principle
- I: Interface segregation principle
- D: Dependency inversion principle
Note
These principles are widely used in general-purpose programming. This means that if you’re using a general-purpose programming language such as C# or Java to create your HMIs or other automation software, you can use these principles to keep that codebase clean as well!
As a PLC developer, you will use some of these principles more than others. For me personally, the principle that I use the most is the single-responsibility principle (SRP). This principle can be applied to almost any code module, such as a function, interface, struct, function block, or anything else.
The single-responsibility principle
The SRP is, in my opinion, the...