In the spirit of expanding our knowledge on both the basic and advanced programming concepts, most of our Lodz-based team members have attended a video presentation on how to write code in clean fashion, delivered by the one and only Uncle Bob. The event was organized by the Lodz Java User Group and took place at the Department of Microelectronics and Computer Science, at Lodz University of Technology. It was sponsored by Rule Financial.
Robert Martin, known as Uncle Bob, is a recognized American consultant and author. His book “Clean Code” is a classic and recommended reading for anyone who develops and maintains source code. Uncle Bob founded The Clean Coders, a company that creates educational videos for programmers (code-casts). The videos are made available under community license and can be shown to a group of up to 50 people outside of business hours (and only one time).
Seeing the presentation was a rewarding experience for all of us. Once in a while, it’s valuable to listen to a senior guy wielding a samurai sword and ordering you to stick to the proper coding standards!
One of the things we’ve been told is that every comment in the source code is a personal failure of the programmer, because it proves that he didn’t manage to express the purpose of the code fragment with the programming language itself.
Uncle Bob underlined the importance of keeping your source files small, in the range of 60 to 200 lines of code. This was supported by real-life statistics coming from many mature projects.
The presentation also explained the difference between a class and a data structure, as well as how to use both concepts in the design of solid business solutions.
My personal favorite was the well-deserved ridicule of getter and setter methods. I always found the concept somewhat disturbing, especially when it was preached as gospel by college instructors. In my opinion, having private variables and then accessing them with methods like getFoo() demonstrates a lack of understanding of the basics of object-oriented programming.
Another enlightening observation was that a database does not store real objects coming from the business world, but merely their representation in the form of a data structure (with columns acting as public members of the structure).
The video was entertaining and filled with funny moments, but personally I found some of Uncle’s props a bit distracting (such as the magic wand). Anyway, overall it was a very good presentation.
Since we all liked it, and more presentations in the series are in need of sponsors, it’s highely likely that our company will act as one in the near future (and we’ll be sure to announce it here on our blog).