in reply to Re: Seeking Best Practices - does your company follow a standard?
in thread Seeking Best Practices - does your company follow a standard?

Businesses definitely need to have some standards in place around coding, including guidelines (not laws) about indenting, and other questions of visual style.

Did you actually quantify the benefit of your coding standard? At the end of the year, how much more profit did your company made because of the coding standard? How did you measure that? If productivity really went up, did you let programmers go, because you now need less of them?

Suggestions welcome. How do you quantify something like this? Has anyone tried?

I guess one way to try and quantify this would be to think back at how much time was spent trying to remember what your intention was for various pieces of code before you then had to go and explain that same code to junior members of your team.

I remember several years ago, I wrote a code generating SED script, that I thought was really clever. It was virtually unreadable (all symbols, etc.) and contained zero comments. I didn't write it for production, but as a utility for my own use. It was cool and I was really proud of myself, but I would have deserved to be fired if I even thought about putting it into production like that. And if it were intended for production use, then I would not have changed a line of code, but I would have commented the heck out of it.

Where I found a lack of standards, I've tried to discipline myself - I've used a specific exit code pattern for abends such that someone else maintaining my code in the future could easily see the pattern and add a new abend exit code as needed.

  • Comment on Re^2: Seeking Best Practices - does your company follow a standard?

Replies are listed 'Best First'.
Re^3: Seeking Best Practices - does your company follow a standard?
by JavaFan (Canon) on May 18, 2010 at 01:40 UTC
    I guess one way to try and quantify this would be to think back at how much time was spent trying to remember what your intention was for various pieces of code before you then had to go and explain that same code to junior members of your team.
    Yes, but that falls in the category "don't use needlessly complicated algorithms". Useful, but hard to codify in a standard, and usually absent in any list of coding standard bullet points. Impossible to catch with Perl::Critic.

    My rant is against silly things as putting in a standard than you should use 3 spaces for indentation, or 4. Surely you haven't spend much time explaining code to junior members who struggled with the fact someone used 4 spaces in an indent, and not 3?

      You are correct on all points:

      1. I believe we're speaking about judgement (common sense, or practicality) , and I don't think you can codify these things. Instead, we must rely on standards/guidelines combined with peer code reviews.

      By "peer code review", I don't mean "pressure"; rather, I'm thinking of it as idea exchange. The image I have is similar to what we see here in the monastery. Folks offer up code samples and others have a look and offer alternatives with an explanation of why they think their's is the better way to go. Very often, there are valid reasons to use the alternative. And of course, sometimes, it does come down to personal preference.

      2. No, I have not spent much time explaining the difference between 3 or 4 spaces indented, but I have spent way too much time explaining why not indenting at all is unacceptable in producton code intended to be maintained by others.

      I agree with your rant about the silly things. My point was not so much about how much one indents as it was about them just indenting, and doing so in a consistent manner.