Re: [lsug] Dependency Injection

From: Kevin W.
Sent on: Thursday, February 14, 2013 4:01 PM
For a lightweight approach, if you want nothing more than type-based auto wiring with the option to override with mocks at test time, simply use implicits.

All built into the language, no special patterns or libraries required.



On 14 February[masked]:59, Richard Warburton <[address removed]> wrote:
Maybe because of my lack of experience in Scala, I found the Cake Pattern a bit verbose and SubCut a bit intrusive since I need to add SubCut stuff to all my classes. At least, that was my impression when reading the tutorial. 

Any views?

Hey Sandro,

Caveat: I've not written much Scala for about 18 months now so there might be more up to date views than mine.

The approach that I took last time I was using Scala was to use Google Guice, which is a pretty lightweight DI solution not tied into any particular development framework - I suspect you've come across it at some point.  The thing to bear in mind is that if you're familiar with a Java library and you feel it does the job it might also be entirely suitable for use when using other languages on the JVM.

That applies to more than just DI, sometimes even when there's a scala-specific library out there it can be easier to use a more mature or better performing Java alternative - I'm not saying that's the case in all or even a majority of situation simply that I wouldn't rule out a Java library even if my code was written in Scala.

regards,

  Richard Warburton




Our Sponsors

  • Scala Dojo

    Web site for monthly Scala Dojo

  • Scala Jobs

    Google Group of Scala Jobs in the London Area

  • ScalaDays-SF

    Price is $850 (a $200 discount!) with code “scalaug”

  • _.underscore

    Scala consultants, trainers, and developers, based in London, UK

  • Springer

    Help and supporters of the monthly dojo

  • Mind Candy

    Help with the Adv Scala Meet-up

  • Skills Matter

    Provide the venue for many of our meetings.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy