Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use Inheritance instead of containment

 
Ziji (Jay) Zhang
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have read some threads here discussing which approach is better, letting the client do the lock/unlock, or just providing "bulk" methods such as book()/find(), and hiding Data class methods from client?
I prefer letting client do the lock/unlock, that way, client has the control, much like the way ADO.NET's transaction is implemented.

On the other hand, just for the sake of finishing the assignment, I may implement bulk methods on the server side, since it is easy to do the testing, when book() method existed on the server side.

In order to have both, I have this approach, it may not be new.

Data class still implements DBMain, (those two are required classes by Sun)

I defined a DBClient interface that extends DBMain, DBClient has
Book() method. Then I have a DBClientImpl class on the server side which is defined,

public class DBClientImpl extends Data implements DBClient {

}

That way, client can use book, or use lock /unlock.
Thanks for any comment!

Ziji
 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ziji Zhang:
HI,

That way, client can use book, or use lock /unlock.
Thanks for any comment!

Ziji


Hi Ziji,

I wouldn't keep hanging on two strategies. I think it is much more clear and straightforward to choose either one or the other. Remember that one of the instructions of the assignment is to keep things simple. Using two different strategies together only doubles your chances of loosing points.
 
Ziji (Jay) Zhang
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rinke,

Thanks for the comments.
I think I will go with Adapter/wrappter approach, and hide the lock/unlock from the client.

Ziji
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic