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

Business layer

 
Niclas ├ůstrand
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm currently working on URLyBird and have a question regarding the business layer and the use of RMI.

After reading some threads I've concluded that a common solution is to have one BusinessServices interface
that you extend two other interfaces from - LocalBusinessServices and RemoteBusinessServices (also extending Remote).
You then have two classes implementing those interfaces. If you use this approach you will end up with two classes
with almost identical code. The only difference is the exceptions that the methods throw. Or, am I missing something?

Niclas
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Niclas,

My both business service implementations had different code. I didn't have an interface with a lockCookie, so I had to identify each client in network mode (which was not needed in standalone mode). I remember having read a thread (not so long ago) about a rancher who made just 1 implementation and used them for standalone and network mode.

Kind regards,
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Niclas!

If you use this approach you will end up with two classes with almost identical code. The only difference is the exceptions that the methods throw. Or, am I missing something?


Hum... yes. It looks like these classes are knowing if the mode is local or remote. Try promoting some abstraction.
Please take a look here. I think it might be helpful!
 
Niclas ├ůstrand
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Roberto and Roel for you quick responses!

I thought I was missing something. I will write one business layer and use it in both network and alone mode.

Niclas
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Niclas,

Be sure to by-pass the network completely when running in standalone mode, otherwise you might risk an automatic failure (because you are violating a must requirement)

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic