-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Suggestion that might save newbies a lot of time Cat != CAT
PostPosted: Fri Oct 07, 2005 2:06 pm 
Beginner
Beginner

Joined: Wed Jun 01, 2005 6:51 pm
Posts: 27
Location: Philippines
In the Documentation you use the Cat object in many places. The problem is, you name the table it works with "CAT" as well. So when you look at examples like a createQuery("from Cat") it isn't intuitive that the "Cat" in this case is the object Cat and not the table CAT.

Someone coming from an adequate knowledge of SQL might look at the HQL query "from Cat" and see it as a shortcut SQL statement, as I did.

Since it doesn't matter what names you use in these examples, doesn't it make more sense NOT to have object name = Cat and table name = CAT?

Would it not be every bit as good to have the table name be CATTABLE?

Then when a newbie is looking at createQuery("from Cat") he won't confuse it with the sql statement "SELECT * FROM CATTABLE".

Just a suggestion for the next time someone touches the documentation.

_________________
Mike "Ollie" Oliver


Top
 Profile  
 
 Post subject: good idea
PostPosted: Fri Oct 07, 2005 3:33 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Good idea.
I only suggest following this DB naming convention http://weblogs.asp.net/jamauss/articles ... tions.aspx
and have table names as plurals: i.e. Cat is the object and Cats is the table.
Plurals make SQL more like normal language.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: As with most naming...
PostPosted: Fri Oct 07, 2005 4:12 pm 
Beginner
Beginner

Joined: Wed Jun 01, 2005 6:51 pm
Posts: 27
Location: Philippines
it isn't necessary to be rigid, and any way that is simple, does not confuse and is easy to remember will work.

In our own 'coding standards' we advise for naming,

Quote:
Keep names as simple and concise as possible while describing the contents enough to avoid confusion. Above all do not mislead by calling an int variable myDouble or a Double variable myInt, etc. Lastly within a system or application, have ONE name for ONE value and only change the name when the variable may have or requires a different value.


Cat and Cats works, Cat and CATTABLE works just Cat and CAT does not.

_________________
Mike "Ollie" Oliver


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 3:09 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
How is CATTABLE concise? is it a CatClass also ?

i'm going to drive my Ford truck now to Walmart the store and buy some apples fruit with some dollars currency ?


Top
 Profile  
 
 Post subject: I suppose one definition of concise...
PostPosted: Sun Oct 09, 2005 9:20 am 
Beginner
Beginner

Joined: Wed Jun 01, 2005 6:51 pm
Posts: 27
Location: Philippines
Dennis,

If your use of concise is limited to "as few words as possible" you might be right that CATTABLE and CATCLASS would not be as "concise" as possible. Although I did NOT suggest changing both names.

But that's not the point, the point is to avoid confusion over Cat vs CAT when they are different "things". To me it doesn't matter what is used IF it avoids confusion so the "Cat" for the class name and "Cats" for the tablename which is normally converted to "CATS" fits your usage of "concise" and is less confusing.

_________________
Mike "Ollie" Oliver


Top
 Profile  
 
 Post subject: what about apples and Apples?
PostPosted: Sun Oct 09, 2005 1:45 pm 
Beginner
Beginner

Joined: Wed Jun 01, 2005 6:51 pm
Posts: 27
Location: Philippines
dennisbyrne wrote:
How is CATTABLE concise? is it a CatClass also ?

i'm going to drive my Ford truck now to Walmart the store and buy some apples fruit with some dollars currency ?


Well if Ford was ambiguous or Walmart was ambiguous or dollars ambiguous, then perhaps you would need more to "avoid confusion".

Thinking about your analogy, what if it were "I went to Apple for an apple", am I going for a fruit or a computer?

_________________
Mike "Ollie" Oliver


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.