Monday, March 14, 2011

To comment or not to comment

When I learned to program in college, the instructor taught us that comments are a very important part of writing code. I for one believe this to be true. However, today I read a blog post that claims that commenting should be a lower priority concern for programmers. Riyad Mammadov said, "If the choice is between a well-designed program without comments and a thoroughly commented but poorly architected one, I will choose the former any day of the week." I can get on board with him on this to some extent. I do believe that well-designed code is a very important aspect of programming. Things should be modular and easy to extend, and writing unit tests can be a very good way of making sure things are working write. However, I believe that even with the most verbose programming possible, there are times where you just can't figure out what a single line of code is actually doing, and why it's written the way it is.

Obviously anyone would prefer a well-designed program, however, I think in most cases it is not impossible to have both good design, and good comments in the code. Maybe it's just the academic in me speaking, but I believe technical writing skills are very important to the successfulness of a programmer in contributing to a team working on a project. This is even more true when the project is something like a video game, where the team is a more diverse group than just a bunch of programmers. Even immigrants that might know programming languages better than English should make their best effort to at least be able to communicate efficiently to help the team be successful.

No comments:

Post a Comment