Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java web applications and jar files

Reply
Thread Tools

java web applications and jar files

 
 
bahamuto@yahoo.com
Guest
Posts: n/a
 
      01-18-2005
I have a question when it comes to java web applications and the use
of jar files. If I have several web applications that will be using
either the same or similar javabeans or just regular java classes in
the application, should I put these java classes in a jar file so that
they both get the class definition from that? The only other
alternative I can see is to create a copy of the class files for each
web application that needs that class, and that doesn't seem like good
OO to me.

Assuming that the best way to go on would be to put them in the jar
files, should I make the class object in the jar file javabeans, or
should I make them regular classes and make the javabeans more specific
to the application that they are needed for?

For instance lets say I have an object person who has the attributes:

name
ssn
eyecolor

If one application only needs name and eyecolor, and the other needs
name and ssn should I make this whole object a javabean, or should I
make two seperate javabeans in the the individual applications that
would only use the attributes it would use.
Thanks for any help in advance.

- Nathan

 
Reply With Quote
 
 
 
 
Tom Dyess
Guest
Posts: n/a
 
      01-20-2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...

> For instance lets say I have an object person who has the attributes:
>
> name
> ssn
> eyecolor
>
> If one application only needs name and eyecolor, and the other needs
> name and ssn should I make this whole object a javabean, or should I
> make two seperate javabeans in the the individual applications that
> would only use the attributes it would use.
> Thanks for any help in advance.
>
> - Nathan
>


Given this example, I would create a Person object with name and ssn, then
create a subclass AstheticPerson that inherits from Person and adds
eyeColor. Since I prefer jar files, I would put them both in a single jar
file and use Person for one application and AestheticPerson in another. If
you don't think you will ever use AestheticPerson in any other application,
I would just put Person in a jar file and inherit from it in the only
application that uses it. Of course, there are "100 ways to skin a cat," so
someone else would do something completely different. I would definitely
superclass the common parameters though, that's proper OOD.
--
Tom Dyess
OraclePower.com


 
Reply With Quote
 
 
 
 
vkvask@gmail.com
Guest
Posts: n/a
 
      01-20-2005
I don't know if subclassing is "proper OOD" - I think by now its widely
accepted to prefer encapsulation to inheritance.

My suggestion is to keep it simple - I don't see any need for keeping
name, ssn, and eyecolor separately. I would create one bean type with
both fields and share them between the two apps. Inheritance is
overkill for this situation!

 
Reply With Quote
 
Tom Dyess
Guest
Posts: n/a
 
      01-20-2005
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>I don't know if subclassing is "proper OOD" - I think by now its widely
> accepted to prefer encapsulation to inheritance.
>
> My suggestion is to keep it simple - I don't see any need for keeping
> name, ssn, and eyecolor separately. I would create one bean type with
> both fields and share them between the two apps. Inheritance is
> overkill for this situation!
>


Yes, I agree, but I thought it was a hypothetical simplistic example and not
what he was really doing. If that is all you are doing with the object,
inheritance is overkill.
---
Tom Dyess
OraclePower.com


 
Reply With Quote
 
bahamuto
Guest
Posts: n/a
 
      01-21-2005
Yeah it was a simplistic overkill example. The classes themselves
are not going to change, but I was just wondering if I should create
bean classes in the specific applications to only use the fields
specific to that web app.

- Nathan

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM
Jar files in Jar files Eric McIntyre Java 1 05-24-2004 07:24 PM



Advertisments