View Single Post
Old 05-25-2004, 03:53 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,139
Belisarius is on a distinguished road
I don't think it will be less efficient to put more methods in a particular object, but it will be more annoying. Here's how I generally do it (I'm not claiming this is how all Java coders do it, it's just how it works for me).

I create an object to represent a Customer. This has all the properties of the customer, Last Name, First Name . . .

I then create a Util object, CustomerUtil, to interact with the database. Util isn't a standard notation, it's just what I came up with.

Don't create one database operation class, create a database operation package, and put all the "Util" classes in there (or, package them with the objects they're interacting with, it's up to you). You'll create a lot of files, but I think that's better than creating a huge file you need to hunt through for methods.

And generally speaking, my "Util" classes are all static methods, as they generally don't need to keep a state.
__________________
GitS
Belisarius is offline   Reply With Quote