| Author |
GUI, RMI and Data class
|
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi guys,
What is the general feeling:
-If in network mode:
When calling the find method in the server (the same would go for the other methods too though); Is it in order to connect from the GUI to the RMI server, call find(with a value_object) and then let the server call a util/dao class to convert the value_object to a String[], and then the server would in-turn call the Data class with the String[]. The locking and unlocking code is in the server then and not in the GUI - which makes it definitely safer.
- I feel the value_object could make the code easier to read etc., but is this step really necessary (to use a value_object) ?
Thanks bras,
Pieter
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4389
|
|
Hi Pieter,
I used value (transfer) objects between my business service and the GUI, because like you already indicated it is easier to read, but also less error-prone (no messing around with indexes),... With a value object you can have an appropriate data type for each member (for example: a boolean for smoking property), which gives you a more fancy rendering of the JTable (completely out of the box).
I think it definitely has a lot of added value and will make your life as a developer a lot easier. But you can keep working with a String[], nothing wrong with that approach.
Kind regards,
Roel
|
SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
|
 |
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi Roel,
Thanks again for the speedy reply; and cool, I'll stay with the VO approach too.
Thanks,
Pieter
|
 |
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi,
From the GUI, when you call find(), are you getting back the list of recNos and then call read() for each record - everything from the GUI? or do you populate a List with the already populated VOs?
have fun,
Pieter
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4389
|
|
Hi Pieter,
When GUI calls BusinessService.find a List<Room> is returned. When BusinessService calls Data.find a Map<Integer, String[]> is returned. Of course that's a method I added to my own interface.
Kind regards,
Roel
|
 |
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi Roel,
Thanks, I got the answer and the idea!
Thanks,
Pieter
|
 |
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi Roel (sorry - and other guys),
Just a simple question; when you extended the DB interface (Sun's provided interface), you then extended it and added whatever methods you also wanted; now my question:
did you then implemented each of the methods and then let your new added methods call these methods, or did you do something else?
Thanks bud/s,
Pieter
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4389
|
|
Hi Pieter,
I implemented each method from my interface and Sun's interface. From my own (custom) methods I called a method from Sun's original interface when it was appropriate.
Kind regards,
Roel
|
 |
Pieter Jacobs
Ranch Hand
Joined: May 20, 2009
Posts: 87
|
|
Hi again Roel,
Thanks bud!
Enjoy,
Pieter
|
 |
 |
|
|
subject: GUI, RMI and Data class
|
|
|