Quick example: why coding standards must be in place

One quick example why coding standards must be in place. Take a look at the following code – property names are changed but not anything else.

public string Property1 { get; set; }


public string Property2






public string Property3


    get; set;


And yes – it is real-world example.


  • Wow, that is unbelievable.

    I've worked in large companys that spent hundreds of hours creating standards documents. But they are worthless because they weren't enforced.

    One solution, only hire good programmers.

    Another solution, appoint a project leader who understands the importance of quality code and isn't shy about yelling at poor producers.

  • You're talking about formatting. Formatting is easily fixed (Ctl+K, D), however function naming:


    Really gets met going. Ever try and take over for someone who codes like this, while commenting out entire blocks of code for no apparent reason? My best advice - write every piece of code like it will be printed in a magazine. Everything consistent, logically named, and cleaned up.

  • This current example is about formatting but this is only the tip of ice berg :)

  • Coding standards are very much important and they must be followed by any means.

  • Worrying about formatting? OMG!? (Ctl+K, D)

    You should give your developer the freedom to perform and not force-feed him rules that can be resolved by the IDE.

  • All your examples are wrong, it should be:

    public string Prp1{get;set;}

    This way the compiler will parse allot faster, don't use whitespace unless you really need it! (also saves allot of screen realestate).

  • In this case CTRL+K,D is not solution - it "fixes" code but not coder :)

  • "In this case CTRL+K,D is not solution - it "fixes" code but not coder :)"

    I'm really sorry, but this reminds me of something my colleague told me about a company he worked for. They disabled FxCop and enabled StyleCop.

    "So it was alright to do stupid things, as long a they looked nice!"

    Structure is important to keep your code readable, but formatting? Common, you gotta be joking right.

    Formatting is personal and there's is no reason at all why you should be the one deciding what anybody elses formatting settings are. You can only hold back the developers and I can not imagine that's something that you would like to achieve.

    Oh and calling a genius of a developer a bad coder because you do not like his line indents is just a tiny little bit... ehmm... shortsighted?

  • I cannot paste the whole class here due to legal limitations but this is not the case you think, webbes. Well... other things I will cover later in this blog are pretty dangerous partial implementations of patterns that code must follow. I have hell good example about this issue :)

  • I love reading your high quality blog, but I realy thought this was an April Fools' Day joke when I first read the post.

    So.. you make me curious for the example.

  • Basically it is very good point to keep same writing style through all code in project. Okay, I understand that there are some places where rules are not followed - well, people make mistakes, no problem. But when you find load of classes with all similar things written in ten various versions BY ONE PERSON then it makes problems.

    Okay, this one dude may know very well what his code does and unfortunately as he is used with extremely messy coding style then he reads his code with no problems.

    But one day the next developer took this code over and well... it took him time to read and understand that mess.

  • Your post simply created a smile in my face ;). Definitely true thing. Coding standards have to be followed in order to speed up the development process, especially when we speak about large projects where we have thousands of code lines. Anyway, I do partially agree with webbes that we cannot enforce developers to change even the formattings of properties, but, I still agree to have some generally accepted standards that would make our lifes easier :). Thank you for the blog post.

  • I agree. If the coder can't be bothered to take a small amount of time in formatting their code then I can't see that they've spent any time considering the readability of their logic flow either, let alone taking into account the person who needs to support their code 5 years down the line.

Comments have been disabled for this content.