Welcome to the final part of this review of the Pluralsight course Clean Code: Writing Code for Humans by Cory House.
Cory is a Microsoft MVP in C#, founder of OutlierDeveloper.com, avid tech reader, and speaker. He believes in clean code, pragmatic development, and responsive native UIs.
Here are the links to each part in this series:
Part 1 – Writing Code For Humans
Part 2 – Clean Code Principles
Part 4 – Clean Code Conditionals
In this final episode, Cory demonstrates all of the lessons that we have learned in this course.
Demo
In this module, Cory takes a dirty application and refactors it into a clean one using the principles covered earlier in this course.
It is an application for registering conference speakers and Cory registers his cleaning fish for humans course.
We see that the initial dirty code is a fairly realistic and not too exaggerated example.
Some problems with it are:
- Much too much indentation
- High cyclomatic complexity, low maintainability index and high class coupling
- Numerous types of useless comments
- Poorly named variables
- Variable declared to far away from their use
Cory fixes all of these problems and turns the application into something much cleaner.
Stay clean
This final module wraps up the course by examining the key takeaways.
First he discusses when, and when not to refactor. Most importantly you need adequate test coverage to protect yourself against regressions.
Next he relates the Broken Windows article to coding and the lessons that teaches us.
He recommend Code Reviews and/or Pair Programming (two best practices that I strongly agree with)
He points out Robert C. Martin’s “Boy Scout Rule”:
“Always leave the code you’re editing a little better than when you found it.”
And he ends with a summary of all these important points.
Verdict
Must Watch.