Thursday, August 12, 2010

Why don't developers care about warnings or code consistency?

Maybe I am just one of those oddball anal developers but I don't care for warnings in my code and I want all the code to be consistent. Consistent code makes it so much easier for another developer to start on a project. As we add more developers at work, and it could be that a number of them are straight out of college, we are getting a very lax attitude on programming.

When I first started here there were over 8,000 warnings in the code base I was assigned to work on. Over time I got that down to zero then turned on even more warnings in Eclipse until I was happy with how clean the code was and we have kept it at zero. New full time developers on the project have been told zero warnings are the normal and since there were zero warnings on the day they started what could they argue?

We have a standard set of warnings which is even easier to do now that Eclipse 3.6 is out and you can export that part of the workspace. I have a webpage with full screen shots of our warnings on the internal Wiki page. Takes a little time to set up but once you do you just keep in lock step with everyone else. If you start a project with no warnings then any warnings that appear are very obvious and usually very easy to fix. I did the hard work and cleaned them up, at least others could play nice and keep it that way. When there were piles of warnings they were easy to ignore, now there are not but people still seem to be able to ignore them.

The second piece of annoyance for the day is people who write new code and don't follow any of the patterns of the existing code. When we write a boolean to the server it is written as a string either "1" or "0". All of our code is i18n friendly but of course those two strings are not kept in a string table. We have a method to write a boolean value called sendBool(bool value) that writes the "1" or "0" as needed. So the developer does not use the helper method that is used by all the other messages but instead puts in the string with an if statement and does not flag the strings with  //$NON-NLS-1$ and thus the warnings.

Even after I sent a note about configuring Eclipse for the warnings and a code review stating you need to use the utility method all they did was use the comment to kill the warning. My code review was totally ignored. I know this is not the right thing to do but I just fixed the code myself. I still think there are other issues with the code that need to be raised so I will have to find a nice way to bring those up.

This has been repeating over and over as they add "casual" developers to the project. People that are not on the project full time but are "helping out" by changing a server message and the associated Java code. At this point they are not helping and for every one added to a project I go through the same steps over again even though I have sent out various development team wide emails on the issue. Easy to get ignored if your are not the architect or a manager I guess.

What is the stance on warnings in the code where you work?

No comments:

Post a Comment