O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Developers Summit 2015 - Scala Monad

1.569 visualizações

Publicada em

Developers Summit 2015の発表資料

Publicada em: Engenharia
  • Seja o primeiro a comentar

Developers Summit 2015 - Scala Monad

  1. 1. Scala {Monad}
  2. 2. Who Am I • Now: Dynalyst • Lang: Korean(30+ years)
 Japanese(8+ years)
 JAVA(8.2+ years)
 Scala(a year) • AdTech: AMoAd DSP
 CAA Reward
  3. 3. What Dynalyst • Dynamic Retargeting + Analyst • ユーザーの趣味嗜好に適した広告配 信を行う国内初のスマートフォンに 特化したダイナミックリターゲティ ング広告
  4. 4. Scala USAGE
  5. 5. Today’s Talk • Monads in Scala Standard Library • How to use them
  6. 6. Monad? • Effects on a value • Structure that represents computations defined as sequences of steps
  7. 7. Monad? • Effects on a value
 :unit • Structure that represents computations defined as sequences of steps
 :flatMap
  8. 8. Effects on a value • VALUE • MONAD(VALUE) • Option(VALUE),
 List(VALUE),
 Try(VALUE),
 Future(VALUE)
  9. 9. Sequencial Computations • X -> Y -> Z • M[X] -> M[Y] -> M[Z] f g f’ g’
  10. 10. Behaviour • f = X => M[Y]
 g = Y => M[Z]
 • X -> M[X] -> M[Y]
 • M[Y] -> M[Z] -> … unit flatMap flatMap flatMap
  11. 11. Simple User DAO
  12. 12. Option Effects on a Nullable Value (Some or None)
  13. 13. Unit
  14. 14. FlatMap
  15. 15. Effects on a Nullable Value Some(User) or None
  16. 16. Exception Safety?
  17. 17. Try Effects on a Throwable Value (Success or Failure)
  18. 18. Unit
  19. 19. FlatMap
  20. 20. Effects on a Nullable & Throwable Value Success(Some(User)) or
 Success(None) or
 Failure(throwable)
  21. 21. Blocking Thread?
  22. 22. Future Effects on a Blocking Value (Success or Failure)
  23. 23. Unit
  24. 24. FlatMap
  25. 25. Effects on a Nullable & Throwable Value
 in Asynchronously Success(Some(User)) or
 Success(None) or
 Failure(throwable)
  26. 26. List Effects on Iterable Values (List or Nil)
  27. 27. Monad Laws • Left Identity • Right Identity • Associativity
  28. 28. Pull a value out of Monad • Helper Functions
 :getOrElse,fold,foreach,recover… • Pattern Match • 3rd Party Library
 :Akka,Spray…
  29. 29. Akka
  30. 30. Spray
  31. 31. Benefits • Keep your codes CLEAN • Easy To Guess(READABLE) • MAINTAINABLE • Less Code Less BUGS
  32. 32. We are Hiring! • 一緒に働く仲間を募集しています!
 Scalaに興味のある方はぜひ! adtech_scala@cyberagent.co.jp
  33. 33. Thanks han_sangwon@cyberagent.co.jp

×