Hi Josh,
Ah, I think that way that I'm using SmartyPants is probably quite
different from how it's typically used in Flex applications. This
would be because I like to keep my view components self-contained and
stand-alone: they don't reference anything outside of themselves,
keeping them re-usable across applications and contexts.
I manage this approach by using the Mediator pattern. A Mediator has a
reference to it's view component and not the other way around - again,
to prevent the view component from being coupled to the application.
Mediators are created for view components automatically.
My Mediators have their dependencies injected into them by a single
Injector when they are created by the framework. This means that I
never inject into any MXML components - something that I believe is
fairly expensive in any case (calling describeType on a UIComponent
would be pretty slow I imagine) - and I don't have any Classes that
"request" injection. My Commands and Mediators use annotations to
declare their dependencies, but my framework is responsible for doing
the Injection with its single Injector instance.
The fact that I've got a little framework to take care of creating my
application actors seems to simplify matters from an injection point
of view: after creating an actor I inject into it, so none of my
Classes need to explicitly request injection themselves. This means
that SmartyPants doesn't ever have to figure out context or anything
like that - which is only necessary when you have MXML components that
require dependency injection.
Seems I got the singleInjector mode switching thing backwards, so it's
not as dangerous as I thought.
Rock on,
shaun
> 2009/3/14 dtyrell <
Dars...@gmail.com>
> -
j...@joshmcdonald.info