Re: Using Design Patterns ???
Re: Using Design Patterns ???
- Subject: Re: Using Design Patterns ???
- From: Jean-François Veillette <email@hidden>
- Date: Mon, 24 Mar 2008 14:22:20 -0400
As other mentioned, WO is designed around multiple design patterns.
Implement solution from the use cases ... without any WO connection
at all, only pure java and EOF. At that point, the business layer is
implemented and self contained, including editing context management
(use cases workflow are fully implemented). I often end up with a
'consultation' class that is more-less the business layer equivalent
of a wosession.
Then, put interfaces in front of your use cases ... easy ! WOButton/
Hyperlink trigger actions, etc. At that point, the component are
view only, they do not have any business decision in them, only html/
javascript management, only whatever is needed to build a nice user
interface to the client. Yes the .java can be complex depending on
the complexity of the interface, but at least it's not a mixing of
popup management, editingcontext management, eo business decision and
page workflow management.
Build your model, your EOs and a couple controllers around them to
complete your business layer. At that point, you have Model-
Controller. This make circle around the workflow and use cases. At
that point, you have one half of the solution, you can already start
unit testing your code.
Then the interface are implemented as part of components. Component
are easier to implement because of the nice template mechanism (.wo/
*). Templates are so handy that you rarely need to write your
response yourself ( response.appendContent("<body>..."); ), you just
put 'html' in the template's .html and make binding in the
template's .wod ... easy ! At that point, you may decide to write
further tests just to make sure the interaction is correct between
the user and the logic.
PS: If you know Cocoa, WO is not the same minding ... don't be
fooled. A .nib file is a serialization of real objects. When you
load a nib file, you just unfreeze real objects with their values as
they where when they got serialized. In WO, a .wo template is just a
text template, not serialization of real objects. As such, in
components, you don't deal with html dom elements, you deal with a
stream of ascii chars that will make your response (stream chars).
Once the stream is received by the browser, it will be interpreted as
a dom three and rendered.
- jfv
Le 08-03-22 à 18:17, Gustavo Pizano a écrit :
Hello, well, while developing my application, I came to fork. To
Use or not TO use Design pattern??.... I mean should I implement
something like a DAO which will be in charge to communicate with
EO's, or should I make this directly from the .java of the
components.??
There should be something to have in mind, and its that I will be
working with a lot of data.
Thanks
Gustavo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden