8 Stay Clean

1. When to Refactor

  • If it’s not broken, don’t fix
  • When to
    • It should be the code that you are currently working with
    • Difficult to comprehend or change for you
    • Test coverage to protect from regression

2. Broken windows

  • Accept no broken windows.
  • A building with few broken windows have tendencies for others to break in and break more.
  • Do not allow mistakes of past to open door for more mistakes

3. Code reviews and Pair programming

  • Promote proactive cleanliness
  • Set guidelines
  • Work in pairs
    • Real-time code review
    • Increases quality
    • Naming and refactoring easier

4. Boy Scout Rule

  • Rober C. martin. -

5. Conclusion

  • Refactor when necessary. Not every code we see
  • Set and maintain standards
  • Do code reviews and watch for broken windows
  • Pair and share your knowledge
  • Leave the code a better litter than you found it