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 ]