Skip to content

Framework-less Scala Dependency Injection frameworks by Adam Warski @adamwarski

Photo of Dustin Whitney
Hosted By
Dustin W. and 2 others
Framework-less Scala Dependency Injection frameworks by Adam Warski @adamwarski

Details

Using a DI framework/container may seem obvious, especially in web development. But why do you really need one? After all, "dependency injection" is just a fancy name for passing arguments to a constructor.

In the live-coding-only talk (no slides!) we'll walk through some of the features of DI containers and see if we can replace (and improve!) them with pure, type-safe Scala code. We'll start with "manual" DI, followed by using MacWire to generate the wiring code for us. With one simple `wire[]` macro, we can save a lot of typing and still use only Scala language features for creating the object graph at runtime.

Having solved the basic problem, we’ll proceed other features of DI containers and web frameworks: scopes and interceptors. We’ll see how to implement an interceptor, and that it’s far easier than it may seem.

Finally, we'll see what "Thin Cake Pattern” is, and how to use traits to create and compose modules (similar to the module concept known from Guice, but better).

As a bonus - I’ll have some not-only-Scala-related stickers.

Photo of ny-scala group
ny-scala
See more events
Meetup HQ - 9th Floor
632 Broadway Suite 901 · New York, NY