I'm having trouble understanding the terminology used by the Typhoon documentation.
So it appears you basically define a TyphoonAssembly
and this contains all the objects. Then one or more TyphoonDefinition
's are created to describe how to instantiate the object. I'm assuming these definitions are performed in the implementation. However, these TyphoonDefinition
's are under the Types of Injections
section of the documentation.
When using other iOC containers such as Spring, the term injection refers to the process of supplying the constructed components to the dependent object, and not injecting into the iOC container itself.
Am I understanding the documentation wrong, or are the terms being used differently?
If it helps you to compare Typhoon with Spring you can think of a TyphoonDefinition
as you would a Spring bean: A blueprint for the construction of an object, with an initializer to use, along with any property setters or methods to be invoked.
Like Spring you can supply a reference to another component or inject simple configuration.
Again, like Spring you may choose to group related components together.
In fact, the internal model for Typhoon is very similar to Spring, with post-processors, etc. (The founder- that's me - was a Spring framework contributor and worked for a time at SpringSource). What's different is that:
TyphoonDefinition
s can declare that they have a mixture of static and run-time dependencies, with the latter being declared on the assembly interface. This provides a fast and powerful way to implement the factory patten, and avoids writing boiler-plate code. The main rationale was to allow IDE refactoring and code completion without building additional tool support.
Some other differences:
"By type injection" (auto-wiring) is only available for properties (the ObjC runtime doesn't retain this info for initializers or method parameters).
Typhoon provides a default scope that is designed especially for mobile and desktop software.
You may have seen some examples where a definitions has the assembly itself injected. This is similarly to Spring's BeanFactoryAware, without explicitly coupling your code to Typhoon (non-invasive). It allows proceeding from one object graph (such as a view controller) to another - a common requirement in mobile and desktop apps.
Finally, the foundation of Spring and its portfolio products is 'Dependency Injection' on the one hand and 'AOP' (for transaction management, security, etc). At this point Typhoon only does dependency injection, though we feel a formal AOP framework, with point-cut expression language would be useful.
Early versions of Typhoon allowed Spring-style XML, however this wasn't a popular feature among Objectives-C developers.