Job hunting as of late. I’ve talked to an endless stream of recruiters, HR managers, tech managers, engineers over the last couple of weeks. They always want to know what kind of work I’m interested in — and for me that’s an easy answer: Scala. I am prioritizing Scala work above all other factors (salary, location, free soda, massages, etc). Everyone always wants to know why I am putting such a heavy emphasis on finding Scala work. Honestly, it’s just that awesome. For the most part, I think I’ve made a good argument for Scala, but I’m always struck with that post-conversation moment of clarity that usually goes something like, “Oh man! I forgot to mention that Scala also does X and Y *and* Z!”. Over the next week, I’m going to make a series of posts that iterate every reason I can think of that someone might find value in learning and adopting Scala. Hopefully, doing this will etch these reasons into my mind for easy recall the next time somebody asks. As a bonus, I’ll end the series with a post to explore the issues, limitations and “why-not”‘s of Scala that I’ve encountered so far.
Post Series:
- Code preemptively and eliminate entire classes of errors at compile-time
- Use Option to eliminate null
- Use immutable variables and immutable collections to eliminate syncronized
- Use actors to achieve race and deadlock free concurrency
- Leverage static-type checking to encode type-state at compile-time to eliminate issues such as taint or locking
- Leverage new language features that improve on Java:
- Get easy concurrency using Scala collection libraries’ parallel collections and methods
- Type less and grok faster with type-inferencing
- Imagine interfaces but with default method implementations
- Get a value from all statements, including if and try
- Auto-generate bean-style objects using case classes
- “Switch” on anything — not just int
- Restrict the allowed types of a generic class
- Reduce complexity with type-aliases
- Put more than one class in a file
- Import packages where it makes sense
- Easily refer to classes with the same name without typing the entire package name
- Type XML literals straight into your code
- Build on the best of Java’s features:
- Don’t give up static-typing and auto-completing IDEs
- Keep all the benefits of the JVM – portability, JIT, garbage collection
- Call any existing Java library from Scala with no extra work
- Call new Scala code from Java with only a little of bit of work
- Learn functional programming AND be productive at the same time:
- Code functionally as you learn
- Code immutably by default but be mutable when you need it
- Use functions as first-class objects
- Program with functional idioms to embed semantics into your code
- Use currying and compose partial functions
- Delay computations until when you need them
- Create type-classes using implicit class
- Use for-comprehensions and monads to do things you never imagined possible
- Fuse functional-programming and object-oriented programming
- Extend Scala with your own DSL:
- Override operators
- Use implicits to automatically convert types
- Stop using parentheses and periods
- Discover the Scala community
- Open-source libraries
- Frameworks
- Why not Scala?
- Binary incompatibility
- Optimization, tools and support are still maturing
- Production may suffer while learning
- Functional code has a learning curve
- Functional code can be cryptic
- Functional code has performance penalties
- Hard to find good Scala developers
- Real-time computing