|
ur Java
class this semester was a seminar where students paired up and each
pair taught a special topic. Anders Ramsay and I taught our class
the basics of Java Beans. (In case you want to know, JBs
are "reusable software components" -- they're supposed
to make programming a lot easier and quicker.)
s we had
a small class, Anders and I thought it would be cool to do a class
project together. Each person would program one part of the whole
application, then we would stitch them all together at the end and
all the components would magically work together. Well, things did
work out okay in the end (despite a lot of frustration and last-minute
work) -- but it wasn't quite as smooth as we'd hoped and we ran
into some limitations of the Java language. Still, it was a good
project and we learned a lot about working together and Java Beans.
o prove to the class that the product
of this concurrent, multi-person project was possible, I programmed
a partially functional prototype in an evening. The applet demonstrates
how all the pieces were supposed to work together. Each of the various
windows you see has some application logic below it, and each has
to communicate with a simple database on the back end (non-functional
here).
his applet
also uses an innovation Anders and I thought up -- a "Style
Bean". To maintain some consistency in look and feel across
6 people's programming efforts, we conceived of the Java equivalent
of Cascading Style Sheets. That is, the Style Bean is a central
repository for the look and feel aspects of the user interface elements
-- colors, fonts, and sizes. And if we decided in the future to
change the color scheme for the entire applet, for example, we could
do it quite easily by changing the code in just one place. While
the Style Bean normally would not be made visible, I programmed
one that could be made visible just so that my classmates would
have an idea of how their final product might look.
n another
effort to make things easier for my classmates, I programmed a simple
error window that they could use to send messages to the
user if there was a problem. For example, if there were a login
problem, or if a user forgot to fill out a required field. Without
needing to read the source code, my classmates were supposed to
be able to use the error window by simply creating an instance of
the error window and setting 3 variables (since it, too, is a bean).
(See the Error Window's source code. The Error Window has since
been improved substantially. Contact me for more details.)
ee the
Style Bean and Error Window demo
applet in action! Source code is available for these,
as well.
s mentioned
above, the applet below is a partially functioning demonstration
only. It was simply meant to prove to the class that this project
was feasible and it could get its look and feel values from the
Style Bean. That said, give it a try!
he book
Anders and I used to prepare for this project is "JavaBeans
Programming from the Ground Up." We both like it a lot and
highly recommend it if you'd like to learn more about Beans. The
author, Joseph O'Neil, writes in an approachable and easy-to-understand
style, and focuses on developing professional, production-quality
Beans. For more information, see its
listing on Amazon.com,
or go to the publisher's, Osborne, where
you can download code used in the book.
ake a
look at some of the JavaBeans application development products available.
They're suprisingly affordable, too. First is NetObjects
BeanBuilder (actually developed
by IBM/Lotus). There's a very positive review of it on C|NET called
"Cool
Beans". It's only
$99 for students! The other major product is called Java
Studio from Sun. You can
read a good review of it on C|NET called "Java
for everyone." This
product is also surprisingly affordable.
|