• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modifying vs. Extending Data class

 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,
In the required readme.txt, we are supposed to reason the choice of modifying vs. extending Data clas. I almost took it for granted to modify it without thinking of extending it. But how can I reason it? I found most of the people here are modifying it. Can someone give me some reasons or hints on explaining this?
Thanks,
Cathy
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well Cathy, Inheritence is a very important part of OOP. It is very powerful in many ways, but can also be used to do harm. It can be the dark side of the OOP world. It takes a lot of consideration when deciding when to use inheritence.
I think most people use it incorrectly, or are too quick to use it when there are more appropriate times to use it and times when it isn't necessary.
As we know inheritence is an "IS A" relationship. But an object itself "IS A" of itself.
Meaning Data Object "IS A" Data Object. Now I know this sounds obvious, but this is where deciding to Extend or Modify comes into play.
What are you doing to the Data class, are you making it a more specific type of Data, or are you just making some basic changes to it.
more specific lends to extending, making changes to modifying
Is Data being used outside this App? Meaning if you change the implementations will if adversely affect those other App. If it is then extending it would stop it from affecting the other app, as the other app will be using the original version that it already knows. Maybe changing the implementation will have no affect on the other App, and you can justify just modifying it.
It is really up to you. But those are some of the arguments you can pose to justify your decisions.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic