• 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

NX: the third layer.

 
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I saw many issues here that business layer class only has three methods: book, search, getMateInfo. how do you close the database in local mode?
I think it is convenient to add method close. Need your comment.
Best,
Damu
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Damu,
PS (first time that I start a post with a PS) : I just noticed when posting this that you deleted and recreated the thread I was replying to. So don't be surprised if I quote you from the previous one : I am too lazy to change them ...

I saw many issues here that business layer class only has three methods: book, search, getMateInfo.


Methods book() and search() for sure, but some getMetaInfo() not IMO, at least with that wide scope (see below).

How do you get the name & location values to fill the JComboBox(Contractor)? And how do you close the database in local mode?
I think it is convenient to add three more methods: readRecord, getRecordsCount, and close. Need your comment.


It seems obvious, but the purpose of a "business" tier is to give access to data and behaviours which fall in the immediate upper tier's business.
If your business tier starts with giving access to some part of the lower level datastore, your design is not 3-tier but 2.5-tier.
And the problem comes with the fact that you loose the main benefit of the 3 separate layers you had in mind : to get your upper layer 100% independant of the way - and where - data is stored. Think of redesigning your business tier interface till you can conclude :
OK, whatever will happen tomorrow at the data level :
  • we move from our single flat-file-system to a relational database
  • or we replace our binary flat-file by an XML file
  • or we now get data from a web service
  • or ... whatever a new way of storing and getting data will be invented tomorrow


  • (...), I'll don't need to change the business tier public interface (of course as far as the business needs don't change themselves).
    book() and search() methods represent business behaviours, or actions.
    What you'd like to get besides is some business information (I used the word information instead of data on purpose, to make clear that it has nothing to do with the DB-level data) :
    a list of the possible search criteria with, for each of them possibly a description, and for sure a list of all possible distinct values. All this could be carried in one object as the returned value of some getQueryInformation() business method.
    It's just an example, and you may have additional such "abstract" needs, but the main idea is there.
    Best,
    Phil.
    [ October 26, 2003: Message edited by: Philippe Maquet ]
     
    Bigwood Liu
    Ranch Hand
    Posts: 240
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hey Phil, I changed the post because I think the readRecord, getRecordCount is , as you said , 2.5 layer. So I deleted it. Thank you very much, you are a really cool man! I read your answer with this:
     
    Bigwood Liu
    Ranch Hand
    Posts: 240
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Phil,
    do you close the database from GUI? Then the third layer should have closeDatabase().
    I alse have getDatabaseInfo() as a business method.
    best
    damu
     
    Philippe Maquet
    Bartender
    Posts: 1872
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Damu,

    you are a really cool man!


    Hope I am ! It's quite tough to reply to questions you're not supposed to have posted !

    do you close the database from GUI? Then the third layer should have closeDatabase().


    No I don't. It's difficult to reply to that question, Damu, because I don't know exactly what you mean - in your design - by "closing the database".
    In my design, there is no logical relation between client connections to the server and the "open" state of the database. When the server starts, the database is opened once. After that first step, my server is listening for possible clients and keeps the database "open". Clients may then connect, disconnect, reconnect, do whatever they want, the database simply keeps its "open" state ... till the server shut down. (I simplify a bit on purpose).

    I alse have getDatabaseInfo() as a business method


    It's perfect IMO, as far as getDatabaseInfo() returns abstract information and not low-level data (see previous post).
    Best,
    Phil.
    [ October 27, 2003: Message edited by: Philippe Maquet ]
     
    Bigwood Liu
    Ranch Hand
    Posts: 240
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Phil., thank you for reply.

    Hope I am ! It's quite tough to reply to questions you're not supposed to have posted !

    Yes, I agree with you.

    Damu, because I don't know exactly what you mean - in your design - by "closing the database".

    I mean in alone mode, we will open a local database, but who is supposed to close it?
    Best,
    Damu
     
    Philippe Maquet
    Bartender
    Posts: 1872
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    I mean in alone mode, we will open a local database, but who is supposed to close it?


    Your lonely client.
    [ October 28, 2003: Message edited by: Philippe Maquet ]
     
    Bigwood Liu
    Ranch Hand
    Posts: 240
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Laughing... You are very humourous.

    You lonely client


    So the lonely client should have a close() method to close the local database.
    Best,
    Damu
    reply
      Bookmark Topic Watch Topic
    • New Topic