addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

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.


  Richard Warburton

Our Sponsors

  • Scala Dojo

    Web site for monthly Scala Dojo

  • Scala Jobs

    Google Group of Scala Jobs in the London Area

  • _.underscore

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

  • Springer

    Help and supporters of the monthly dojo

  • 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