• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Extending vs Modifying the Data class

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Now i am at the stage of making documents and have been bogged down for several days.
I choosed modifying the Data class, but i really cant find out any cogent arguments to defend it. I cant see there's many advantages in modifying the calss than extending it, neither extending than modifying. i think either approach is acceptable and choosing this or that is just a very natural thing, doesnot involve much struggle. wonder why SUN attach so much importances on this point?
another problem, in some main aspects of the assignment such as Server Design and Client Design, I think something shoud be stated in the design choice file, but i really cant figure out what to say and how to start! What do you guys state in this aspect?
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For client design, you could write about how you implemented MVC, why you used combo boxes or text fields to enter search criteria, why you did or did not use a GUI to select local/remote mode, host and port,...etc.
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Robin
How about extending vs modifying the Data class?
Regards
James
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a hard time coming up with reasons to modify since I chose to extend. I guess you could say it is less complicated, and has better performance since there is less object creation.
[ July 21, 2002: Message edited by: Robin Underwood ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are synchronized methods from Data class inheritted when it is subclassed?
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also have modified the Data class. My reasons were:
* I think locking and searching are basic capabilities of a database. A database without them is quite useless
* Performance: if extending I can only use the Data public/protected interface. On the contrary, if modifying I can access private fields/methods that can make criteriaFind much faster
* Bug hunting: Data's javadoc was wrong, and some methods had bugs. So I had to modify Data anyway.
As an example:
Client Design:
* MVC? Yes/No Why? How?
* Facade to access the server?
* How did you deal with remote/local connection? Did you have a unique interface? Did you use Strategy pattern? How about RemoteExceptions?
* Multithreaded client?
* Exception handling/mechanism
* comboboxes or textfields? hardcoded airports, database read airports or nothing?
* search criteria: origin plus destination airports, or added carrier or more?
* internationalization?
Server design:
* locking mechanism:
- lock manager: yes/no
- how to identify client
- lock implement in local mode/remote mode
- database locking: lock(-1) / unlock (-1)
* exception handling/mechanism
* RMI vs sockets
* How do you deal with dead clients? Unreferenced?
* is your server capable of using one database or multiple databases?
* deadlock prevention
* did you use a Factory pattern to create connections?
* criteria find implementation
* Did you use a policy file? why?
* How did you deal with deprecated methods?
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eduard,
Your input is highly appreciated, they do give me a inspiring idea to start.
Could you elaborate the Strategy pattern you mentioned a little more? I never see someone use the pattern in the assignment, what's it for?
Regards
James
 
Eduard Jodas
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From "The design patterns Java companion" by James W. Cooper:
[The Strategy pattern is much like the State pattern in outline, but a
little different in intent. The Strategy pattern consists of a number of related
algorithms encapsulated in a driver class called the Context. Your client
program can select one of these differing algorithms or in some cases the
Context might select the best one for you. The intent, like the State pattern, is
to switch easily between algorithms without any monolithic conditional
statements. The difference between State and Strategy is that the user
generally chooses which of several strategies to apply and that only one
strategy at a time is likely to be instantiated and active within the Context
class. By contrast, as we have seen, it is likely that all of the different States
will be active at once and switching may occur frequently between them. In
addition, Strategy encapsulates several algorithms that do more or less the
same thing, while State encapsulates related classes that each do something
somewhat different. Finally, the concept of transition between different states
is completely missing in the Strategy pattern.]
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic