Skip to content

Stupid or Solid?

AJ Williams edited this page Feb 20, 2020 · 1 revision

Singleton

Tight Coupling

Untestability

Premature Optimization

Indescriptive Naming

Duplication

These are the habits we formed the first time we learned to code. As far as I remember, every project used a singleton pattern, we tested by running our bug riddled code as a whole, with variables with names such as "potato" or simply "a". What even were loops or functions for the better part of the semester?

Single Responsibility

Open/Closed Principle

Liskov Substitution Principle

Interface Segregation Principle

Dependency Inversion Principle

Cohesion is the name of the game. It is better to have a class responsible for a small part of the program than to be a jack of all trades that lends itself to more problems. Changes to code should be additions, not modifications. This is helped by interfaces. Subclasses of a class should be substitutable for their parent. The interface should be as specific as possible. There should not be an one interface does all situation going on. And keep the dependency of high level code low.

Source: William Durand