File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why bean class called as BEAN

 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after all bean is also a class file which has got some setters and getters then why must call it as with special name?


why it is called as bean?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, for one Beans must follow a specific naming convention for setters and getters. But there is more to it: http://java.sun.com/products/javabeans/faq/faq.general.html#Q2
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darn. Judging by the title of the thread, I was hoping for some explanation of why the word "bean" is used (instead of, say, "ball"). You know, some enlightening coffee analogy. The FAQ talks about reusability, and that's not what I associate with coffee beans
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i need exact answer for this question this was asked in the interview
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is one; I always assumed it was just arbitrary. Your interviewer may as well have asked "why is Java called Java?".

If they had asked "what features could a Bean have?", now that would have been an answerable question.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Sturrock:
"why is Java called Java?".


Because "Oak" was already used, if I remember correctly...
 
Sujatha Rangarajan
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In 1995, Sun's Oak language was discovered to suffer from trademark problems. A quick hunt for a suitable name followed, and Java was chosen. From this point forward it became obligatory for Java products to have names based on coffee and/or the culture and geography of the Indonesian archipelago. Thus in 1996 when Sun engineers were casting around for a name for Sun's component software architecture, they settled on JavaBeans.

I found the above explanation in sun web site
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sujatha Rangarajan:
... From this point forward it became obligatory for Java products to have names based on coffee and/or the culture and geography of the Indonesian archipelago.

Really? Why did it become obligatory that Java products were named after coffee and/or the culture and geography of the Indonesian archipelago? Is there a law or legal reason that says so? :roll:
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assumed it must be a strongly enforced requirement, just by scanning the 3rd party product market.

I really liked "bean". It conjures up thoughts of a glossy hard shell of encapsulation. Then the bean spec completely blows it with accessors, so it's a bean with unsightly holes drilled all around and unclean matter oozing in and out. Yuck.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh no why java class is called as bean? just by using setters and getters inside a class it got the name called Bean

if i use the same setter and getters in normal classes we wont call it as Bean

why like that?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saikrishna, your usage of English is a bit confusing... what do you mean by the words "call it as bean"? Please try to phrase your words differently, because it's not clear what exactly you're asking.

Are you asking (1) what a Java Bean is or (2) why it is called a "bean" and not something else?

(1): A Java Bean is a Java class that has a public, no-arguments constructor, that is Serializable and that has getter and setter methods to get and set its properties. That's just how Java Beans are defined. If you write a class that meets these conditions, then your class is a bean, whether you intended it as a bean or not. See the definition on Wikipedia. You can also find lots of information about Java Beans on the JavaBeans homepage.

(2): It's called a "bean" and not something else just because the person that invented Java Beans thought that was a cool name.
[ August 23, 2006: Message edited by: Jesper Young ]
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesper Young:
Saikrishna, your usage of English is a bit confusing... what do you mean by the words "call it as bean"? Please try to phrase your words differently, because it's not clear what exactly you're asking.

Are you asking (1) what a Java Bean is or (2) why it is called a "bean" and not something else?

(1): A Java Bean is a Java class that has a public, no-arguments constructor, that is Serializable and that has getter and setter methods to get and set its properties. That's just how Java Beans are defined. If you write a class that meets these conditions, then your class is a bean, whether you intended it as a bean or not. See the definition on Wikipedia. You can also find lots of information about Java Beans on the JavaBeans homepage.

(2): It's called a "bean" and not something else just because the person that invented Java Beans thought that was a cool name.

[ August 23, 2006: Message edited by: Jesper Young ]


hmmm I got better solution from you thak's boss
so java beans has got no arguments constructor and it must be public class which should also serializable

If a class is not following these principles, will become a normal class
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic