On 6/24/2014 2:19 PM, Gary Thompson wrote:
I'm changing an existing program and noticed we have a variety of "styles" for
where sql cursor declare statements are embedded:
1) "in line" in the subrtn/subproc where the cursor is opened
2) In *inzsr
3) On c specs just after the last d specs and prior to any "business logic"
In the interest of trying to make a "shop standard" I'm welcoming comments
Thanks!
I personally prefer #3 but I have some thoughts to share on shop standards.
Don't bother.
Coding standards are a great idea if you work in a mammoth place where
turnover is something to be constantly dealt with, where some large
proportion of the programmer population are raw juniors, or where the
code must pass some strict military / industry audit.
Guidelines have a place in helping programmers quickly sort out the
multitude of trivial decisions that happen every hour: Hungarian? Java?
Braces on this line or the next? Indent 2 or 3? //, -- or /*? Inline
or right side comments? But these guidelines are best discovered by the
actual programming team talking it out.
Promulgating a standard won't actually impose a standard unless you also
have formal code reviews.
And there's one ugly issue that 'standards' always bring up: Existing
code. I'm in an existing program and I need to do some simple
maintenance. Contrary to standard, the code is indented 3 spaces. Do
you really want to pay me umpty-hundreds of dollars to change the
indenting of this program from 3 to 2 spaces? If I don't do that work,
the program is in violation of standards, and if that's the case, then
where's the 'standard'?
If the goal is to unify the look of the code going forward, then why not
talk it out among the team and see if everyone can agree to a particular
style? They'll be far more likely to adhere if they have buy-in, and if
your team gets in the habit of looking at each others' code (informal
code review) you'll be in the habit of discussing more substantial
coding habits (refactoring?) as well as matters of style.
--buck
As an Amazon Associate we earn from qualifying purchases.