Spring, Scala, Akka, and Play - oh my

Has anyone built an ‘opinionated’ library for Scala/Akka/Play etc. that is similar to Spring Boot?

I have been on a number of projects that use Spring, Spring Boot, Spring Batch, etc. Some of it I like, such as rapid project startup and convention over configuration, but some of it I hate, such as trying to reverse engineer the code when jumping into a new project.

Martin Oderski says Scala 3 will become more opinionated, more emphasis on the best way to do things in order to reduce the heterogeneity of coding styles. I look forward to this. However, looking around various repositories of Scala, Akka, etc. I find many different ways to do things, some good ideas I have adopted myself, but are not part of the core Scala, Akka documentation and examples I find.

I have my own Scala and Akka ‘extras’ libraries to make up for the lack of what I find in Scala, Akka, and elsewhere, but much of what I do seems to be expressed better in Spring, or at least the Spring concept of opinionated conventions…

For example, I always struggle with logging in Scala/Akka and more recently had even more trouble getting logging working in Dotty. Why on earth should it be harder to get logging working in Dotty? In Spring such basics ‘just work.’

Playing with Dotty more lately, I wonder if the new language features could make it easier to build something like Spring for Scala/Akka et alia with better, more opinionated conventions?

I don’t know that there is anything hard about building such a library today, and lots exist. (We certainly have a good deal of that at my workplace.) But there are always tradeoffs, so there isn’t anything universally-agreed, and things tend to be a bit more building-block so that you can mix and match the elements that work for you.

(And I don’t think Dotty will make any difference: most of such matters is about the standard library, rather than the language itself.)

Playing with Dotty more lately, I wonder if the new language features could make it easier to build something like Spring for Scala/Akka et alia with better, more opinionated conventions?

Please don’t.
Even if Scala 3 tries to be more opinionated about some things, one of the core principles of Scala is flexibility.
No Scala developer that I known liked Spring, nor they wanted to use something similar. Play is already close enough.

For example, I always struggle with logging

What do you find so hard about logging?
Well, I can’t speak about Akka and Play since I do not use those technologies.
But at least in the typelevel ecosystem, it is pretty easy. Just include the logging library you want, instantiate the logger in the main or in each class (according to your style) and log.
I really prefer that control over having some logger instance introduced magically in each place.

1 Like

FWIW; We’ve used Scala for our product since 2.8-beta (2010 I think) together with Spring, nothing magic about it, works very well. We use Scribe for logging, works perfectly and has support for SLF4J, commons-logging, java-logging etc. so it’s all unified with Scribe’s config.

1 Like