Skip to content

Clean Code, Uncle Bob

Source: https://www.youtube.com/watch?v=7EmboKQH8lM

  • My Job as a programmer is not to write code that works, it's just the first and least important part of the work, the most important part is to write clean code that others could understand which will allow them (including me after a while) to maintain, fix, modify ...
  • I have to be polie: I have to write functions such that the reader can exit at any level he want when he feels he got what they wanted just like a newspaper article where there a header, an abstract then the details are brought up "haba haba" from top to bottom
  • A function does one thing when we can't extract another function from it.

Quotes

  • "The only measuremenent of how well the code is written is WTFs/minute" ~ Some guy
  • "Clean code could be read as well written prose" ~ Some guy

Soft rules

  • Respect the level of abstractions between lines of code, don't travel too many levels
  • No more than 20 lines of code for a function
  • No more than 3 parameters for a function, write objects, use other strategies instead if you want more
  • Do not pass booleans to functions
  • Avoid using switch statements, us polymorphisme instead

Stopped at: https://youtu.be/7EmboKQH8lM?t=4838