Please take note - Software engineering principles. | INFJ Forum

Please take note - Software engineering principles.

DimensionX

Donor
Jan 31, 2010
1,235
298
642
MBTI
INFJ
Enneagram
-
Introduction
Having had a day spent mainly digging through a code file that has over 10k lines of code in it, really regretting some of the choices I've made that led up to that point, I found myself wishing that the following design principles were taught in school so here for your edification:

OO Design principles

- Encapsulate what varies.
- Favour composition over inheritance.
- Program to an interface not an implementation.
- Strive for loosely coupled designs between objects that interact.
- Classes should be open for extension but closed for modification.
- Depend on abstractions. Do not depend on concrete classes.
- Every responsibility of a class is an area of potential change, more than one responsibility means that there's more than one area of change. with that in mind keep each class to a single responsibility.
- Low level components should never be able to call a high level component directly, low level components should be able to participate in the processing. High level components should determine when and how low level components are needed.
- Utilize the principle of least knowledge a single class shouldn't be talking to many others otherwise it will create a very fragile system.
 
Last edited: