Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesJavaBeans: Cross-Platform Components


January 1997 / Cover Story / Today the Web, Tomorrow the World / JavaBeans: Cross-Platform Components

Yes, JavaBeans are another grating coffee pun. They're also prewritten software components that make it easier to build Java programs.

Beans are to Java what OCX/ActiveX objects are to OLE and Live Objects are to OpenDoc. Some Beans are visual components that you add to forms in visual-development tools; other Beans are faceless objects that do something in the background. A Bean could be a cartoon or a piece of business logic. You could build a simple Java applet by assembl ing a bunch of Beans without doing any programming, or you could wrap some Beans in thousands of lines of proprietary code to build a sophisticated enterprise application.

Because Beans are written in Java, they have two big advantages: They're cross-platform, and they're relatively easy to write. ActiveX objects and Live Objects are platform-specific binary files that are more difficult to write. (Beans are just specialized Java class files. In fact, all Abstract Windowing Toolkit [AWT] components are automatically Beans, because AWT in JDK 1.1 adopts the new JavaBeans event model. Anybody who has written a visual component that subclasses an AWT object has already written a Bean. Few have accidentally written an ActiveX control or a Live Object.)

ActiveX and OpenDoc supporters often refer to their objects as "cross-platform," but they're really multiplatform: Someone has to port every object to every platform. Some platforms get more attention when it comes time to allocate precious development resources.

Beans are based on existing Java objects, with four new features. JavaSoft defines a Bean as any Java object that implemen ts at least one of these features.

Introspection/reflection lets a Bean expose its data structures to other programs and to programmers. For example, a development tool could have an object inspector that lets a programmer examine a Bean's methods, instance variables, properties, and interfaces.

A new event mechanism streamlines event handling and works with AWT components. (Java still supports the existing handleEvents() method for backward compatibility.) Because the new model uses less indirection and is more strongly typed, it's much more efficient, especially for high-frequency events like mouse movements.

Serialization/persistence lets Beans permanently remember changes to their properties. Currently, objects always revert to their default properties.

Interoperability lets Beans work anyplace where ActiveX objects or Live Objects can work. You could use a Bean with Visual Basic or in an OpenDoc container such as ClarisWorks. The bridging techn ology does practically all the work, so Bean authors have to write little or no code to get OLE and OpenDoc compatibility. JavaSoft already has some existing Java applets working with Visual Basic.

Beans will lead to better Java development tools and will open up a lively market for prefab components. They'll also speed up Java's evolution, because third parties can create Beans that fill some of the gaps in Java's capabilities.


Inside Java Beans

illustration_link (35 Kbytes)


Up to the Cover Story section contentsGo to previous article: JavaBeans: Cross-Platform ComponentsGo to next article: Plugs for Java's Security HolesSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network