A Cloud TV Platform developer’s perspective, with hardly any code snippets
Explaining what Scala is is beyond the scope of a single, short blog post. I won’t even try; what I will do is try to explain why we decided to focus on it in the first place and how we did it.The first part of my post doesn’t cover the technical point of view. It discusses the transition from Java to Scala within our company and the advantages we hoped to achieve. The second part will be posted here shortly and discuss the technical advantages of Scala – that is, the ones that mattered to us.
In order to deliver the best OTT TV solution, Vidmind has put together a group of great developers (kudos to Ron) that share the same interests – both in technology and in the Game of Thrones franchise. In most cases when asked to solve an issue or implement a task/feature we look through the Internet freely (thanks Google) so we don’t end up reinventing the wheel yet again. Most of us are also open minded (some of us are very open minded) and when we first started talking about the benefits of Scala among ourselves no one was against it.
Scala was chosen because we can continue to use as much of the Java code we already have that we want, and we can replace parts of this existing java code incrementally to Scala, and the parts dependent on the previous java code will continue to run unchanged – unaware of the difference but actually using the new Scala code.
We brought the idea of Scala adoption to our VP R&D who then gave us a green light mentioning something more or less like ‘as long as it doesn’t hurt our productivity…’ and lots of other kind of unimportant stuff which we ignored.
The key parts of our transition were as follows:
The switch to another IDE . Most of us used the Eclipse IDE, but our Maven based, hybrid project (src/main/java & src/main/scala) didn’t work so well together there. We decided to switch over the Intellij Idea, which handles hybrid projects much better.
take Manhatten bought a book and after toying with it we started a lazy migration to Scala. Some new code was written in Scala by using ‘Java style programming’ which means that most of the code looked like java (no high-order functions or pattern matching and such) without the return statement nor a semicolon to indicate an end of a statement. We enjoyed skipping all the boring boilerplate stuff in Java without feeling like we were taking a risk.
Tests are a great place to test Scala code writing without affecting your production code. The first thing we wrote was an additional simulator.
Enter Coursera. When we saw that Coursera were offering a “Functional Programming with Scala” course for free that aligned perfectly with our evil plan of converting into Scala developers. Most of us took this beautifully designed course and did all the homework; we also held weekly meetings discussing the benefits/howtos and other ideas that arose about the Scala language. You can see some statistics about the course here .
To infinity … and beyond! Without a doubt our future implementations will be in Scala and we believe that this will shorten our code writing time and result in fewer bugs (less code less bugs).
Recruitment – One of the main concerns of many teams and managers is how will you recruit new Scala developers? Well that’s interesting and relevant, since at the moment of writing these lines there aren’t many of them yet (comparing to Java ones) – but the ones that are interested in Scala today are better developers overall. And those you want to recruit. We found this article on which languages excite developers particularly promising.
Training – Since the course is available online, for free (thanks again. coursera) and you can still submit the homework (without getting a certificate) to see where you were wrong, it is a valuable resource for everyone wanting to learn Scala. The Scala language is used at Twitter (and many other great companies) and they offer an online school for teaching Scala to their new recruits who do not know it yet. Everyone can use it to learn Scala. There are many books about Scala as well. It took us 2-3 months to learn the Scala language – without impacting our time schedule, but when you’ll need to train a new employee I believe three weeks is more than enough to teach a decent Java developer Scala. This task can be also combined with learning your existing Scala code.
Levels of expertise – There is a great article written by Martin Odersky on this topic . The idea is to set boundaries of code complexity and what would you require for code to look like in different levels of your projects. For example, some Base Services are probably more suited for Level L2 or higher but every day routine implementations of business logic can be A1/A2/L1. By setting standards to initially prevent the most advanced Scala features in the code that everyone must know for everyday development and maintenance. After everyone has worked in Scala for a while we will gradually start raising the levels of this most “common” code.
Our adoption of Scala is by no means complete, but I hope that these lessons and ideas we’ve adopted early on will ease your transition to Scala if you’ve already decided on it. If you haven’t, I hope that this article will get you thinking about it.