I just wonder: with Java 8, and the possibility to add implementation in interfaces (a bit like Scala traits), will it be possible to implement the cake pattern, like we can do in Scala?
If it is, can someone provide a code snippet?
I have been reading about doing Dependency Injection in scala via the cake pattern. I think I understand it but I must have missed something because I still can't see the point in it! Why is it preferable to declare dependencies via self types…
Using a number of newer language features in Scala it's possible to implement a composable component system and create components using the so called Cake Pattern, described by Martin Odersky in the paper Scalable Component Abstractions and also in…
I'm still trying to learn Scala's Cake Pattern. It seems to me that it gives you the advantage of centralizing your configuration of "Components" as well as the ability to provide default implementations for those components (which are of course…
I'm confused how to ensure that my Actors have the appropriate dependencies using the cake pattern. I'm still getting to grips with this, and I can't find any examples anywhere. I'm basically just looking for a tutorial/resource to follow.
Cheers,…
I'm developing a Play! 2.2 application in Scala with Slick 2.0 and I'm now tackling the data access aspect, trying to use the Cake Pattern.
It seems promising but I really feel like I need to write a huge bunch of classes/traits/objects just to…
I'm trying to implement dependency injection in Scala with the Cake Pattern, but am running into dependency collisions. Since I could not find a detailed example with such dependencies, here's my problem:
Suppose we have the following trait (with 2…
I tried to use cake pattern in my project and liked it very much, but there is one problem which bothers me.
Cake pattern is easy to use when all your components have the same lifetime. You just define multiple traits-components, extend them by…
My development makes extensive use of the robot legs binding problem. I know how to solve it with PrivateModule in Guice, but it isn't clear how this would be done with Scala's cake pattern.
Could someone explain how this would be done, ideally…
I have the following class:
class LinkUserService() {
//** cake pattern **
oauthProvider: OAuthProvider =>
//******************
def isUserLinked(userId: String, service: String) = {
val cred = oauthProvider.loadCredential(userId)
…
I want to override abstract type in trait with <: and not with = (like answer here Scala Upper Bounds : value is not a member of type parameter).
I want to use cake pattern, but this doesn't work, i don't understand why ?
trait A {
def ping =…
I'm currently baking my first cake pattern, so please bear with me.
I took my working monolithic app and I cutted it into functional layers. The cut looks clean but resulted in two of the layers that depend on an implicit ActorSystem.
I tried to…
It seems that the most common use of Scala's explicitly-typed self references is in the "Cake pattern," in which a module's dependencies are declared like:
class Foo { this: A with B with C =>
// ...
}
In general, ignoring the cake pattern for a…
I am trying to learn about the cake pattern.
I am reading this blog about it.
The example code from that blog is:
case class User (name:String,email:String,supervisorId:Int,firstName:String,lastName:String)
trait UserRepository {
def get(id:…
I have started learning scala for a while now and now looking at cake pattern. I got the example from here
trait UserRepositoryComponent {
def userLocator: UserLocator
trait UserLocator {
def findAll: List[User]
}
}
trait…