As I told you before, Puzzle Frenzy was build starting from an old app I wrote for WP7. A lot of things changed since then, and most importantly I got to read Uncle Bob’s Clean Code as well as watch some of his Clean Code episodes.
Based on what I learned by reading the book I started refactoring the code. One of the thing that bothered me the most in the old code was the big source files, where I kept big classes and long methods.
Over time I managed to decrease the classes size quite a lot which helps me when it comes to testing, fixing bugs or adding new features.
Here is a comparison of the file size numbers:
|Total line count||4114||6514|
|Source files count||45||118|
|Average file line count||91||55|
- I increased the total amount of code with 58%
- I increased the number of files with 162%
- I reduced the average file size by 39%.
Here is how the file line count looks like:
As you can observe I still have some old large classes, but with constant refactoring I’m pretty confident that I will manage to decrease their size over time.
I’m more then excited with these changes: now the code reads better, I can understand easier what it does, and I have more confidence in it.
I strongly recommend the above-mentioned Clean Code book, it contains some priceless advice.