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

Meaningful Code (BeCode Brussels - August 2018)

Meaningful Code (BeCode Brussels - August 2018)

In today's crazy world of software development, we sometime tend to forget that coding is a craft and the code must stay meaningful in order for it to be good.

Here is my view on how we can try to make meaningful code, and hopefully that will help some people along the way.

Yannick Lemin

August 23, 2018
Tweet

More Decks by Yannick Lemin

Other Decks in Technology

Transcript

  1. Meaningful Code (Du code qui fait du sens) (parfois le

    français ça craint) August 2018 Yannick Lemin
  2. What makes code Meaningful? • Understandable (even after 6 month)

    • Shareable • Robust • Clean • Reusable • …
  3. 2. Naming • Spend enough time • In doubt: ask

    the team • You can always refactor later
  4. 4. Write readable code • Write concise, short and clear

    functions • Name them right (remember … Naming is?) • Will serve as documentation
  5. 5. Careful with comments in code • Avoid comments as

    much as possible • UNLESS YOU ARE WRITING A PUBLIC API
  6. 6. Pay attention to Warnings • They are there for

    a REASON • Get rid of them as much as possible • If you keep some, make sure you understand the potential consequences • Use Lint tools
  7. 7 . Testing :( • Testing takes time • Tests

    must be maintained • Tests can be complicated
  8. 7 . Testing :) • Tests are a very useful

    documentation • Tests are a safety net during refactoring • They help with the development of unit features (regex, string formatting, calculations, etc) • When the tests are launched, nothing will be forgotten
  9. 8. Refactoring • Refactoring is part of the development process

    • You won’t write the perfect code the first time • Only write the code that is needed
  10. – Uncle Bob Martin “Refactoring should never be a task

    on the board, it is never something that is added to an agenda. It is always part of the development process”
  11. 10. Code Review • Share the knowledge • Learn things

    • Give your opinion • Question the decisions • Share the love
  12. Summary • Work in a team (THE TEAM IS ALWAYS

    RIGHT!) • Naming is Hard! • Write code for others • Make that code readable • Avoid comments • Pay attention to warnings • Automated testing is AWESOME • Refactoring is part of the process • Use one language • Code Review is cool • Go to events