Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-17-2008, 02:48 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
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
Code:
int[] a = new int[10]; for (int b = 0; b < 10; b++){ a[b] = b; }
Ridiculous
Code:
int[] chicken = new int[10]; for (int egg = 0; egg < 10; egg++){ chicken[egg] = egg; }
Microsoft DirectX's API
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.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2008, 03:07 AM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 720
Nicholas Jordan is on a distinguished road
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-17-2008, 03:34 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
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.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-17-2008, 06:01 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 462
fishtoprecords is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-17-2008, 08:01 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 720
Nicholas Jordan is on a distinguished road
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.
Code:
while(true)System.out.print(" :p ");//
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-18-2008, 12:36 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
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
Code:
while(true)System.out.print(" :p ");//
I like the program output though.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-21-2008, 05:11 AM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 720
Nicholas Jordan is on a distinguished road
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.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 07-24-2008, 02:54 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
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.
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 07-24-2008, 04:55 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 720
Nicholas Jordan is on a distinguished road
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?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 07-29-2008, 05:10 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 462
fishtoprecords is on a distinguished road
Quote:
Originally Posted by Nicholas Jordan View Post
Does it bother you to be Green?
In our Kermit voice:
Its not easy being green...
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 11-16-2008, 11:27 PM
Member
 
Join Date: Nov 2008
Posts: 22
ImaginationX is on a distinguished road
This all looks so very complicated to me.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming a Class Java Tip Java Tips 0 12-22-2007 01:21 PM
RMI naming problem Robbinz New To Java 1 12-07-2007 01:32 AM
Naming conventions Java Tip Java Tips 0 12-03-2007 11:53 AM
namespace conventions from sun.... money123 New To Java 3 07-31-2007 07:44 AM
error in JNDI naming jitendra.ibs Java Servlet 0 06-08-2007 07:23 PM


All times are GMT +3. The time now is 10:14 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org