File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes whats the pros and cons of modifying and sublassing data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "whats the pros and cons of modifying and sublassing data" Watch "whats the pros and cons of modifying and sublassing data" New topic
Author

whats the pros and cons of modifying and sublassing data

Lisa Foster
Ranch Hand

Joined: Feb 28, 2001
Posts: 116
Thanks Lisa
Catherine McManus
Greenhorn

Joined: Oct 23, 2000
Posts: 19
I haven't got very far with my project yet, but I can't at the moment see any reason for subclassing data. The additions required do not replace or change any existing methods.
I would be interested to hear from anyone who could argue in favour of subclassing.
Catherine
ruilin yang
Ranch Hand

Joined: Feb 25, 2001
Posts: 334
I favor to modify rather than subclass.
However, the advantage of subclassing is:
1) small code, so easy to read.
2) better performance in case of object lock (parent and subclass
both have synchronized methods)
Please make more comments on the topic or correct mine.
Ruilin
Glenn Opdycke-Hansen
Ranch Hand

Joined: Feb 16, 2001
Posts: 40
Modify when there is a problem with the class--bad method signature, import statement wrong, ...
Extend to create a derived class that "is-a" base class (to use the oo terminology), but has variations in the method behavior.
For example, I created a DataClientLocal class that extends the DataClient class. It has the same methods, but instead of accessing the database remotely, it uses local access.
------------------
--glenn


--glenn
 
wood burning stoves
 
subject: whats the pros and cons of modifying and sublassing data