How important is coding style? This debate is something that really draws out the "artist" and critic in every programmer. In many ways the style of writing code is similar to writing poetry, and what makes the subject so hotly debated is that the beauty of the code, sentence or poem is all in the eye of the beholder. Just like those critics of of prose and poetry, the serious critiques of coding style come from understanding the limits and history of the form. Practice reading and writing lots of code, in different languages if possible, and acknowledging how many ways there are to write the same functionality.
In the same way that experimentation in poetry and prose makes for a better understanding of the overall form, understanding how different coding standards can make for better (or worse) code. With every coding standard the code will be limited but also potentially clarified in a new way.
Organization of code one way can make code reviews easier, but potentially making maintanability more difficult, code may be separated into different sections that are ordered in a certain way that causes significant scrolling, opening of multiple files and jumping through layers of code, that structured a different way may minimize bouncing around.
Coding standards for teams is especially important, and should be strictly adhered to as best as possible, for the overall benefit of the team. Consistency is very important as being able to quickly jump into a new class, module or section of the code "should" be as easy as jumping into a section that you wrote yourself. Coding standards are an agreement between programmers to create a cohesive work, much like any collaborative effort, the final product should be a uniform work of art.
The most diplomatic way to handle this is often through adopting a tool that lets catches errors quickly and consistently. This also frees up code reviews to be on more important aspects like architecture, re-usability, error checking, design patterns etc. as non-adherence to coding standards often ends up becoming the main focus if the code strays too far from the standards outlined. These tools should also be part of the commit process, so that the code is rejected if it does not pass the coding standards (in certain cases some of these tools may have to have slight adjustments, as desired, but with a focus on consistency).
For those C# Unity or XNA projects some guys really like Resharper (30 day trial at http://www.jetbrains.com/resharper/) For a free style specific checker I like StyleCop: http://stylecop.codeplex.com/ there is a good amount of customization and easily embeds into Visual Studio. The information that is provided from the code checks make it easy to know the issue and change the code to follow the coding standards that have been setup.
For python there is pep8 http://pypi.python.org/pypi/pep8 and pychecker http://pychecker.sourceforge.net/ as well as a few more.
In general the style and syntax checkers are becoming quite popular (especially with scripting languages that don't compile) but regardless a good "style cop" will improve code quality, readability of all sections of the code, and allows everyone to focus on writing great code, instead of what it looks like in the end.
Until next time, StyleCop: that is all.
Michael Hubbard
http://michaelhubbard.ca
Showing posts with label Automation. Show all posts
Showing posts with label Automation. Show all posts
Monday, October 18, 2010
Tuesday, September 28, 2010
Book Review: Lifehacker 88 Tech Tricks to Turbocharge Your Day
With all the books on agile methodologies and planning and managing time I thought I would look at trying to improve some of the regular aspects of my day-to-day activities to try and find "more time". There are still 24 hours in a day, but it is helpful to realize how and where you are spending time on things, and how to improve your use of that time. I enjoy the website http://lifehacker.com/ and finished up reading Lifehacker 88 Tech Tricks to Turbocharge Your Day by Gina Trapani. Overall, the tips are quite interesting and range from the simple (like focusing your attention and emailing yourself things to do) to the more complex (such as setting up a personal wiki server).
I am a big fan of automating things, and love a really slick and complete pipeline. But sometimes the trick isn't to know how to automate something, it is what to automate. It would be easy to try and say "everything", but you really need to start somewhere.
The Lifehacker book really got me thinking about examining my day and thinking what can be improved, and what could be automated. This almost requires an outsider perspective to really examine the details of how tasks are accomplished and where time is spent in a given day. It can be from the complex (like how to push the game & server to another environment), to the trivial (every time you start your computer, do you always open the same three programs). While the Lifehacker book and website provide details on good tips (like carrying around a flash drive of your applications, "firewall" your attention to prevent distractions through a few sets of tasks, or tips for tuning your computer or search habits) the real benefit to this kind of book is taking some time to reflect on your own habits and think about improvements.
I will be keeping track of where I spend my time "in the life of a game programmer/technical artist/team lead and will look into where my time goes in a follow up blog post and try to examine how my time can be improved to increase overall productivity (and possibly sanity :P).
Until then,
Michael Hubbard
http://michaelhubbard.ca
I am a big fan of automating things, and love a really slick and complete pipeline. But sometimes the trick isn't to know how to automate something, it is what to automate. It would be easy to try and say "everything", but you really need to start somewhere.
The Lifehacker book really got me thinking about examining my day and thinking what can be improved, and what could be automated. This almost requires an outsider perspective to really examine the details of how tasks are accomplished and where time is spent in a given day. It can be from the complex (like how to push the game & server to another environment), to the trivial (every time you start your computer, do you always open the same three programs). While the Lifehacker book and website provide details on good tips (like carrying around a flash drive of your applications, "firewall" your attention to prevent distractions through a few sets of tasks, or tips for tuning your computer or search habits) the real benefit to this kind of book is taking some time to reflect on your own habits and think about improvements.
I will be keeping track of where I spend my time "in the life of a game programmer/technical artist/team lead and will look into where my time goes in a follow up blog post and try to examine how my time can be improved to increase overall productivity (and possibly sanity :P).
Until then,
Michael Hubbard
http://michaelhubbard.ca
Subscribe to:
Posts (Atom)