Coding Standards - Part 1

  • Analogous to your convention of user-defined functions we prefix our trigger names with t_.

    tables:

    t_<tablename>_iud or t_<tablename>_oiud for instead-of triggers.

    views:

    t_v_<viewname>_oiud

    Cheers,

    Win

  • Just to dispell some of the drum beating on this thread, I've asked 22 different SQL programmers and DBAs in some pretty large companies, some of which were related to the Department of Defense, and not a one of them has even heard of ISO-11179.  So I looked up the document and my impression is that it's long winded, has few examples (especially pertaining to SQL), and no quick reference or summary card.  I could be wrong because it was long enough that I got tired of reading/analyzing it.

    That, in itself, would be a problem.  While the beginning of section 2 concentrates a bit on the word "taxonomy", the document seems to defy the word simply because of its length and apparent complexity.  Here's the definition of the word "taxonomy" from the following URL (I hi-lighted one of the more important aspects)...

    http://whatis.techtarget.com/definition/0%2C%2Csid9_gci331416%2C00.html

    taxonomy

    Taxonomy (from Greek taxis meaning arrangement or division and nomos meaning law) is the science of classification according to a pre-determined system, with the resulting catalog used to provide a conceptual framework for discussion, analysis, or information retrieval. In theory, the development of a good taxonomy takes into account the importance of separating elements of a group (taxon) into subgroups (taxa) that are mutually exclusive, unambiguous, and taken together, include all possibilities. In practice, a good taxonomy should be simple, easy to remember, and easy to use.

    ISO-11179 is not simple nor is it easy to remember nor is it specific.  It seems to be more of a guidline as to how to write your own coding standards, open to some interpretation,  than it does a definitive standard.  While some of the theory is grand and maybe even useful, my feeling is that ISO-11179 is complex enough and long enough (6 rather large sections of typical government rhetoric) that only those forced to use it  , will actually use it even most of the time...

    ...but that's just a feeling... decide for yourself.  Here's a URL where these types of documents are available.

    http://isotc.iso.ch/livelink/livelink/fetch/2000/2489/Ittf_Home/PubliclyAvailableStandards.htm

    Look for "ISO/IEC 11179".  And, yes, there are 6 parts.

    In closing, perhaps this is why government issued toilet seats cost $600

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff, you have expressed more eloquently and in far less words my frustration with ISO-11179... and I only read Part 5 - the part about naming conventions!

    I'm still not ready to dismiss the standard outright - if Joe or someone else could address several of the questions I posed about the standard in my post of 12/10/2004 , I would certainly be willing to take a long and patient look again at Part 5 as well as read the rest of the standard.

    IMO, good examples are like gold - and Part 5 has few examples, and the ones it does have didn't do much for me. So perhaps Joe or someone else who uses the Standard could do a mitzvah for the SQLServerCentral.com community and post a few good examples to illustrate what ISO-11179 Part 5 is getting at.

    Best regards,

    SteveR

  • Hi Steve,

    Great article by the way. It really helped me. However, I have one concern pertaining to how you go about naming Triggers. what i really have an issue with is the numerical designation applied to the name (Products_trd2). I think that your naming convention could be a bit more descriptive.

    Keep up the good work.

    RyanF

  • Steve Rosenbach (1/13/2005)


    Jeff, you have expressed more eloquently and in far less words my frustration with ISO-11179... and I only read Part 5 - the part about naming conventions!

    Thanks, Steve... as you can tell, I'm pretty well put out with the standard myself. I follow a relatively unknown military standard that even the Government doesn't seem to follow... it's called "MIL-TP-41/H"... that's a "Modenism" for "Make It Like The Print For Once, Heh?" 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • On my own, I have come up with most of the conventions that you recommend. In particular, I am a big fan of what I call Hungarian postfix notation, which places the object-type identifier at the end of the name rather than at the beginning, so that objects related to an entity such as "Customers" all fall naturally into an alphabetic sequence.

    That's why I'm puzzled that you break with that convention here and there. In naming views, for example, you prefix each with a lower-case v, thereby introducing noise where there should be signal. Why not use the V as a suffix?

    Similarly for your naming of UDFs. Why not use suffixes? My own suffixes are _fns and _fnt (for scalar and table functions respectively).

    Arthur

    Arthur Fuller
    cell: 647-710-1314

    Only two businesses refer to their clients as users: drug-dealing and software development.
    -- Arthur Fuller

Viewing 6 posts - 46 through 50 (of 50 total)

You must be logged in to reply to this topic. Login to reply