This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(SOLVED) Can I wrap low level DB interface with higher level Facade?

 
Colin Yates
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

The DB interface has lock, doSomething, unlock methods which obviously should be called in a single atomic action.

Is it valid to expose a higher level Facade with "reserver(int rowNumber)" to the client, and leave the DB interface on the server.

To be clear, my Facade would actually be the network aware object, which delegates to the DB interface (ok, and implementation of the DB interface) on the server side.

Thanks,

Col
[ February 25, 2005: Message edited by: Colin Yates ]
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Colin,

What you are suggesting, is the so-called "thin-client" and it has been debated here numerous times before. The general opinion is that it is allowed (although I personally feel that it's a bit like cheating, because it allows you to avoid most of the locking difficulties).

BTW, I disagree with your statement that lock-do something-unlock must be done in an atomic action. IMHO the lock and unlock are there, exactly for the purpose of not needing an atomic action. When a record is locked, it cannot be changed by other threads, so anything you do with it, is sort of atomic.

Frans.
 
Colin Yates
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frans,

Thanks for replying (again ).

I meant that in most client-server apps, locking/doSomething/unlock is usually done server side. It would be most unusual to allow a client to lock and unlock a record.

Of course, my background is J2EE apps, where as you say, thin clients delegate all functionality to the business layer middle tier. Maybe you are right that we are not supposed to be designing a seperate business layer.

Hmm. Will need to think about that one. It just feels "wrong" to allow a client to lock and unlock, but that might just be my J2EE experience talking

Thanks again Frans.

Col
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fully agree with your arguments, Colin. My furst hunch was too to design a thin-client. But after thinking more about the purpose of locking (and discussing it here), I have defected to the fat-client side

(Don't underestimate the power of the fat side )

Frans.
 
Colin Yates
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, after reading the rest of these forums, I think you are right.

I think I will still have a Facade, but only on the client.

Cheers Frans.

Col
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Col,

In case you are interested, here is a really long discussion on the pros and cons of thin and thick clients.

Regards, Andrew
 
Colin Yates
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic