Results 1 to 5 of 5

Thread: Good programming etiquette

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Question Good programming etiquette

    I have a question re good programming etiquette. I have textboxes in a control array (called txtData()). The thing is, I need to replace txtData(9) with a combobox and txtData(13) with a combobox.
    Now, I use a For...Next to transfer these values to a recordset to write to file.
    Would it be GOOD practice to keep coding short and call the comboboxes txtData()
    or
    should we stick to the naming conventions and move the data to the recordset in a Select Case... statement
    Your thoughts would be appreciated

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Re: Good programming etiquette

    OK, the above example won't work because all controls in an array must be of the same type.
    But, the idea of naming convention in general... Rigid? or anything goes?

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Good programming etiquette

    Thread moved to General Developer Forum

    The reason for naming conventions is so that you can tell what something is just by looking at the name.. if you are going to give a combobox a name that makes it seem like a textbox, it will lead to confusion (and would actually be worse than not having a naming convention at all). For that reason I would say that it should be rigid.

    The route you should take (and as you have found, need to) is to change the code to deal with the different kinds of object.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Good programming etiquette

    You're describing Systems Hungarian notation. Opinions are divided on whether this notation is of any use at all. It's very common amongst VB6 coders but not really popular in any other language, from what I have seen.
    There isn't any sort of global standard naming convention; it is just a matter of personal taste (for hobbyists/freelancers) or in-house style (for professionals).


    That debate aside (it's been done here many times before), if you're going to use a notation you might as well stick to it — as Si says — otherwise it is pointless.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Good programming etiquette

    Use descriptive variable names. But not names like:
    Code:
    For Counter1ForMyForLoopIteration 1 to UBound(MyArrayWithStockItemsIn)-1
    Next Counter1ForMyForLoopIteration
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width