Is inconsistent formatting a sign of a sloppy programmer?

Posted by dreza on Programmers See other posts from Programmers or by dreza
Published on 2012-05-20T21:14:26Z Indexed on 2013/06/27 16:28 UTC
Read the original article Hit count: 347

I understand that everyone has their own style of programming and that you should be able to read other people's styles and accept it for what it is. However, would one be considered a sloppy programmer if one's style of coding was inconsistent across whatever standard they were working against?

Some example of inconsistencies might be:

  1. Sometimes naming private variables with _ and sometimes not
  2. Sometimes having varying indentations within code blocks
  3. Not aligning braces up i.e. same column if using start using new line style
  4. Spacing not always consistent around operators i.e. p=>p+1, p+=1 vs other times p =>p+1 or p => p + 1 etc

Is this even something that as a programmer I should be concerned with addressing? Or is it such a minor nit picking thing that at the end of the day I should just not worry about it and worry about what the end user sees and whether the code works rather than how it looks while working?

Is it sloppy programming or just over obsessive nit picking?

EDIT: After some excellent comments I realized I may have left out some information in my question. This question came about after reviewing another colleagues code check-in and noticing some of these things and then realizing that I've seen these kind of in-consistencies in previous check-ins. It then got me thinking about my code and whether I do the same things and noticed that I typically don't etc I'm not suggesting his technique is either bad or good in this question or whether his way of doing things is right or wrong.

EDIT: To answer some queries to some more good feed back. The specific instance this review occurred in was using Visual Studio 2010 and programming in c# so I don't think the editor would cause any issues. In fact it should only help I would hope. Sorry if I left that piece of info out and it effects any current answers. I was trying to be a bit more generic in understanding if this would be considered sloppy etc. And to add an even more specific example of a code piece I saw during reading of the check-in:

foreach(var block in Blocks)
{
   // .. some other code in here

   foreach(var movement in movements)
   {
       movement.Moved.Zero();
       } // the un-formatted brace
   }

Such a minor thing I know, but many small things add up(???), and I did have to double glance at the code at the time to see where everything lined up I guess. Please note this code was formatted appropriately before this check-in.

EDIT: After reading some great answers and varying thoughts, the summary I've taken from this was.

  1. It's not necessarily a sign of a sloppy programmer however as programmers we have a duty (to ourselves and other programmers) to make the code as readable as possible to assist in further ongoing development. However it can hint at inadequacies which is something that is only possible to review on a case by case (person by person) basis.
  2. There are many reasons why this might occur. They should be taken in context and worked through with the person/people involved if reasonable. We have a duty to try and help all programmers become better programmers!
  3. In the good old days when development was done using good old notepad (or other simple text editing tool) this occurred much more frequently. However we have the assistance of modern IDE's now so although we shouldn't necessarily become OTT about this, it should still probably be addressed to some degree.
  4. We as programmers vary in our standards, styles and approaches to solutions. However it seems that in general we all take PRIDE in our work and as a trait it is something that can stand programmers apart. Making something to the best of our abilities both internal (code) and external (end user result) goes along way to giving us that big fat pat on the back that we may not go looking for but swells our heart with pride.
  5. And finally to quote CrazyEddie from his post below. Don't sweat the small stuff

© Programmers or respective owner

Related posts about coding-style

Related posts about visual-studio-2010