As I have been creating more of my service layer for a specific
section and combining it with TQL, the code starts to look very
similar to gateway code for the queries. Now, should these methods
be extracted from the service layer and to a gateway layer even though
its TQL??
Example:
Service Layer: user service
method: getUsersByName()
- TQL setup
- TQL Execution
Should it be moved to something like:
Service Layer: user service
Gateway : user gateway (Injected with TransferFactory)
method: getUsersByName()
- Call Gateway with parameters
- Return query
So there you go? what do you think? Opinions? Suggestions? Comments?
Yep, I would do it that way -
So:
Service -> Gateway -> Transfer -> TQL
This means that if you ever need to switch out the TQL for plain ol'
SQL, the rest of your application never needs to care.
Mark
Seemed the most flexible way. Coding changed.
However, for crud operations, they remained on the service layer, just
calling Transfer.
Is this also the case?
LUis
On Apr 19, 3:59 pm, "Mark Mandel" <mark.man...@gmail.com> wrote:
> Luis,
>
> Yep, I would do it that way -
>
> So:
>
> Service -> Gateway -> Transfer -> TQL
>
> This means that if you ever need to switch out the TQL for plain ol'
> SQL, the rest of your application never needs to care.
>
> Mark
>
> On 4/20/07, Luis Majano <lmaj...@gmail.com> wrote:
>
>
>
>
>
> > This is a design and architecture question.
>
> > As I have been creating more of my service layer for a specific
> > section and combining it with TQL, the code starts to look very
> > similar to gateway code for the queries. Now, should these methods
> > be extracted from the service layer and to a gateway layer even though
> > its TQL??
>
> > Example:
>
> > Service Layer: user service
> > method: getUsersByName()
> > - TQL setup
> > - TQL Execution
>
> > Should it be moved to something like:
> > Service Layer: user service
> > Gateway : user gateway (Injected with TransferFactory)
> > method: getUsersByName()
> > - Call Gateway with parameters
> > - Return query
>
> > So there you go? what do you think? Opinions? Suggestions? Comments?
>
> --
I actually abstract it out to -
Service -> DAO -> Transfer -> CRUD
I personally like a high level of abstraction.
Mark
Hi Jamie,
Great comments. The difference between our approaches is that I currently make my service methods object specific, so they are in effect your class singletons.
I let LightWire do my instance creation, but I do inject references of the service method (your singleton class) and the DAO into my instances, and I guess I don't have the equivalent of your service classes at the moment –
probably because I don't have much orchestration across objects that requires business rules, so typically my controllers will handle cross object issues and that has been fine so far as there really hasn't been any business logic involved yet that I might want to abstract into the model.
That is one design decision I'm not at all sure about though as I have a feeling it is a function of the simplicity of the apps I'm currently generating.
Could you share some general ideas of the kind of cross object things that your service classes handle?
On 4/20/07, Peter Bell <pb...@systemsforge.com> wrote:
Hi Jamie,
Great comments. The difference between our approaches is that I currently make my service methods object specific, so they are in effect your class singletons.
Yep.
I let LightWire do my instance creation, but I do inject references of the service method (your singleton class) and the DAO into my instances, and I guess I don't have the equivalent of your service classes at the moment ˆ
I have also a similar setup to what Peter has. I also think that the
service layer can be a bit more flexible to class singletons in the
fact that I can create some service layers that can encompass several
composite classes. This way I do not go in the way of modeling, for
example every single class, but implement a facade according to
behavior. This in turns, simplifies my objects, relations and
interfaces. My service layer in itself is unique per class or class
compositions (via behavior or relations) and interfacing to my DAO and
Gateway layers.
Gateways with Transfer encapsulated seems great. I have all my queries
in one location, search, and also because I can mix in some plain OLD
stored procedure calls or other complex queries into the mix.
As for DAO, abstracting it even more, is tempting, but I am finding
that is adding another level of abstraction that might not be
necessary, unless you are thinking that you will swap out your
persistence mechanism. And with the fact the I will be replacing the
two lines of code needed to call a CRUD operation via Transfer. I
guess I am in a dilemma of best practices of architectural design with
ease of use and practicality (with minor design issues). I guess I
don't have a clear path in this area yet.
Luis
On Apr 20, 9:31 am, "John Allen" <johnfal...@gmail.com> wrote:
> Id be excited to hear how this works out for ya too.
> ja
>
> On 4/20/07, Peter Bell <systemsfo...@gmail.com> wrote:
>
>
>
> > Fascinating stuff. Best of luck and please keep us posted as your
> > thinking evolves!
>
> > Best Wishes,
> > Peter
>
> > On 4/20/07 1:44 AM, "Jaime Metcher" <jmetc...@gmail.com> wrote: