Recently I was forced enticed to read a book called The Elements of Java Style (Amazon link) for my Software Engineering class. This book is about proper coding standards in Java and it was surprisingly a nice read. I half expected that this book was a boring manual that nobody reads. However, what I found was instead a concisely written and delightful set of guidelines that can help improve the skills of any programmer. The book lists 108 different rules to follow and provides examples with explanations on why the various rules should be followed.
I admit that I am lazy person when I write code. I honestly don’t follow all the proper coding guidelines when working on projects. After finish reading the book however, I was inspired to actually not be lazy when writing code. The book was able to convince me that being lazy now would only cost me extra time in the future. This will lead me onto my next point about our current Workout of the Day (WOD).
This week, my Software Engineering class had us fix some code in various repositories. The goal of the WOD was to modify the code to adhere to the class coding standards in two repositories, rot13input and scribble. While I don’t like to fix other people’s code, IntelliJ has a nifty plug-in called CheckStyle that can highlight most of the errors within the code. This made fixing most of the obvious problems quite easily as I was able to jump to the problematic line with a single click. The only thing left remaining was to fix semantic problems, such as insufficient Javadocs or comments. My times however were unimpressive as I finished rot13input in about 25 minutes and scribble in about 17 minutes. I believe I took so long was because I spent some of my time checking the guidelines and trying to understand the code.
I found this week’s module on coding standards to be quite insightful. Working with other people’s code and reflecting on my own coding style showed me that I was quite a terrible programmer before encountering this module. My team members in previous projects must have found reading my code to be quite frustrating as I lacked proper comments, white spaces, and overall structure at times. Hopefully from this module, I will be able to improve my own coding style so I will have pleasant code to read. In addition, I think my future self would much appreciate good code now so I will not have to curse myself when reviewing old, bad code.