Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Scaldi and Guice

I am now working in a project that uses Scaldi, I am learning it, and looks good so far, but I still did not figure out the actual functionalities that it offers over guide/juice.

What are the actual differences between the 2 frameworks?

Is Scaldi more functional oriented?

What do I lose/gain if I move from one to the other?

like image 332
Filipe Miranda Avatar asked Dec 28 '16 00:12

Filipe Miranda


1 Answers

Guice is a java library, so its also implemented in terms of java idioms and common patterns (it heavily uses annotations and reflection). Scaldi from the other hand is implemented in terms of common patterns and idioms of Scala. So it uses implicit parameters, type classes, macros, type tags, etc. One important goal of scaldi was to avoid use of annotations, reflection and runtime bytecode manipulation. Even though very small portion of it uses scala reflection, for the most part it's reflection-free. This means that you are in charge of instantiation of your classes (it's not done via reflection). As a direct result of it, scaldi uses implicit Injector parameter, which is necessary for the implementation of annotation/reflection-free injection mechanism. Scaldi also has several features that I haven't seen in guice, like conditional bindings, property injector or macro for constructor injector (which is similar to macwire, but uses scaldi's injection mechanism).

Source

like image 56
The_Tourist Avatar answered Oct 16 '22 15:10

The_Tourist