If your starting out with Scala, then you may be curious as to how the same patterns applied in Java look in Scala's syntax. Rafael de F. Ferreira takes you through the type-safe builder pattern in Scala, explaining various code listings on how this pattern is applied to Scala. Read Rafael de F. Ferreira post on Type-safe Builder Pattern in Scala http://blog.rafaelferreira.net/2008/07/type-safe-builder-pattern-in-scala.html
- Posted by: Daniel Rubio
- Posted on: July 12 2008 15:10 EDT
This is particularly elegant in that it prevents construction of incompletely specified instances. You could even use a similar approach in Java...