Keeping Unique Aliases

  • Jeff Moden wrote:

    Totally agreed about the usefulness of standards but I have to say that bad standards are as bad and sometimes worsen than no standards.

    Agreed, but what's much worse is if you get a new developer coming into a project and they single-handedly decide that their naming conventions are better than the ones used in the project then they start using them and ignoring the project standards, then you have a project with two different standards.

    I don't have much of an issue with aliases, they should be as short as possible, because all you need to do is take a quick look at the FROM then hold a few letters in your head while you look at the rest of the query. It is nice to abbreviate to the letters first letter of each word (as Jeff does) then it's obvious when you look at the query which tables the aliases refer to.

    What really annoys me is when no aliases used in a query or they are used but columns aren't prefixed with the alias, it can be a lot of effort to work out which table individual columns are from if there is no aliasing in the query.

  • Let's face it standards articles and forums are coke and mentoes

  • David.Poole wrote:

    Let's face it standards articles and forums are coke and mentoes

    Heh... you said a mouthful. 😀

     

    --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)

  • Japie Botma wrote:

    LOL.  (Not random, alphabetical)  🙂

    Well, fair play, if you work with databases with less than 26 tables!

    All I'm saying is that to the best of my knowledge everybody I've ever known who has worked on these schemes, hates them with an absolute passion. If you have procs that have table aliases quite vertically removed from subsequent usage it makes life nigh on impossible, with an extensive mapping process to get anywhere.

    I'm mean if you're a dedicated misanthropist and you're the boss I guess it's cool. I always write code as if the next maintainer of the code is a psycopath with my home address. He wouldn't like that scheme 🙂

  • I always write code as if the next maintainer of the code is a psychopath with my home address

    Life lesson, that. Sometimes it is. When I write it and then have to look back.

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

  • jonathan.crawford wrote:

    I always write code as if the next maintainer of the code is a psychopath with my home address

    Life lesson, that. Sometimes it is. When I write it and then have to look back.

    I've certainly felt irritated on looking at a bit of code thinking 'Why did some half wit do this?' before realising it was me. I don't think anyone can code a long time without that situation though! OTOH I often look back and think 'Wow! That's really elegant how did I come up with that?'

Viewing 6 posts - 16 through 20 (of 20 total)

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