A couple of years ago, after spending many years focusing on managing technology businesses, I decided to re-discover what first attracted me to technology and dust off my coding skills.
Of course, the world of software development has changed a lot since I last coded for a living. For instance, as much as I have tried, I have yet to become comfortable with IDEs, so I still tend to prefer working at a shell prompt, with command line tools. On the other hand, I thoroughly enjoy the availability of powerful, sophisticated open source projects, vibrant development communities, and lots of good, working sample code that can dramatically accelerate the development of sophisticated applications.
Over the last couple of years, I taught myself Python and played around Google App Engine, Hadoop, and Amazon Web Services. I taught myself PHP and developed some code that's actually being used in production. I appreciate the fact that, as an old-school C programmer, both Python and PHP somehow feel familiar to me.
I see a lot of great code being written in Java, Python, PHP, and Ruby, with many businesses achieving incredible scale on those platforms. But something was still missing for me, and I have yet to put my finger on it.
In looking for a software stack for my latest project, I stumbled on Scala. It sounded intriguing. Some really cool companies like Twitter, LinkedIn, Tumblr, and Foursquare were reported to be using it, and truth be told, I wanted to be cool too, so I started to dabble. The requisite "Hello World!" took just a few minutes to master, and I was well on my way to figuring out what a software stack based on Scala might look like.
But wait... I'm getting ahead of myself. I'll talk about the rest of the stack, later. More on Scala, for now.
The second notable fact about Scala is that it compiles to the same byte-code as Java, runs on the JVM, and interoperates with existing Java libraries. This means that it has all of the scalability and performance of Java, along with access to a the wealth of mature, feature-rich Java libraries that have been developed over the years. Further, many Java developers will find some familiar tools for developing in Scala like Eclipse, IntelliJ IDEA, Maven, and JUnit. Scala applications can also be deployed in familiar application servers like Spring. Together, these factors provide an incredibly vibrant ecosystem in which Scala can thrive, effectively mitigating many of the risks associated with Scala being a relatively new language.
The third notable fact about Scala is that it is open source (BSD License). The compiler, libraries, and all of the tools needed to build a feature-rich Scala-based Web application are available at no cost (though you can pay for commercial support if you need it).
- Supports both functional and object oriented paradigms. This is important because there are a lot of developers out there who are familiar with object oriented development but not so many who are familiar with functional programming (at least not that I am aware of). You can start off writing Scala code that looks a lot like your Java (or other OO) code and then ease yourself into FP.
- Static typing with type inference, reduces the need for explicit type declarations.
- Everything is an object.
- Traits allow you to cleanly implement cross-cutting concerns.
- Encourages immutability, which helps with concurrency and correctness when working with threads.
- Pattern matching lets you quickly and easily find the objects and data that you are looking for without writing a lot looping and comparing code.
- The compiler catches lots of mistakes and helps ensure correctness.
As a language, Scala is very concise. I haven't yet run across any instances where I needed to write a lot of the boilerplate that you need to write in Java, for instance. Pattern matching, traits, immutability, and type inference also help reduce the amount of code that you need to write, I've heard by a factor of two or three, compared to Java.
In conclusion, you can write good or bad code in any language. There is no substitute for good developers. But from my initial experiences, I believe Scala offers developers some compelling benefits, with few downsides:
- Rich ecosystem
- Familiarity to ease adoption
- Developer productivity
Here are some Scala resources that I found helpful:
- Official Scala Site
- Scala Documentation
- The official language reference docs.
- Twitter Scala School
- Written material from a series of lectures that Twitter to introduce experienced software engineers to Scala.
- Twitter on Scala
- Great, first-hand experiences from people who have built real, sophisticated, high-volume apps using Scala
- Engineer-to-Engineer Talk: How and Why Twitter Uses Scala
- More first-hand experiences.
Post a Comment