I would inject the underlying Manager into other Managers that require
them, rather than injecting Services.
You're mixing your layers otherwise.
--
Tom
To be clear:
By 'Manager' I mean a Bean that is not called by the end-user
application (CFML page or Flex RemoteObject).
'Services' wrap Managers and do things like converting argument/result
types and implementing secutiry.
If I call barService.foo(), I wouldn't want those (expensive)
conversions etc. done multiple times, so if the barManager needs to
use something from fooManager, it uses the Manager, not the Service.
--
Tom
To be clear:
By 'Manager' I mean a Bean that is not called by the end-user
application (CFML page or Flex RemoteObject).
'Services' wrap Managers and do things like converting argument/result
types and implementing secutiry.
If I call barService.foo(), I wouldn't want those (expensive)
conversions etc. done multiple times, so if the barManager needs to
use something from fooManager, it uses the Manager, not the Service.
Wow. This is the reason I signed up to this group! (Hello People!)
When Sean, on another list, said something about having "fat" business
objects, vs. "fat" services, it got me to wondering...
I'm digging AOP-- I use it in dojo and it's really swell, and I use it
in CF and it's really swell, but I'm concerned about the overhead of
using ColdSpring on transient objects.
I haven't tried using it on transient stuff yet, and I haven't set up
the eclipse profiling tools, which would make it a bit easier to see
what happens when I try X...
Anyways, maybe I'm interpreting what Sean meant incorrectly-- I doubt
he was referring to fat transient objects (?), but -- I'm trying to
think of the "best places" to do AOP with CF, what level, sotospeak.
I've mostly been using AOP for "Services", and passing the services
around to other services, so far.
So, in a round about way, I'm wondering if it's better to "aspect-ize"
at the service level, or "lower".
I think lower would give more control, but it would require a lot of
advice, and I also wonder about CF object instantiation-- how much
overhead is there?
Should I keep the bulk of things that "do stuff" around in the
application scope? Pass a user ID instead of a user object, so to
speak?
Man, I'm sorry I can't be more clear (or specific) in what I'm asking about.
Probably the answers totally depend on what you're trying to
achieve, or somesuch. :-P
I need more coffee. =]
--
Fortune does not change men, it unmasks them.
Suzanne Necker
Apologies for the total hijack! *blush*
You said it worked from "within the MG framework" but not from somewhere else?
Could it be a beanfactory issue?
Could you give some more info as to what works and what doesn't?
--
Actions lie louder than words.
Carolyn Wells
OK, I'm open to getting my words corrected :-)
So the things that RemoteFactoryBean makes are Services, we agree there, right ?
What's the correct term for the objects that they 'wrap' ?
> using the term "manager" to describe your Business Objects/Domain Objects.
> If I'm understanding you correctly and this is indeed what you mean, I think
> you're going to encounter a lot of confusion when trying to communicate this
> to other people. Am I misunderstanding you on this?
Ahh, answer my own question ... I think we're just having a
terminology clash, not a misunderstanding.
So I'd have com.falkensweb.project.services.fooService and that would
be an AOP'ing facade to com.falkensweb.project.buisnessObject.foo ? I
find com.falkensweb.project.manager.fooManager more obvious as to
what is what, esp if there are a half dozen BO and Servicess.
> > If I call barService.foo(), I wouldn't want those (expensive)
> > conversions etc. done multiple times, so if the barManager needs to
> > use something from fooManager, it uses the Manager, not the Service.
>
> This might be a totally separate discussion. I suppose it depends on whether
> the Service is doing other things (Logging, transaction management, etc.)
> that need to be maintained even for an internal method call.
In my current production usage of AOP, the buisness objects
('managers') are fairly simple, mostly just wrappers around Reactor
CRUD, search or custom Gateway methods.
AOP provides try/catch and security via tokens (i.e. sessions without
the CF scope), as such no I don't *think* that needs to be done in
calls between BOs...
--
Tom
Damn, I thought I had this sussed :-)
On 22/01/2008, Brian Kotek <bria...@gmail.com> wrote:Yeah I think here you may want to reconsider this definition, because I beleive that you are defining a Manager in a very different way than most people would. Managers and Services are used interchangeably as a description of the interface to the Model. I like the term "service" because of the prevalence of the "service-oriented architecture" idea.OK, I'm open to getting my words corrected :-) So the things that RemoteFactoryBean makes are Services, we agree there, right ? What's the correct term for the objects that they 'wrap' ?
OK.
So I should say 'remote facade' or 'proxy' or similar instead of 'Service' ?
--
Tom
> Yeah I think here you may want to reconsider this definition, because IOK, I'm open to getting my words corrected :-)
> beleive that you are defining a Manager in a very different way than most
> people would. Managers and Services are used interchangeably as a
> description of the interface to the Model. I like the term "service" because
> of the prevalence of the "service-oriented architecture" idea.
So the things that RemoteFactoryBean makes are Services, we agree there, right ?
What's the correct term for the objects that they 'wrap' ?
Ahh, answer my own question ... I think we're just having a
> using the term "manager" to describe your Business Objects/Domain Objects.
> If I'm understanding you correctly and this is indeed what you mean, I think
> you're going to encounter a lot of confusion when trying to communicate this
> to other people. Am I misunderstanding you on this?
terminology clash, not a misunderstanding.
So I'd have com.falkensweb.project.services.fooService and that would
be an AOP'ing facade to com.falkensweb.project.buisnessObject.foo ? I
find  com.falkensweb.project.manager.fooManager more obvious as to
what is what, esp if there are a half dozen BO and Servicess.
In my current production usage of AOP, the buisness objects
> > If I call barService.foo(), I wouldn't want those (expensive)
> > conversions etc. done multiple times, so if the barManager needs to
> > use something from fooManager, it uses the Manager, not the Service.
>
> This might be a totally separate discussion. I suppose it depends on whether
> the Service is doing other things (Logging, transaction management, etc.)
> that need to be maintained even for an internal method call.
('managers') are fairly simple, mostly just wrappers around Reactor
CRUD, search or custom Gateway methods.
AOP provides try/catch and security via tokens ( i.e. sessions without
the CF scope), as such no I don't *think* that needs to be done in
calls between BOs...
> > AOP provides try/catch and security via tokens (i.e. sessions without
> > the CF scope), as such no I don't *think* that needs to be done in
> > calls between BOs...
>
>
> Yeah, then those aren't business objects. A business object is meant to
> model one entity (a User, a Product, etc.). If your Manager is doing CRUD
> and Gateway (bulk) queries, that's not what would normally be called a
> business object since it is dealing with data for many objects. In fact,
> being a Singleton as I assume it is, the Manager has no state of its own as
> a business object almost always would.
>
> Hope that helps.
>
> >
>
--
Tom
So buisness/domain object == value/transfer object ?


Uh huh, OK.
Typically the service/manager that I'm exposing does only deal with
one type of data (say 'comments' or 'cases').
So that'd be a buisness object, right ? A bean with complicated things
inside (like Reactor calls) ?
remote facade -> buisness object -> ORM (i.e. Reactor) -> database ?
--
Tom
remote facade -> buisness object -> ORM ( i.e. Reactor) -> database ?
--
Tom
It should "just work". :-)
I've found that whipping up a cfunit test is the best for troubleshooting stuff.
Think you can set up a simple version of what you're trying to do as a
unit test? Just doing that may give you an "ah ha" moment...
Force be with you!
--
A cynic is a man who, when he smells flowers, looks around for a coffin.
H. L. Mencken
>It should "just work". Â :-)
That is what I am trying to get at... yes, I am using typical CS
injection... it is just not working the way I would expect when I use
beans that are injected further down the food chain:
Proxied BeanA contains proxied BeanB contains proxied BeanC
I will do more testing and get back to you if I figure out what is
going on. I was just hoping that someone was successfully doing what I
am trying to do and could provide some insight before I spend a lot of
time finding out I can't do what I am trying to do... which I am
hoping is not the case.
As an aside, I think I am going to move away from the suggestion of
creating proxies for all my managers as Chris and Barney suggested in
another thread. The time to load the application is way too long. I
get a lot of timeout errors when it initializes. This might be due to
the inheritance chain of the managers. Anyway - I love the idea, but
when I am coding and have to wait 30 seconds to run some code it can
be frustrating.
> Any performance impact of using proxies should only be taken on the first
> request to the application. If you're having performance issues on every
> request then you're doing something wrong.
I think he may be talking about development-- you've got to re-init
every time, when you're wanking on CFCs parked in the application
scope, right? :-)
I've got one app that times out in production while re-initting, if I
don't add a requesttimeout attribute.
Doesn't do it in development, but, well, it works if I add the
timeout, so screw it for now. That server is due for a rebuild
anyways. :-)
I think a lot of this is like, ORM, etc., that's all getting fired up
when you re-initialize your application.
And as with all things Java, even re-initializing is faster the second time :-)
--
You can cover a great deal of country in books.
Andrew Lang
I am curious though - how do you organize your gateway type methods
when not using Transfer in terms of services. Let's say you need to
return both Companies and Employees - where do you put the methods? I
think we might just be talking about whether you lay your code out
horizontally or vertically... meaning more files, or more in your
files.
> I try to forget the database completely when I'm designing my domain model.
> I focus on what actual *behavior* the model needs to be able to provide.
> Only later do I worry about how I must structure my database to support the
> persistence needs of the model. I suppose I'm advocating a "top down"
> approach, where the domain model drives the database structure, not the
> other way around.
Wow. I came to sorta this conclusion myself last night! Wooters.
I was thinking, "why am I trying to re-invent the wheel of my existing
project whatsit?" -- When I first did it, I did it quick and dirty,
without thinking too much about details.
While "refactoring", I realized that both my Projects, and my
Tickets, had attributes, and what was I thinking having these
"getProjectPriorityNames()" and whatnot functions? Ton of mostly
similar code. Ton of mostly similar database tables. (Normalization
made a good case for the changes too).
So I settled on an AttributeService, that has both an
AttributePersistenceService and an AttributeTypePersistenceService
(that contain gateways and DAO or whatnot). Might be overkill there,
but part of the experiment is having a data store than doesn't have to
be a database, and they're part of that (although I'm not against
storing the data schema in an ddlutils XML schema, and using it for
generation of Stuff).
I'm wondering if I can't do something like just, implement
"persistable" or something in certain objects...
Bah, I'm drifting, but I had the "top-down" thought and was like,
"wow", I can do this a /lot/ easier. Why was I stuck on having the
data-schema be the same as it had been?
Well, back to your regularly scheduled program =]
--
The statistics on sanity are that one out of every four Americans is
suffering from some form of mental illness. Think of your three best
friends. If they're okay, then it's you.
Rita Mae Brown
You mean the limitions of Illudium ?
It sounds like you might want to take the 'generation' parts of
Illudium but apply your own logic to what inputs it uses to grind
though templates.
You mentioned you already have a config file that has metadata for
relationships betwen tables etc. Maybe that could indicate which
tables were to be made into full blown proxied services, and which
would be composed into their parents (which would be ones that were
proxied).
--
Tom
As Tom suggested, a good starting point is usually a richer source of
metadata for your generator. Database introspection is way too limited to
make a useful source for generating real applications. If you must,
introspect your db to generate a first cut of metadata, but then use a
mechanism such as a configuration file (XML can be a good choice for this)
for adding richer metadata about your solution so you can generate code that
better fits your problem space. Broadly either use a top down approach where
you describe your solution space in terms of a Domain Specific Language and
then create a config file for entering data into the DSL, or try bottom up
where you look at commonalities between your hand coded scripts and use
those to come up with a language for describing the variability between your
scripts so you can generate them. Try Googling "code generation" and "domain
specific languages" and if you have the time for reading just one (large)
book, Generative Programming by Czarnecki et al is (at 8 years old) still
the best book on the subject.
Best Wishes,
Peter
http://www.theserverside.com/tt/articles/content/LightweightModeling/article.html
And the supporting documentation was excellent! There's a PDF in
there for Model Driven Development-- just great stuff.
For database introspection, ddlutils seems to work pretty good, and I
think it will handle most databases.
--
The summit of happiness is reached when a person is ready to be what he is.
Desiderius Erasmu