Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Clean Code 101

Clean Code 101

Writing code that is readable by humans is what we should all want, after all, the machine is not interested in what we write, it is important for the people with who we are in the team or the person who will continue the project after us. Talk is about the basics of Clean Coda and the rules that we should adhere to.

Marko Kunic

March 10, 2018
Tweet

More Decks by Marko Kunic

Other Decks in Programming

Transcript

  1. @kunicmarko20 - No abbreviation - Intention revealing names - //

    Comments === bad code (not always) - No dead code
  2. @kunicmarko20 - No abbreviation - Intention revealing names - //

    Comments === bad code (not always) - No dead code - No magic numbers
  3. @kunicmarko20 - No abbreviation - Intention revealing names - //

    Comments === bad code (not always) - No dead code - No magic numbers - No one-time variables
  4. @kunicmarko20 - No abbreviation - Intention revealing names - //

    Comments === bad code (not always) - No dead code - No magic numbers - No one-time variables - No duplication
  5. @kunicmarko20 Functions - One responsibility - Multiple smaller functions -

    No side effects - Only one level of indentation
  6. @kunicmarko20 Functions - One responsibility - Multiple smaller functions -

    No side effects - Only one level of indentation - Early returns, avoid else
  7. @kunicmarko20 Functions - One responsibility - Multiple smaller functions -

    No side effects - Only one level of indentation - Early returns, avoid else - Avoid flag arguments