Clean Code

Code smells

  • Rigidity - The software is difficult to change - A small change causes a cascade of subsequent changes
  • Fragility - The software breaks in many places due to a single change
  • Immobility - You cannot reuse parts of the code in other projects because of involved risks and high effort
  • Opacity - The code is hard to understand
  • Needless Complexity
  • Needless Repetition

Style

  • Put the caller above the callee

Law of Demeter

  • Modules shouldn't know about the internals of the classes they use

Procedural vs. OOP

Procedural - a class ex. DBHandler that operates on a data structurel

  • This can be favorable for data structures that aren't meant to be modified

OOP - Is better for evolving data types