Results 1 to 11 of 11
  1. #1
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default Naming conventions

    Hello everyone.

    When I was in school and also at varsity I have seen weird and wonderful variable names. Some are cryptic and others are ridiculous. Then there's Microsoft's way. Look at DirectX API and then you will see what I mean.
    Cryptic
    Java Code:
    int[] a = new int[10];
    for (int b = 0; b < 10; b++){
        a[b] = b;
    }
    Ridiculous
    Java Code:
    int[] chicken = new int[10];
    for (int egg = 0; egg < 10; egg++){
        chicken[egg] = egg;
    }
    Microsoft DirectX's API
    Java Code:
    int[] another_array_of_integers = new int[10];
    for (int a_specific_index = 0; a_specific_index < 10; a_specific_index++){
        another_array_of_integers[a_specific_index] = a_specific_index;
    }
    I feel that there must be some universal standard out there. Like java beans for example. They are nice. I found this article on naming conventions. Any opinions on this matter?

    Happy coding everyone. :D
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default names are not code

    I hate any and all naming conventions of any kind, they bring in people who do not respect the Krell Empire for it's true place. Whenever starting a few pages of code I go to hotbits to get variable names. A pair of round braces, followed by some semicolons, is the only naming needed. What the code does is what the code does, the label to identifiy the method call is just an excuse for people to talk about something because they do not code on 200 character lines.

    I don't mind the hammer I got in intro, but please let me have this one. You asked a question, I strongly feel this way.

    I get boxes hung all the time because of poor code that is Fabulously Styled - Google Search

    If needed, I yield when and where the code actually works and method naming is done for maintainablility.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default

    Thank you Nicholas Jordan. This is the first time I heard someone say that about naming conventions.

    I feel that these names personalize the machine. At my university lecturers are considering graphical programming. So much for old fashion text. :p
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by tim View Post
    I feel that there must be some universal standard out there. Like java beans for example.
    No, there are no "universal" naming conventions, and there never can be. There are some styles that Sun uses in their API and example code. These are generally accepted and widely used.

    There might be a 'universal' convention as soon as there is a universal programming language. Hint: Java isn't it.

    The purpose of naming conventions it human communications. Noting more. If you write and use your own code, you can invent what you want.

    If you want to be able to have someone else help you, you should use the naming (and all other conventions) of the language. This helps information transfer between humans. If you do it properly, someone can look at your code and know that you use a Connector object and call a send() function.

    The more people you have working on a piece of code, the more important conventions are. This includes naming conventions, commenting conventions, testing conventions, etc.

    Doing this well is actually hard.

  5. #5
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Smile krell reported to be ficticious

    Quote Originally Posted by tim View Post
    Thank you Nicholas Jordan
    Nick
    Quote Originally Posted by tim View Post
    This is the first time I heard someone say that about naming conventions.
    Most of those people work in projects where such things as relying on an interface, using simplfied naming that conveys what the data collection does is the only thing that will work.

    My approach is better suited to a technician with a test meter and some thirty pounds of bench manual close by.
    Quote Originally Posted by tim View Post
    I feel that these names personalize the machine.
    I knew that, I meant no harm. You asked a question, my answer would be better suited to an E.E. at a two year technical institution than front line university environment.
    Quote Originally Posted by tim View Post
    At my university lecturers are considering graphical programming.
    <neutral>Obviously, or you would not have asked the question. </neutral>
    <hope>Maybe you can get me going on xml</hope>
    Quote Originally Posted by tim View Post
    So much for old fashion text.
    Well, you have me here. Brain ( as in human brain - normal definition ) is known to work better in abstractions and visual /graphic. I position myself such that I am oblidged to take your offer of investigation seriously.

    Define old fashioned.
    Java Code:
    while(true)System.out.print(" :p ");//
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  6. #6
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default Empty Comments

    Hello Nicholas Jordan

    I've noticed that you add empty comments in your code. Why do you do this?
    Quote Originally Posted by Nicholas Jordan
    Java Code:
    while(true)System.out.print(" :p ");[COLOR="RoyalBlue"]//[/COLOR]
    I like the program output though. ;)
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  7. #7
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Arrow spare me oh green guy!

    Really, no bull? Because you actually want to hear the answer?

    You have to promise me immunity under the General Ratified Ratraps Ratification Rating Redundancy Rattle becuse ~ I can promise you this ~ you will not believe me.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  8. #8
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default

    Quote Originally Posted by tim
    I've noticed that you add empty comments in your code. Why do you do this?
    I thought you did it for some technical reason. For example, an extra star distinguishes comments from JavaDoc.
    Quote Originally Posted by Nicholas Jordan
    spare me oh green guy!
    That hurts Nicholas. :( Goodbye.
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  9. #9
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    I use them because they are the fastest buffer / editor combination I could find, when I am running at my natural data rate I have to make room for the system command stack. It is extremely common for me to have to slow down as I move across the page because I drop things out of the buffer. Once I saw [[[[ in the browser momentarily, it remains for me to find where that came from.

    Does it bother you to be Green?
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  10. #10
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Nicholas Jordan View Post
    Does it bother you to be Green?
    In our Kermit voice:
    Its not easy being green...

  11. #11
    ImaginationX is offline Member
    Join Date
    Nov 2008
    Posts
    23
    Rep Power
    0

Similar Threads

  1. Naming a Class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-22-2007, 12:21 PM
  2. RMI naming problem
    By Robbinz in forum New To Java
    Replies: 1
    Last Post: 12-07-2007, 12:32 AM
  3. Naming conventions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-03-2007, 10:53 AM
  4. namespace conventions from sun....
    By money123 in forum New To Java
    Replies: 3
    Last Post: 07-31-2007, 06:44 AM
  5. error in JNDI naming
    By jitendra.ibs in forum Java Servlet
    Replies: 0
    Last Post: 06-08-2007, 06:23 PM

Posting Permissions

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