flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tink <f...@tink.ws >
Subject Re: Flex modularity through composition and interfaces (Dependency Injection)
Date Thu, 05 Jan 2012 21:45:45 GMT
This is because DI currently happens at runtime not compile time and  
depend on listening to Event.ADDED_TO_STAGE at the capture phase  
(which alone slows things down when I tested it, I can only presume  
these events don't get dispatch if its not listened to, and if you add  
this listener every DisplayObject has to dispatch it, and then when  
you find something that requires injection describeType() is used to  
get a large chunk of XML to inspect to see what needs injecting, if  
anything.

There was some talk a while ago about Metadata becoming a first class  
citizen in Flex, anyone have any more info on this and whether it  
progressed?

The DI frameworks out there remove the things we don't like  
(Singletons etc), but being Singletons etc themselves (i.e. they don't  
remove the nasty stuff from the running code, they just hide it from  
the code you write).

Couldn't we inject at compile time.As the compiler does with other  
metadata it could find injection points, and using Singletons hidden  
behind the scenes to give the correct values to the correct properties  
in the generated code? This would remove the current bottlenecks we  
have with DI.

Tink



On 4 Jan 2012, at 22:09, Alex Harui wrote:

"And I predict the same with DI.  Injecting everything will slow  
things down
if you start injecting small things."

Mime
View raw message