Scala design patterns

This section lists some design patterns which are useful in Scala programs. There’s also the pattern replacements page, which describes ways in which Scala language features make some common patterns unnecessary.

Structural patterns

  • Cake - Build components which are abstracted over their dependencies.
  • Dynamic scope - Make certain information available in a given context without explicitly passing it about.
  • Utility belt - Lightweight crosscutting resource sharing.
  • Reactive abstractions - Discussion of the relationship among Actors, Arrows, FRP, Pub-Sub, ....
  • Pimp my library - Extend existing classes with new methods
  • Duck typing done right - Utilise “duck typing” (structural typing) like a pro

Behavioural patterns

  • Loan - Used primarily for resource disposal; equivalent to C++ RAII or C# ‘using’.

GoF Design Patterns

These patterns are provided as references to help programmers from other Object-oriented languages see how the classic GoF Design Patterns can be applied using idiomatic Scala. Of course all of these patterns can be realized using only Scala’s OO features, much as they can in Java or C++, but many have much more concise and/or robust representations in Scala.

Creational Patterns

Structural Patterns

Behavior Patterns

 
patterns/start.txt · Last modified: 2008/05/20 09:02 by 78.146.89.117
 
Recent changes RSS feed Valid XHTML 1.0 Driven by DokuWiki