Talk:JavaBeans

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Java (Rated Stub-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub-Class article Stub  This article has been rated as Stub-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
 

Layman's terms[edit]

What the hell kind of layman knows what POJO, serializable, constructors, and getter/setter methods are? I think the wording could be improved. —Preceding unsigned comment added by 128.146.248.165 (talk) 15:37, 19 February 2009 (UTC)

What the hell kind of layman looks up an article like this and doesn't at least know what a constructor is? 72.227.165.191 (talk) 04:09, 13 January 2010 (UTC)

I am just starting to learn Java and installed NetBeans 7 and don't know what a constructor is. Why would a layman know? I get statements in tutorials (from NetBean.org site) that say "put xxx code after the constructor" without showing the code of the constructor so I know where that is. 24.23.254.32 (talk) 03:31, 12 November 2011 (UTC)

Link to COM[edit]

I think the relation to COM that hypothetically justifies there being a link to the article needs to be made explicit. I believe a link to component-based software engineering would be more relevant. --Guillaume (talk) 12:32, 18 January 2008 (UTC)

I agree 24.23.254.32 (talk) 03:17, 12 November 2011 (UTC)

Broken link[edit]

the 3rd link (Enterprise JavaBeans 3.0 Overview) appears broken..(I'm not confident enough to remove it myself!)

POJOs[edit]

The fact that event handling requires support classes, interfaces, and specific base classes, doesn't negate the fact that fundamentally a Java Bean is just a plain ol' object. Nor does adding interfaces, base classes, and support classes to a new class without the Java Bean conventions make the class more than any other object. 128.114.57.91 19:26, 24 October 2006 (UTC)


Move??[edit]

JavaBeans be moved to JavaBeans ??? Is there something I am missing? --soUmyaSch 15:06, 7 May 2006 (UTC)

  • Support move. -- Solipsist 12:47, 24 January 2006 (UTC)
  • Support. The name of the technology does not have a space. – Doug Bell talkcontrib 19:04, 24 January 2006 (UTC)


JavaBeans should be moved to JavaBean, but it needs an admin as the redirect has a history. —Doug Bell talkcontrib 15:55, 8 May 2006 (UTC)
  • Oppose. The official name from Sun is JavaBeans. RedWolf 18:12, 2 June 2006 (UTC)
  • Oppose. Seconded. capnmidnight 18:16, 8 July 2006 (UTC)
  • Support. Other page titles are in singular, too. It's one JavaBean, two JavaBeans. Wouter Lievens 14:37, 6 June 2006 (UTC)

I've removed my vote. --Bonafidehan 16:30, 10 June 2006 (UTC)d

I moved the article (back) to JavaBeans, because that's how it's called officially. The mindless application of some rule that requires the singular for the title of an article would otherwise also require, e.g., Strut, JavaServer Face, and, for that well-known Microsoft operating system... Window. It just makes no sense that way. RFST (talk) 18:31, 22 January 2012 (UTC)

Elaboration[edit]

This page seriously needs expansion and elaboration. As with most useless programming help pages, all it does is explain what is required for something to be considered a Java bean and how one is used - but never explains what one actually is! 68.55.218.175 16:17, 25 May 2006 (UTC)

I fail to see what further explaination of "what one is" one could make past "what is required" and "how it is used". Besides, there is a description: "a reusable component that can be manipulated visually in a builder tool".capnmidnight 18:15, 8 July 2006 (UTC)...

I absolutely agree with the original poster--imho the article makes the common comp-sci mistake of forgetting the "why" while spelling out the "how". It fails to talk about the big picture and immediately gets lost in details like method naming conventions. I read the page and went away thinking "But under what circumstances do you use them? Why would anyone dump pojos in favor of Java Beans?"--Tip: In technical articles, make sure the word because shows up in the first line. -- 193.99.145.162 18:33, 21 November 2006 (UTC)

Java Beans *are* POJOs, with a standard naming convention. As for the why, it's so you can have a "resuable component that can be manipulated visually in a builder tool." Do you need elaboration on why someone would want a reusable component? How about elaboration on why someone would want to manipulate it visually in a builder tool? You're complaining about something being missing from the article when *it's not*. If you expected something more out of JavaBeans, I'm sorry, there just isn't that much to them. capnmidnight 22:05, 30 November 2006 (UTC)
"[JavaBeans] are used to encapsulate many objects into a single object (the bean), so that the bean can be passed around rather than the individual objects.". Isn't that concept infinitely recursive ? i.e. What comes before the bean ? What comes after ? As a newcommer to JavaBeans a definately agree there is lack of context in this article. --Guillaume (talk) 13:43, 18 January 2008 (UTC)
"Isn't that concept infinitely recursive ?". Of course it is although strictly speaking, only functions deserve the "recursive" adjective. But how is that a problem? Classes can have fields whose type is a class, even the same type that's being defined. It doesn't bother anyone. Any implementation of the Composite pattern falls in your question and my counterexample (e.g. org.3wc.dom.Node). Yes it is, but it doesn't matter as the same applies to classes in object-oriented languages... Your questions apply there too; so why should there be a special lack in this article because there's no mention of what comes before or after? Anyway, I don't see any programmer in their right mind who would nest beans in beans in beans and so forth to the point that it would be a problem. I, for instance, never insert beans in beans. Amenel (talk) 13:12, 15 July 2010 (UTC)
Based on my initial research into Javaland, it would appear that there are those who are using the term POJO to mean the same thing as a Java Bean. My example comes from the sample code in "Beginning Spring Frameworks 2", Wrox Press, 2008. In chapter 2, the objects the authors describe as POJOs have all the conventions of Java Beans -- serializable, no-arg constructor, getter and setter methods. Is there something that a Java Bean has that a POJO definitely does NOT? Or are the two terms gradually merging into the same concept? In other words, I agree with the first poster. dabeamer42 14 July 2008 —Preceding comment was added at 21:12, 14 July 2008 (UTC)
A JavaBean is a POJO. But the converse is not true. Amenel (talk) 13:12, 15 July 2010 (UTC)
As to the "why", I can give an answer that reflects why I use JavaBeans in my code, whether professional or personal: just to avoid the hassle of ever growing lists of parameters in function signatures. This happens when the same parameters are passed along a chain of function calls, with or without additional parameters. Adding a new piece of information at one end of the chain requires changing all signatures until the point of consumption. Above a certain number of parameters, it's just a pain to change the signatures of all functions in the chain just so that the newly added piece of information can be passed along until it is consumed. By using a JavaBean, I just have to 1- add the field, initialized to either null or a suitable default value, and its setter/getter pair, 2- set it where it becomes available and 3- consume it where it has to be used: the set of changes and file modifications if lower. That's all... although not always feasible/sensible depending on the context. So the "reusable software components for Java that can be manipulated visually in a builder tool" definition was unknown to me (and never-experienced) until I read the article minutes ago. Amenel (talk) 13:23, 15 July 2010 (UTC)

As a developer with experience mostly in .NET/C#, I find this article too vague as well, probably because it is lacking sufficient context and depth. First, it sounds to me that an important high-level implication of the JavaBean convention is that initial state is set not via constructors but via setters (which has implications for dependency injection). This is not explicitly mentioned, and might be obvious to someone who has actually built something with them, but is not immediately apparent from a cursory reading. Further, a technical justification should be given for each of the individual JavaBean requirements. Second, the phrases "manipulated visually", and "builder tool" are far too amorphous, yet they are supposed to suffice to explain the existence of JavaBeans. In what ways are JavaBeans manipulated visually? (As structural class diagrams? Couldn't source code be considered a visual representation that can be manipulated? Should this be reworded as "manipulated graphically"?) What are the advantages of visual manipulation that JavaBeans ultimately support? (Complexity management? Diagram construction to enhance documentation and communication? Rapid prototyping? Reduced learning curve of Java?) What "builder tools" are we talking about? (Eclipse? IntelliJ IDEA? javac and ant are "builder tools" but do they support the referenced "visual manipulation"? Do these builder tools inherently know what qualifies as a JavaBean through static code analysis? Is reflection involved in any of this?) Third, are JavaBeans standard practice? (Are they coming into or going out of favor with mainstream developers? With leading-edge developers?) Fourthly, how do JavaBeans relate to other technologies or patterns? (Are they used in distributed computing? Do they support component-proxying? What is the relationship to Enterprise JavaBeans?) Lunalot (talk) 17:10, 28 July 2011 (UTC)

Naming convention[edit]

To my knowledge boolean properties are capitalized the same way as other types. Compare Sun's JavaBeans spec [[1]] and the java.beans.Inspector.decapitalize(String) method. - leo 03 August 2012 — Preceding unsigned comment added by 80.218.115.95 (talk) 22:05, 2 August 2012 (UTC)

Serializable classes[edit]

Should serializable classes have a line like "private static final long serialVersionUID = 7526471155622776147L;" I think I read that the serialVersionUID should be declared for serializable classes. Is this different for beans? Just a thought. hi —Preceding unsigned comment added by 203.197.25.11 (talk) 12:01, 6 September 2007 (UTC)

Reusability[edit]

What about a JavaBean makes it any more reusable than any other class or class hierarchy? A naive reader might think that all classes can be manipulated in a builder tool, so the article should say what the limitations of a non-bean might be. If merely adhering to the conventions makes it reusable - then please say so - and mention the use cases where it is more reusable than any other class. Might also help to say whether Enterprise JavaBeans are a subset of JavaBeans. --Hroðulf (or Hrothulf) (Talk) 08:48, 4 October 2007 (UTC) —Preceding unsigned comment added by Hroðulf (talkcontribs)

Picture[edit]

I like the example, but it would be nice to see a picture of the output. 138.162.8.58 (talk) 14:01, 20 May 2009 (UTC)

Needs a rewrite…[edit]

I think that some of this page's writers were misinformed. First of all, the article should be on the technology, JavaBeans, not on the individual software components. Second of all, the components are called beans, not JavaBeans. So, if not referring to the component model, JavaBeans, this page should be called Bean (Java). Just my opinion. --I'm Jake9 "Da' Pie!" 05:10, 17 November 2009 (UTC)

The write once run anywhere advantage is too broad[edit]

"A Bean obtains all of the benefits of Java's "write once, run anywhere" paradigm."

Any code written in Java enjoys this benefit (on most OS's). This benefit is not specific to beans. — Preceding unsigned comment added by 217.37.69.169 (talk) 15:53, 29 May 2012 (UTC)

Yeah! Computer science – a world of boasting slogans, without any coherent terminology. I detest it too! Rursus dixit. (mbork3!) 09:15, 21 November 2012 (UTC)

History?[edit]

When were JavaBeans invented? Have there been any major modifications to the concept since then? RenniePet (talk) 02:25, 23 July 2013 (UTC)