On Friday, 19 August 2016 at 14:13:54 UTC, Eugene Wissner wrote:
On Tuesday, 16 August 2016 at 09:41:27 UTC, Alexandru Ermicioi wrote:
Good day.

I'd like to show my library aedi (v0.0.1), which implements dependency injection pattern.

They key features of aedi are:
1) Simple api through which a container can be configured with objects. 2) Ability to extend the library with custom logic required by your code. 3) Ability to inject already instantiated data (not only objects). 4) Possibility to build a hierarchy of containers that will be used to resolve dependencies. (for ex. if there is a need of a container that ships prototype objects along with singleton ones).

For more information about common usage of library, check readme.md on github. Most of library is documented (functions, classes, interfaces, etc.). If there is some unclarity in docs, please tell about it.

https://github.com/aermicioi/aedi
https://github.com/aermicioi/aedi/blob/master/readme.md

The library is still in development, and I'd like to see some comments, on library's usability, as well possible improvements of it.

Thank you.
How does it compare to poodinis?

Thank you, for the question :) .

So here are some available options in aedi:
1) No injection into private properties directly (only through public methods). It won't tresspass object encapsulation.
2) Constructor injection.
3) Value type injection (See examples in readme.md).
4) Multiple instances of same type but configured differently.
5) High flexibility of library.
6) Composition of containers into hierarchical structure.
7) Mixing value typed data, with instantiated objects (thanks to composition of containers).

2,3)
Though, at the moment 2 and 3, are available through code api, not annotations (to be added in near future).
5)
Aedi, for construction of object instances uses Factory pattern, and so it does allow you to extend it by implementing your own instantiation logic into an object implementing Factory interface. Also it does allow further customization of created instances by PropertyConfigurers. The setter injection is achieved through it, while constructor injection through Factories. Please view readme.md for more detailed explanation on how to add custom logic into containers.

Also, as described in readme.md, a container does not only hold an object, it manages lifetime of it as well. And aedi allows to create containers with more complex lifetime management, that should work nicely with rest of library (see 6). 7) Thanks to composition ability of containers, it is possible to add container (let's name it parameters container) of already instantiated data (objects, as well as value type data). This will allow the containers that instantiate objects to use, data contained in parameters container, that are objects as well as structs, functions, scalar values, etc. Note: in 0.0.1 version, it is not complete, yet. On next batch of modifications (annotations), some changes will appear in code api, that will allow this to work at full capacity.

Currently, I'm working on annotation based container configuration. It will have following possibilities:
1) Component scan, per class, and module.
2) Registration and configuration of objects based, on static interfaces, and not concrete annotations. 3) Thorough manipulation with injected dependencies, as well as autowiring them.

2)
Since, the annotation based, registration will register by static interfaces, it will be possible for user code, to customize the registration process of objects, with their custom logic. To do so, the user will have to define their own annotation struct/class that will implement the required static interface. Ofc, most of the options from previous list, will be available as well, to annotation based configuration.



Though, there are some features of poodinis that are not available in aedi :( .

Alexandru.

Reply via email to