• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt K&B chapter 1 javabean names

 
Josh Dubey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks,

Josh
 
Naseem Khan
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this thread...

Javabean


Naseem
 
Josh Dubey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is another thread about this.
[ July 31, 2006: Message edited by: Keith Lynn ]
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic