Monday, March 4, 2013

//Comments

I hate (opps told my kids that we should never use that word), writing comments in my code.

I'm not talking about API comments that people can use in intellisense to understand the method and it's parameters. I'm talking about comments in the code that are supposed to describe private methods or logic flows. It shouldn't need to be done in this day and age of programming. We are well past the age of days past when programmers used a,b and c as variable names and then reused the same variable for a new contextual meaning.

I read blog posts over and over talking about the correct rules and syntax of using comments. What to comment in or out of methods. How about we write code that explicitly states what we are doing. If it doesn't make sense to you, then how about your simplify it so you can explain it to a teenager.

Developer: I can't understand the code when I read it.
Me: Do you have unit tests written against the code?
Developer: No.
Me: I bet when you write them your code will change to a more readable state.


I'm so tired of fighting battles I had as a software engineer ten or fifteen years ago. I want to be pushed on the complexity of doing things even more simply. I'm tired of reading nested if and case statements scrolling through my IDE and wondering what JR developer was allowed to write such crap only to find out it was the companies most senior developer. And he was the favorite of the managers because he just got shit done.

Yeah he got shit done. Five hundred line methods with more cyclonic complexity than can be measured. I'm supposed to add a feature without breaking the existing functionality.

Now is the time I wish he had written comments!!!!

No comments:

Post a Comment