File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt K&B chapter 1 javabean names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt K&B chapter 1 javabean names" Watch "Doubt K&B chapter 1 javabean names" New topic

Doubt K&B chapter 1 javabean names

Josh Dubey

Joined: Jul 28, 2006
Posts: 3
K & B says on page 9 (talking about JavaBeans):

"Listener methond names used to "register" a listener with an event source must use the prefix , followed by the listener type."

In the self test, question 5, one of the choices for a method name following the JavaBeans standard is . The answer key says this does not follow the standard. I still don't see why. Granted "size" is an absolutely terrible name for a listener, but if you did name your listener that, wouldn't it still work? Or does "standard" in "JavaBeans standard" imply that you will choose sensible names for your variables?


Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Check this thread...



Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Josh Dubey

Joined: Jul 28, 2006
Posts: 3
In that thread, you seem to be implying that whether "add" is correct or not depends on the purpose of the method. But the question in K & B says nothing about the method purpose.

To put it another way, if my method purpose is to add a listener named "size", then "addSize" is correct.

Let me know if I'm still missing something.

BTW, I'm electing to continue the discussion here rather than the old thread since this thread title conforms to the "doubt" standards recently defined in the errata thread.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
Here is another thread about this.
[ July 31, 2006: Message edited by: Keith Lynn ]
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
Hey Josh -

Thanks for creeating such a well named thread

So, in our errata, we've mentioned that we're going to enhance page 9 to say that by convention Listeners have to end with the word "Listener". We're hoping that that covers it...what do you guys think?

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
I agree. Here's the link:
subject: Doubt K&B chapter 1 javabean names
It's not a secret anymore!