• 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:

Business Layer, Factory and and Business Layer Search method

 
Ranch Hand
Posts: 221
Scala Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everybody,


I hope you all had a nice and Happy Merry Christmas.

I am almost finished with my Data class, I am able to persist and read a Database file I create
and I am able to run up to 1000 iterations the DataClassTest of Roberto Perillo without any deadlocks.


Now, after reading some of the multiple threads in this wonderful forum, I need to continue my assignment
but I am unclear about a few things.

I want to write a Business Layer where I will have 2 methods:
- Book a Room.
- Search for all records or for records where the name and/or location exactly matches values specified by the user.

These 2 methods will be the only ones exposed to the GUI client.

Writing this Business Layer I want to make my GUI client "thin".

I read Andrew Monkhouse's book and I have seen he uses a Factory for the DVDDatabase object.

This is my interface for URLyBird 1.1.3:




The questions I have and I am unclear about how to proceed are:

1. Do I need to create a Factory for my Business Layer object?
I suspect yes, but I am unsure if the signature of my lock() and unlock() methods offer any advantages as far as identifying
the clients which is why sometimes a Factory is needed.

2. Do I need to create a Factory for my Data Object? I suspect the answer is no.

3. I have seen some folks here describing the Business Layer with an interface and this should be implemented
by a Local Services Object and by a Remote Object Services Object.
Not quite clear about why.
Would this accomplish the same effect as Andrew Monkhouse's Local and Remote DvdConnector in Denny's DVDs?

4. In The Business Layer search method I have seen some folks returning a List<Room> and others Map<Integer, Room>.
I guess this is relevant to how each person solves this? Or are there any advantages to returning one or the other?
I am aware this will be used by the JTable's TableModel in the Swing GUI.

5. I have seen some people talking about a SearchCriteria object that could possibly have 2 String attributes:
name and location.
Is this a valid approach? I am unclear about this also.
I was thinking when the user doesn't specify name and/or location or if
the user specifies name and/or location perhaps the command pattern could help perhaps with an Enum command
NOP, AND, OR but I have seen others talking about the strategy pattern.


Thanks in advance for your help.
Just want to continue making progress and trying to finish my assignment ASAP.


Happy New Year!


Carlos.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you publish your Business Leyer Interface by RMI or do you publish your DB Interface and create the BL on the Client?
 
Carlos Morillo
Ranch Hand
Posts: 221
Scala Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Daniel,


I still have not designed or implemented this, that's why I am posting these questions.

But I think if I want to make it a thin client I will have to publish
my Business Layer Object or Objects by RMI.


Thanks,


Carlos.
 
Daniel Breitner
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Funny thing: Today I also thought about that.
One reason why I didn't wanted to have a thin client was that changes on the client then would also mean changes on the server.
If the business functionality would reside on the client the server could stay as it is.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Daniel,

On the other hand: if you have to change business functionality when it resides at the client (for example: add a test to check if the record/room a CSR has selected is still the same record/room from database, to verify that the price for a night is not changed or maybe the night it's available has changed) you have to make this change and replace all your clients with this new version. When this business logic is at the server (thin client) then you just need to expose a new version of your server (if you don't modify the signature of your business methods of course) instead of replacing all the clients.
So it's just one of the decisions you have to make and explain it in choices.txt

Kind regards,
Roel
 
Daniel Breitner
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... and your solution also reduces network traffic.
 
Yes, my master! Here is the tiny ad you asked for:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic