🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16588

Re: JavaBeans vs Java

#16588
From: Thomas Heiss
Date: Thu, 28 Jan 1999 00:00
254 lines
12290 bytes
--------------EFD9F1ED76A713F405919390
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Peter,

JavaBeans are just java classes.
Nothing else more.
So cross-platform compatibility is given with JavaBeans too!

The difference is, that they are components (like an JButton in Swing).
Each component knows itself, how to act with the user.

There are four columns, where JavaBeans are based on:
Instrospection / Reflection
Event Handling
Customization
Persistence

Introspektion means, that when you are dropping an component like an JButton
into your Visual IDE,
you get popups for each property, the component has.
Just for notice,
variables are called in JavaBeans properties, which can be readable,
writeable, indexed, bound and constraint.
When you have an property that is readable, writable and bound for instance
you have two methods:
setName(Type typevar), Type getName(), and an event which is fired, when the
value of the property is changed.
So when you call setxxx(Type xxx) the property will change and you receive
an event, that it has been changed.

An  JavaBean which can consist of more than one JavaClass acts like an
Blackbox.
The JavaBean knows how to handle all its objects and how to communicate with
each class.
But as the developer you normally use JavaBeans, you don't want to know, how
for instance an FtpBean
creates an Socket.

You just see the interface with it's several methods like connect(String
hostname, int port) and you can use it.
The whole interface is described as an additional class, so when you have an
main class called Ftp you have
an additional class called FtpBeanInfo, where all properties, event's and
public methods are declared in.

When you drop for instance an FtpBean into your IDE, you can right click on
the Bean, and an Property-Editor appears,
where you can modify the properties like hostname, port, logging , and so
on.

If you as a developer from the JavaBean doesn't want to write an extra
BeanInfo class you can use the standardization,
which defines how methods have to be written, what names you have to give
them.
If your IDE couldn't find an BeanInfo class, it will try to look in the
bytecode and find all the things for itself.

When you have already programmed Java with an IDE you know, that you can
receive events.
You register on an Button as an listener, and when the event like the Button
was pressed happens,
the source ( the button) calls an method called actionPerformed on your
programm, and you can implement here
the behavior, what should happen when the event appears.

The last interesting thing is called Persistenz.
You can save the behavior from the Bean, which you have customized in your
IDE outside the development
and whenever you are using this Bean again, all the properties have the
value, which you have given to them.
So you serialize the Bean to an HDD.

Abstraction

An JavaBean is an component which you use, so you don't have to implement
the same behavior every time.
An JavaBean acts like an Blackbox, you don't know how the Blackbox is doing
but you probably know WHAT
the Blackbox should do.

E.g an car
you just stop on the gas and you know that it will speed up. But it is not
interesting for you, how the car get's its speed.

You can customize an JavaBean inside an IDE visually with an
Property-Editor, which popups, when you click on the JavaBean.
You can register events on an JavaBeans and you (the defined method in your
application) get's called when the event happens.

Why would you program an JavaBean or why would you use it ?
You will program an JavaBean when you want to encapsulate an complex
behavior and eventually sell it for other developers.
You will use it and you HAVE to use JavaBeans in Java, because every visual
class like an Button, an Listbox is already implemented since
JDK 1.1 as JavaBean.

The good thing on JavaBeans is, that you can buy one, when you need special
functionality.
When you are under pressure because your project has to finish in two weeks
and and you have to implement SSL into your application
because it has to be save, you really want program the whole SSL and you
neither want to spend hours for that. You will never have the
time in an project to implement everything new. You don't have 1 year for an
real project.
So what you do ?
You look on several manufactures ask them if they have already implemented
SSL, buy the Bean and just use it.
E.g you will propably call the methods encryptNowTheData(),
sendEncryptedDataToServer() and you don't have to be aware what
happens on the underlying layer.

Hope i could help a little bit.
If you have any other more questions, feel free to post them here.

Thomas Heiss



Peter Immarco wrote:

> Hello,
>
> Pardon this extreme novice question but I am just getting started in the
>
> world of Java.  What is the difference between JavaBeans and Java:
>
> Are they completely different animals or are they interrelated?
> When would you use one or the other, pros and cons?
> I know what tools are used to create Java apps, what about JavaBeans?
> Lastly, cross-platform compatibility issues of JavaBeans?
>
> Thanks,
> Peter.

--------------EFD9F1ED76A713F405919390
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Peter,
<p>JavaBeans are just java classes.
<br>Nothing else more.
<br>So cross-platform compatibility is given with JavaBeans too!
<p>The difference is, that they are components (like an JButton in Swing).
<br>Each component knows itself, how to act with the user.
<p>There are four columns, where JavaBeans are based on:
<br>Instrospection / Reflection
<br>Event Handling
<br>Customization
<br>Persistence
<p>Introspektion means, that when you are dropping an component like an
JButton into your Visual IDE,
<br>you get popups for each property, the component has.
<br>Just for notice,
<br>variables are called in JavaBeans properties, which can be readable,
writeable, indexed, bound and constraint.
<br>When you have an property that is readable, writable and bound for
instance you have two methods:
<br>setName(Type typevar), Type getName(), and an event which is fired,
when the value of the property is changed.
<br>So when you call setxxx(Type xxx) the property will change and you
receive an event, that it has been changed.
<p>An&nbsp; JavaBean which can consist of more than one JavaClass acts
like an Blackbox.
<br>The JavaBean knows how to handle all its objects and how to communicate
with each class.
<br>But as the developer you normally use JavaBeans, you don't want to
know, how for instance an FtpBean
<br>creates an Socket.
<p>You just see the interface with it's several methods like connect(String
hostname, int port) and you can use it.
<br>The whole interface is described as an additional class, so when you
have an main class called Ftp you have
<br>an additional class called FtpBeanInfo, where all properties, event's
and public methods are declared in.
<p>When you drop for instance an FtpBean into your IDE, you can right click
on the Bean, and an Property-Editor appears,
<br>where you can modify the properties like hostname, port, logging ,
and so on.
<p>If you as a developer from the JavaBean doesn't want to write an extra
BeanInfo class you can use the standardization,
<br>which defines how methods have to be written, what names you have to
give them.
<br>If your IDE couldn't find an BeanInfo class, it will try to look in
the bytecode and find all the things for itself.
<p>When you have already programmed Java with an IDE you know, that you
can receive events.
<br>You register on an Button as an listener, and when the event like the
Button was pressed happens,
<br>the source ( the button) calls an method called actionPerformed on
your programm, and you can implement here
<br>the behavior, what should happen when the event appears.
<p>The last interesting thing is called Persistenz.
<br>You can save the behavior from the Bean, which you have customized
in your IDE outside the development
<br>and whenever you are using this Bean again, all the properties have
the value, which you have given to them.
<br>So you serialize the Bean to an HDD.
<p><b><u>Abstraction</u></b>
<p>An JavaBean is an component which you use, so you don't have to implement
the same behavior every time.
<br>An JavaBean acts like an Blackbox, you don't know how the Blackbox
is doing but you probably know WHAT
<br>the Blackbox should do.
<p>E.g an car
<br>you just stop on the gas and you know that it will speed up. But it
is not interesting for you, how the car get's its speed.
<p>You can customize an JavaBean inside an IDE visually with an Property-Editor,
which popups, when you click on the JavaBean.
<br>You can register events on an JavaBeans and you (the defined method
in your application) get's called when the event happens.
<p>Why would you program an JavaBean or why would you use it ?
<br>You will program an JavaBean when you want to encapsulate an complex
behavior and eventually sell it for other developers.
<br>You will use it and you HAVE to use JavaBeans in Java, because every
visual class like an Button, an Listbox is already implemented since
<br>JDK 1.1 as JavaBean.
<p>The good thing on JavaBeans is, that you can buy one, when you need
special functionality.
<br>When you are under pressure because your project has to finish in two
weeks and and you have to implement SSL into your application
<br>because it has to be save, you really want program the whole SSL and
you neither want to spend hours for that. You will never have the
<br>time in an project to implement everything new. You don't have 1 year
for an real project.
<br>So what you do ?
<br>You look on several manufactures ask them if they have already implemented
SSL, buy the Bean and just use it.
<br>E.g you will propably call the methods encryptNowTheData(), sendEncryptedDataToServer()
and you don't have to be aware what
<br>happens on the underlying layer.
<p>Hope i could help a little bit.
<br>If you have any other more questions, feel free to post them here.
<p>Thomas Heiss
<br>&nbsp;
<br>&nbsp;
<p>Peter Immarco wrote:
<blockquote TYPE=CITE>Hello,
<p>Pardon this extreme novice question but I am just getting started in
the
<p>world of Java.&nbsp; What is the difference between JavaBeans and Java:
<p>Are they completely different animals or are they interrelated?
<br>When would you use one or the other, pros and cons?
<br>I know what tools are used to create Java apps, what about JavaBeans?
<br>Lastly, cross-platform compatibility issues of JavaBeans?
<p>Thanks,
<br>Peter.</blockquote>
</html>

--------------EFD9F1ED76A713F405919390--
Technical Details
Message-ID: <36B08CC8.F19D2CE1@quelle.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36B07DFC.31709EE4@micron.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f4581,7946fb99f038ef31
X-Google-Attributes: gidf4581,public
X-Google-Thread: 108bbb,7946fb99f038ef31
X-Google-Attributes: gid108bbb,public
X-Google-Thread: f5d71,7946fb99f038ef31
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 100145,7946fb99f038ef31
X-Google-Attributes: gid100145,public
X-Google-Thread: f74b3,7946fb99f038ef31
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 114aa0,7946fb99f038ef31
X-Google-Attributes: gid114aa0,public
X-Google-Thread: f5e83,7946fb99f038ef31
X-Google-Attributes: gidf5e83,public
X-Google-Thread: 10a146,7946fb99f038ef31
X-Google-Attributes: gid10a146,public
From: Thomas Heiss <Thomas.Heiss@quelle.de>
Subject: Re: JavaBeans vs Java
Date: 1999/01/28
Message-ID: <36B08CC8.F19D2CE1@quelle.de>
X-Deja-AN: 437975611
References: <36B07DFC.31709EE4@micron.net>
X-Accept-Language: en
Content-Type: multipart/alternative; boundary="------------EFD9F1ED76A713F405919390"
Organization: Customer of UUNET Deutschland GmbH, Dortmund, Germany
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language,comp.lang.java.programmer,comp.lang.java.softwaretools,comp.lang.java.corba,comp.lang.java,ibm.software.vajava.language,ibm.software.vajava.enterprise,microsoft.public.java.visualj++