This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modify OR Extend Data class??

 
Bal Sharma
Ranch Hand
Posts: 273
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI There:
BK is here again. Light is coming on, but I am not sure 100% what path should I take? I see lots of people are modifying Data class very few people are arguing about extending Data class. If I am not mistaken we get robust code from extending class. I mean, we do not have to worry about if Data class is being used somewhere in other application. I know if it is real life situation NOT for this test.
If I modify Data class I got to submit both their existing Data class and Modified Data Class too. How can I have same two names in one directory? By the way which is easier? I am kind of lazy too. Any suggestions, tips, comments, observation are welcome. BK

[This message has been edited by Bal Sharma (edited November 10, 2001).]
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really have to submit the original Data with your assignment?
Two concepts to keep in mind when deliberating what to do with the Data class: responsibilities, and is-a vs has-a relationships.
A well-designed class has a coherent, clearly defined set of responsibilities. A well-designed system keeps on subdividing (factoring) the problem until it is modeled as a composition of such responsibilities. You need to establish what you think the responsibilities of Data are. That determines which bits of new functionality go into Data, and which bits go into a subclass or another object altogether. For example, isn't locking directly related to multi-user mode? Is providing multi-user facilities part of the responsibilities of Data? The answers dictate what to do with lock() and unlock().
It's so simple in theory: an is-a relationship is modeled using inheritance, a has-a relationship modeled using associations of some kind. Practice is more difficult (IMHO, when doubting between inheritance and association/composition, pick the latter. Inheritance is generally over-used). If you decide to keep networked, multi-user facilities out of Data, does the networked Data need to be a subclass? In other words, is a multi-user Data a type of Data? Or is it a different beast that implements the same interface? The answer is partly dictated by the way you choose to handle client identification.
- Peter
 
Bal Sharma
Ranch Hand
Posts: 273
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YES, my assignment instruction read as follows:
When you submit your assignment, you should provide following parts.

  • Full source and object code, including new classes, modified versions of supplied classes, and copies of supplied classes that were not modified. .....
  • Database db.db

  • I have confusion. If I modify Data class how can I have two files with same name inside one directory. Thanks for clarifaction. BK

 
Ian B Anderson
Ranch Hand
Posts: 275
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
It depends how you read the spec. Your spec said:
"...and copies of supplied classes that were not modified..."
Well if you modify it you don't need to send back the original Data class.
Or if you want you could create a directory within your final submission called something like original and put all original code there.
Ian
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Sun means is that if you use a supplied class as-is, you still submit it together with your own classes. If you modify the class, you just submit the modified version. You do not need to submit the unmodified class as well.
What it boils down to is that you need to give them a complete, working set of sources.
- Peter
 
Bal Sharma
Ranch Hand
Posts: 273
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnaks guys for clarification.
-Bal
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic