Home arrow static arrow Java Programming [Archive] - Common Classes
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Common Classes
This topic has 20 replies on 2 pages.    1 | 2 | Next »

Posts:349
Registered: 1/8/04
Common Classes  
Jul 22, 2004 7:05 AM



 
I'm just wondering if there's a resource anywhere with commonly written classes?
I imagine many of us have written Person.java (or Party.java), Address.java, Account.java, OrderItem.java... etc.java, etc.java.

It seems that there might be somewhere out there a big listing of these classes to prevent so much duplicated effort. Does anyone know of one? Or do you think that these classes are generally too situation-specific to reuse?
 

Posts:196
Registered: 6/29/04
Re: Common Classes  
Jul 22, 2004 7:24 AM (reply 1 of 20)



 
Should the Person class have an attribute stating whether or not they have frosted hair?
 

Posts:196
Registered: 6/29/04
Re: Common Classes  
Jul 22, 2004 7:25 AM (reply 2 of 20)



 
Should the Person class have an attribute stating whether or not they have frosted hair?

Because that's an attribute I need for my beauty palor app.
 

Posts:24,036
Registered: 2/3/03
Re: Common Classes  
Jul 22, 2004 7:27 AM (reply 3 of 20)



 
I'm just wondering if there's a resource anywhere with
commonly written classes?
I imagine many of us have written Person.java (or
Party.java), Address.java, Account.java,
OrderItem.java... etc.java, etc.java.

http://www.helpjavanewbieswithhomework.com

;o)
 

Posts:349
Registered: 1/8/04
Re: Common Classes  
Jul 22, 2004 7:30 AM (reply 4 of 20)



 
Should the Person class have an attribute stating
whether or not they have frosted hair?

Around here it's a given. No use coding attributes that are always true...
 

Posts:31,095
Registered: 4/30/99
Re: Common Classes  
Jul 22, 2004 8:17 AM (reply 5 of 20)



 
They are too situation-specific. Unless you are Oracle or SAP (if they are writing their applications in Java) in which case they are massive classes that try to be all things to all businesses.
 

Posts:349
Registered: 1/8/04
Re: Common Classes  
Jul 22, 2004 10:16 AM (reply 6 of 20)



 
Oh well. So much for reusable code. I heard so much about the benefits of OOP when I started learning java. "You can reuse your classes," they said. Fat chance.

They (the official anonymous "They") also talked about integrating behavior and data. Classes acted more like the real world than C's functions and structs could. But I keep seeing so much code that has data objects and control objects. To my mind a class of attributes, getters and setters is little better than a struct. And a class of methods to apply business rules to data objects, is just a bunch of methods.

Whatever. I like java. I like object oriented programming.
I guess I'm just trying to distract myself from the code problem I've been trying to track down for the last three hours.
 

Posts:24,036
Registered: 2/3/03
Re: Common Classes  
Jul 22, 2004 10:30 AM (reply 7 of 20)



 
I guess I'm just trying to distract myself from the
code problem I've been trying to track down for the
last three hours.

What's the problem? Perhaps we can help...
 

Posts:37,103
Registered: 3/30/99
Re: Common Classes  
Jul 22, 2004 10:41 AM (reply 8 of 20)



 
Oh well. So much for reusable code.
I heard so much
about the benefits of OOP when I started learning
java. "You can reuse your classes," they said. Fat
chance.

So the fact that there isn't a publicly available library of Person, Account, Address, etc. classes that are universally applicable means code reuse is a myth? Sounds just a tad extreme.

They (the official anonymous "They") also talked about
integrating behavior and data. Classes acted more like
the real world than C's functions and structs could.
But I keep seeing so much code that has data objects
and control objects. To my mind a class of attributes,
getters and setters is little better than a struct.

This is true. There's a lot of Java code out there that isn't pure OO. But then, Java's not really intended to be a pure OO language. Sometimes simple data containers are appropriate. And very often they're not, but inexperienced developers create them anyway.

There's a lot of bad Java code around. But there's good code around too. OO and Java offer the potential for reuse, better (but not perfect) modeling, etc., but you still need people with the skills to use the tools.

I guess I'm just trying to distract myself from the
code problem I've been trying to track down for the
last three hours.

I can identify, although I'd be more inclined to look for a code problem to distract me from the less pleasant aspects of my job. :-)
 

Posts:349
Registered: 1/8/04
Re: Common Classes  
Jul 22, 2004 10:51 AM (reply 9 of 20)



 
I'm learning Hibernate. I'm using it to persist the domain objects in a project started a while ago. I broke something I had working before. Which I could have tracked easily if I had been running all of my test cases instead of just the ones for the new stuff. I was stupid - made a stupid assumption.

Hibernate seems to written around the idea that you would write data objects and manipulate them with control objects. My domain is not like that - though it's changing to adapt. I'm trying to learn how to do things that seem like outside cases without a grasp of what Hibernate is actually doing. And it's doing what it's doing to make things easier for people who aren't doing what I'm doing. The "lightweight" Hibernate feels like it's got four tons of code, caching and session management that are in my way. The examples, tutorials, documentation and book I have all nicely cover simple cases and then briefly mention that you can do other things - things I need to do. But I'm trying to get it, because it's going to be good for me in the long run. I'm going to get it, but normally it doesn't take me this long or cause this much grief to get up to speed.

At this point, I don't even know how to explain the problem other than saying "I can't delete all the Parties" and posting thousands of lines of code, tests and Hibernate mapping files.

Thank you for your offer to help. Right now, venting a little is helping a great deal.
 

Posts:24,036
Registered: 2/3/03
Re: Common Classes  
Jul 22, 2004 10:54 AM (reply 10 of 20)



 
I understand about Hibernate difficulties. I think it's a great tool, but it's been tough to adapt it to some non-standard data access layers in my applications (LDAP, etc.), especially so, considering the above-average thickness of my cranial casing.

Hibernate doesn't feel "lightweight" at all, but it HAS been handy. :o)
 

Posts:349
Registered: 1/8/04
Re: Common Classes  
Jul 22, 2004 11:02 AM (reply 11 of 20)



 
So the fact that there isn't a publicly available
library of Person, Account, Address, etc. classes that
are universally applicable means code reuse is a
myth? Sounds just a tad extreme.

I'm not being 100% reasonable right now :-)

I've noticed this even more with XML. Specifically with people touting it as the "universal file format." I thought "Great, I'll go download the Universal File Format for newspaper articles." I was deceived. XML is a way you can create your own file format to do whatever you want - and thereby make it incompatible with everyone else who wants to do the same thing.

I'm just ranting now. What does XML have to do with anything?
 

Posts:37,103
Registered: 3/30/99
Re: Common Classes  
Jul 22, 2004 11:04 AM (reply 12 of 20)



 
I haven't had much trouble with hibernate, but it did take a while to get things tweaked to work just right. Plus I had the luxury of starting fresh--new database, new classes, entirely new project. The project I'm working on now though is an enhancement, and I was thinking of bringing Hibernate in. I kinda sorta wondered whether it would be more difficult to add it after the fact like this, and I'm hearing that that may in fact be the case.
 

Posts:37,103
Registered: 3/30/99
Re: Common Classes  
Jul 22, 2004 11:05 AM (reply 13 of 20)



 
I'm just ranting now. What does XML have to do with
anything?

Well XML is what Hiber uses for its config files, right?

IT'S A CONSPIRACY! AN EVIL PLOT I TELLS YA!
 

Posts:349
Registered: 1/8/04
Re: Common Classes  
Jul 22, 2004 11:06 AM (reply 14 of 20)



 
I understand about Hibernate difficulties. I think
it's a great tool, but it's been tough to adapt it to
some non-standard data access layers in my
applications (LDAP, etc.), especially so, considering
the above-average thickness of my cranial casing.

Hibernate doesn't feel "lightweight" at all, but it
HAS been handy. :o)

I'm going through phases with it. When it's working (ie: when I'm using it correctly), it's brilliant, painless and almost magical. Then I break something and it becomes heavy, arcane, misdirected, and impossible to troubleshoot.

Thank God for the forums. Nobody around knows what I'm talking about.
 
This topic has 20 replies on 2 pages.    1 | 2 | Next »