I do have one last question I forgot to ask and that's when to call a class a bean. For example I will use the Customer.class again. It contains an Address.class which basically just has address lines, city, state, zip and country and getters and setters for each. Should this be named AddressBean and since the customer is just customer information with getters and setters should it be CustomerBean?
For years I didn't see the point of complying with bean conventions with my code.
Finally the light bulb light up when I started using tools which could read my classes if they were bean compliant.
Bean conventions don't have anything to do with calling it a Bean. The "bean" aspect comes into play with other programs can expose your program through reflection and introspection. See
java.sun.com/docs/books/tutorial/reflect/index.html (reflection)
java.sun.com/docs/books/tutorial/javabeans/introspection (introspection)
Name the class whatever makes sense.
Let's see what Thorbjørn's take on this is.
Bill
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of James Perkins
Sent: Tuesday, October 21, 2008 3:26 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: Understanding Object Usage
Thorbjørn,
As always you have great advice. The interface makes more sense to me now. I
basically knew what they did and I've used them in examples, but I failed to
see the use of them in a whole. I like the contract concept though. That
makes a lot of sense.
As far as the comments go. They make a lot of sense too. I was struggling on
the concept of creating too many objects vs. creating the objects needed.
And just an FYI I'm not really migrating anything, just trying to learn is
all.
I do have one last question I forgot to ask and that's when to call a class
a bean. For example I will use the Customer.class again. It contains an
Address.class which basically just has address lines, city, state, zip and
country and getters and setters for each. Should this be named AddressBean
and since the customer is just customer information with getters and setters
should it be CustomerBean?
I just want to stick to some standards and not write a bunch of sloppy code
that makes sense to no one except me.
Thanks in advance,
James R. Perkins
As an Amazon Associate we earn from qualifying purchases.