Dear all,
My impression about the Cake Pattern has always been that it builds on top of self-type annotation. Is that right? Or, can one still say that the pattern is followed even though there is no self-type annotation.
One more thing: Is there any definitive documentation of the pattern? I’m only interested in documents that are academically respectable. The official Scala website is also fine.
TIA,
–Hossein
Thank you Akram for the reference. Here are a few excerpts from the book on the subject of my question:
“Self types are often used for dependency injection. They are the main part of the Cake design pattern…”
“The cake design pattern relies completely on self types.”
He, later, considers implicit
s and Reader Monads as alternatives to the Cake Pattern for dependency injection. Yet, I see nothing in the book which states whether or not one is still considered to follow the Cake Pattern itself without employing self-types.
And, with all due respect to Ivan Nikolov, I’d like to know how authentic this book is considered to be in the community? I see it is not mentioned in the official Scala books page:
http://docs.scala-lang.org/books.html
Dear all,
Using John Hunt’s Scala Design Patterns [1], I realised that the cake pattern is rooted in a 2005 work of Odersky and Zenger [2]. Here is the openning of their abstract:
“We identify three programming language abstractions for the construction of reusable components: abstract type members, explicit selftypes, and modular mixin composition.”
So, the parents of the cake pattern clearly consider self-type annotation an essential constituent of their baby. My next question would then be: Do Scala people still have the same mindset?
Cheers,
–Hossein
[1] John Hunt, Scala Design Patterns: Patterns for Practical Reuse and Design, DOI 10.1007/978-3-319-02192-8_14, Springer International Publishing Switzerland, 2013
[2] Martin Odersky, Matthias Zenger, Scalable Component Abstractions. OOPSLA 2005: 41-57