Hi there,
I am still in the process of learning Seam and started wondering about the following.
Seam proposes class design along this lines:
| @Stateful
| @Scope(EVENT)
| @Name("register")
| public class RegisterAction implements Register
| {
| @In
| private User user;
| private String verify;
| ...
| public String register()
| {
| // register the injected user
| }
|
| public String getVerify()
| {
| return verify;
| }
|
| public void setVerify(String verify)
| {
| this.verify = verify;
| }
|
My first question is regarding the register() method. In what I will call 'old
school' thinking the API would be register(User user). Is the former method not
obfuscating the code. By just reading eg the JavaDoc for this class you would not know
what's getting registered. You actually have to explicitly look at the code to see
that a user gets injected and used in the register() method. Is this still consistent with
OO design? Is this just something Java programmers have to get used to thanks to DI and
annotations? Maybe it's just me beeing stuck in old school thinking?
Another of these old school pattern which I see violated in the proposed design is that
the EJB layer forms some sort of generic business interface. Using these interfaces you
can build different clients interacting with the EJB layer, eg Web Services or even Swing
GUIs. In the RegisterAction example I cannot reuse the Register interface to eg generate
wsdl files for a web service. I have to create a whole new set of interfaces and
underlying implementations. For the same reason the getter/setter for the verify string
troubles me . It seems wrong to put this string into a stateful session bean.
Maybe I am having the wrong angle on this? Maybe one should leave the concept of EJBs
defining the business interface behind and just consider the beans as the clue which binds
the presentation layer to the persistence layer?
If my requirements however ask for different clients (eg web client, web service) I would
have to introduce an additional 'old school' EJB layer.
What do other people think?
Cheers
Hardy
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980268#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...