Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Scala Days Chicago 2017: Building a Company on Scala

214 views

Published on

Tapad co-founder and CTO, Dag Liodden, shares best practices on how companies can embrace Scala to spur growth and use the language to help deliver high quality code at high velocity.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Scala Days Chicago 2017: Building a Company on Scala

  1. 1. Building a Company on Scala Dag Liodden
  2. 2. 2
  3. 3. Scaling from 1 dev to 50?
  4. 4. You need a FRAMEWORK
  5. 5. Having too many degrees of freedom hurts productivity Constraints will: • Make developers focus on more on design than implementation details • Make your code base more approachable • Make your codebase easier to maintain and refactor when you change the constraintsConstraining patterns are good
  6. 6. Evolving patterns Step 1: What can this thing do? Step 2: How do I do X? Step 3: What other ways can I do X? Step 4: What’s the best way to do X? Step 5: Formalize 4 into pattern Step 6a: Get work done Step 6b: Revisit 4 at appropriate freq Scala makes it particularly easy to get stuck in 3 and 4!
  7. 7. Scala is incredibly flexible That comes at a price
  8. 8. A framework is a formalization of patterns and best practices It’s necessary to stay productive
  9. 9. There are few frameworks in Scala-land Toolkits rule the Scala domain
  10. 10. Constructing a framework Because you have to
  11. 11. “FP” Mastery is not required to Master Scala Scala is not Java, but it’s also not Haskell
  12. 12. Don’t let the possibilities intimidate or seduce you Just because it’s possible, doesn’t make it right
  13. 13. Decide early how you want to apply Scala Figuring out where on the OO-FP scale you want to be along the way is risky
  14. 14. Tools and toolkits are means to an end Eager awareness, careful adoption Everything has trade-offs
  15. 15. The Actor model “Akka is a toolkit and runtime for building highly concurrent, distributed, and resilient message-driven applications on the JVM.” • Know what it is and isn’t • Leverage it only if appropriate!
  16. 16. Reactive and Async vs Sync Make a firm decision early, middle-ground does not work Reactive programming comes with: • Cognitive overhead • Backpressure, anyone? • Performance gotchas • Compatibility issues
  17. 17. Don’t obsess about terseness Focus on clarity and approachability What do I need to import to make this work? 1 second // vs FiniteDuration.seconds(1) db ? (sql, "name" like "%Joe%") // vs db.selectOneWhere( sql, SqlField("name").like("%Joe%") )
  18. 18. Premature and one-off abstractions Building abstractions is SOO tempting in Scala, but: • A pattern is not a pattern until it has been observed several times • Assuming that you capture the pattern right away is a bold one • A function is often sufficient! • Be very careful when promoting patterns into the framework
  19. 19. Don’t reinvent everything in Scala Borrow from the rest of the JVM ecosystem It’s fun to implement RFCs in Scala, but is it productive? • Dispatch vs Dispatch Reboot • Static singletons -> Cake pattern -> Guice
  20. 20. When to begin?
  21. 21. Allow evolution to happen Step 1: What can this thing do? Step 2: How do I do X? Step 3: What other ways can I do X? Step 4: What’s the best way to do X? Step 5: Promote pattern to framework` Step 6a: Get work done Step 6b: Revisit 4 at appropriate freq In step 5, invest time in going back and removing the anti-patterns (this is hard)
  22. 22. Don’t leave it to a single developer
  23. 23. Let the tools fade into the background Spend more time on higher level design
  24. 24. Train, explain, scrutinize, evolve As a team and a community
  25. 25. • You don’t have to master FP to master Scala • Expect your mindset to evolve, but be rigorous when you adopt new patterns • Treat your tools as means to an end and allow them to fade into the background Key takeaways
  26. 26. Questions?

×