This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi all I have been off for a while, my computer crashed, i recovered my assignment source codes(thanks to my linux O/S). I have been busy soiling my hands with .NET due to the projects here at the office, but i guess i had finish this thing before i get overloaded with work. My question is how to perform the actual bookings in the database. Does the user enter the customer id and then use the update method?If that is so, do I just change the code to only write the customer id instead of updating a whole record?Anyways,i look forward to your insights!
Does the user enter the customer id and then use the update method?
That depends on your personal implementation.
In a 3-tier scenario you'll book through you'r business method book(recNo,customerID). This business methods should delegate to data methods, i mean data class should not implement business methods, in order to have responsibilities well defined.
If you are exposing data methods to the client then it's client responsibility knowing the business rules, so it must deal with the data update method.
then so you are on the 2-tier side:
If that is so, do I just change the code to only write the customer id instead of updating a whole record
Altering update method functionality in such way will surely lead you to an automatic failure.
If interface methods do not do your stuff, add more functionality to your class, but never modify them or their expected implementation. Think that the provided interface is the target of their first automatic tests.
Hope that helps you, Regards
SCJP, OCMJD, OCMJEA
Joined: Jun 23, 2004
Hi Cool! Anyways, i have a business method that contains a Book() method and it accepts a record number and a customer id.So i am using a 3 tier approach! So this is what i assume will happen whenever i book a record. A user clicks within JTable and when the user clicks book(after entering the customer id), the whole record is sent to the update() method. Using the whole information in each cell of the JTable and also the customer id, an array of strings is then passed to the update method. Is this a good approach to the update() thanks!
Hello again Saheed, your words makes me think that it's not really a 3-tier approach...
... the whole record is sent to the update() method. Using the whole information in each cell of the JTable and also the customer id
In a 3-tier approach business layer is serverside. So the only information that must travel is the record number and the customer ID, ie the book method arguments. Then your book method could use data methods: -read: for getting all field information -update: for update new field information from that and the customer id...
Joined: Jun 23, 2004
Hi Sorry for the confusion. The client actually calls the business method Book(). and then within the book(): calls to read and update is then made. Then i pass an array of strings(read from the read() method within the Book) and then an update is then done with the customer id). I do this is in line with a valid Book(). Your insight will be highly appreciated. .