Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extending Vs Modifying Data Class

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am a bit confused about the following requirement

Part of your assignment will be to enhance the Data Class. You may do this by modification or subclassing, but you should document the approach and reason for your choices.

I think when I change the deprecated methods in the Data class I am enhancing the Data class. I am also planning to have a common interface DataAccess that has all the methods of the Data class. So in this case will I be subclassing the Data class? Also does the Data Class have to implement the DataAccess interface?
Thanks
-Amish
 
Bernhard Woditschka
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think modifying the deprecated code is maintenance as it preserves the signature and behaviour of the Data class.
Adding the new functionality (lock, unlock, criteriaFind) is a different topic.
Bern
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So regarding lock, unlock and criteriaFind I have two options.
1) Is change the Data class and add these methods to it.
2) Extend the Data class and add these methods to a subclass to the Data.
Is this what you mean?
-Amish
Originally posted by Bernhard Woditschka:
I think modifying the deprecated code is maintenance as it preserves the signature and behaviour of the Data class.
Adding the new functionality (lock, unlock, criteriaFind) is a different topic.
Bern
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help!
 
Bernhard Woditschka
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not exactly.
What I tryed to say is:
Step 1) you just 'maintain' (i.e. modify the existing Data class) and replace depricated code, add/correct javadoc...
Step 2) You decide wheather to add new functions by changing the class or subclassing it
Step 3) You implement the new funcions in the Data class or a subclass.
The important part is that Step 1 is maintenance of the ecisting class and Step 2 & 3 is extending the functionality.
Hope this helps
Bern
[ January 22, 2003: Message edited by: Bernhard Woditschka ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic