What is the difference between Scaldi and Guice

399 views Asked by At

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?

1

There are 1 answers

0
The_Tourist On

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