• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

whats the pros and cons of modifying and sublassing data

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lisa
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic