Skip to content

Instantly share code, notes, and snippets.

@rasheedamir
Last active August 29, 2015 14:11
Show Gist options
  • Save rasheedamir/e439d28935bba38b048a to your computer and use it in GitHub Desktop.
Save rasheedamir/e439d28935bba38b048a to your computer and use it in GitHub Desktop.
solid principles

Code rot | kōd rät |

When an application becomes a festering mass of code that the developers find increasingly hard to maintain.

Gross. So how can we identify future code rot? These signs probably indicate code rot to come

  • Rigidity – small changes causes the entire system to rebuild.
  • Fragility – changes to one module causes other unrelated modules to misbehave. Imagine a car system in which changing the radio station affects windows.
  • Immobility – a module’s internal components cannot be extracted and reused in new environments. For example, if an application’s login module cannot be used in entirely different system then this module is immobile, caused by couplings and dependencies between different modules. The strategy is to decouple central abstractions from low-level details, like a particular database schema or UI implementation (web, desktop) or specific frameworks.
  • Viscosity – when building and testing are difficult to perform and take a long time to execute. When even a simple change is costly to make, and requires you to make changes in multiple places/levels.

SOLID Principles

SRP

The Single Responsibility Principle (SRP) states that there should never be more than one reason for a class to change. This means that every class, or similar structure, in your code should have only one job to do.

OCP

The Open-Closed Principle (CCP)

LSP

The Liskov Substitution Principle (LSP)

ISP

The Interface Segregation Principle (ISP)

DIP

The Dependency Inversion Principle (DIP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment