Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scala and Clean-Architecture

Scala and Clean-Architecture


Sebastian Nozzi

June 22, 2015

More Decks by Sebastian Nozzi

Other Decks in Programming


  1. Scala and Clean- Architecture by Sebastian Nozzi

  2. Part I Screaming

  3. What do the following pictures *SCREAM* at you?

  4. None
  5. None
  6. Church?

  7. None
  8. Stadium?

  9. None
  10. Airport?

  11. What about your codebase? What does it scream?

  12. Does it scream... I'm an Accounting System! I'm a Community

    Portal! I'm a CRM-System!
  13. Or rather... I'm a Web-based App! I use the Play-Framework!

    Database FTW!
  14. Here's the idea Put your app, your domain problem, at

    the center The "web", database, framework, etc. are details
  15. Part II The Concept

  16. Nothing new or revolutionary really...

  17. It looks like this

  18. Application Core

  19. Interface Adapters

  20. Frameworks & Drivers

  21. Whole Picture Source: https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

  22. Another view Source: http://www.planetgeek.ch/2013/11/26/chop-onions-instead-of-layers/

  23. Why is this good? Good Design Clean boundaries / roles

    Easy to fix, refactor, extend, re-use Easy and fast to test etc.
  24. Good Thing™ (right?)

  25. Part III Scala

  26. Why is Scala well suited?

  27. Scala. Recap: Object Oriented and Functional

  28. Culture Language Scala

  29. Some aspects: Case-classes Immutability Collections Objects val(ues) Implicits Data-transformations For-comprehensions

    Lazyness / Rective(ness) etc.
  30. Specific to Play: Async. results (Futures) Parametrized Views Dep. Injection

  31. Applied to this...

  32. Conclusions Clean code / architecture has its advantages Scala, the

    language and the culture, support these notions well
  33. Some Resources by Robert C. Martin by Alistair Cockburn by

    Jeffrey Palermo from a post by Robert C. Martin from James Coplien, and Trygve Reenskaug by Ivar Jacobson from his book Object Oriented Software Engineering: A Use-Case Driven Approach and many more... Clean Architecture Hexagonal Architecture Onion Architecture Screaming Architecture DCI BCE
  34. Questions / Discussion

  35. Thanks