• 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

design problem

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am having I design problem, and it�s as following.

In implementing Data class I needed public methods not found in DB interface, and that's create maintainability problem if I want in the future to replace the Data class, I can continue my work with the following Decisions:

1-Let the other objects communicate with Data class interface not DB.
Data data = new Data();
Not DB data = new Data();
ant that's creates a problem with maintainability, some of the classes will depend on my new public methods.

2- Create an Interface extends DB interface (DBExtended) and let Data implements DBExtended, by that I don�t think I am breaking the rule "must implement DB interface" because by implementing DBExtended I am implementing DB (not sure) .

3- Remove the public methods, witch will effect my whole design and remove many of the good thing about it.

4- using an Adapter class, and this choice can't be done, because some of public methods I need, has to communicate directly with data file, such us getSchema().


as I see it the second choice is best one, but the MUST word makes me hesitates.




any second Opinion.
[ June 10, 2004: Message edited by: Omar Kalaldeh ]
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Omar,

With option 2, your data class will still meet the rule that it implements the interface.

Alternatively you might want to consider what it is that the Data class provides, and then decide whether your other methods truly belong in the Data class. You may find that it may make more sense to move your extra methods to some other class which your server and standalone client can call.

Regards, Andrew
 
Omar Kalaldeh
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andrew,

Thanks for your reply, but I just want to be sure, do you know any one has extended the DB interface and succeed in the assignment.

I hate to fail in the assignment for trying to make my design more general.

As for your suggestion to add the new methods in class other than Data, that not possible because the method I need has to talk directly with file.
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Omar,

There were several people saying that they were creating their own interfaces which extended the provided interface about 6 months ago and they have since passed.

Regards, Andrew
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, omar

your option 2 is ok, I have the same problem the last week, and I asked the Sun, they reply me that is OK.
 
Omar Kalaldeh
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi yang,

Thank you very much, now I can start implementing my design, and I am relieved.
reply
    Bookmark Topic Watch Topic
  • New Topic