10 October 2008

Reflections on Scala

In my professional programming career, I have been a mostly object-oriented programmer, programming in C#, Java, Python, and C++. Throughout this time, though, I researched functional programming languages from Scheme to Haskell. While I was frequently fascinated by them and they definitely stretched my mind, I never found them to be as practically usable as the relatively new language Scala.

Scala describes itself as a fusion of object-oriented and functional programming languages, and while that is true, it certainly does not give the language justice. Scala has let me leverage my familiarity with object-oriented languages like C# and Java, but add in functional elements as I go along. This has been great for me since I am most comfortable developing real-world applications in an object-oriented style, as I suspect most professional developers are these days. After I have the basics of my program done in an object-oriented style, I can start adding in more functional features. I have never found a language that makes this easier.

To me, the biggest stumbling block for programmers new to Scala is that most of the official documentation describes Scala's functional features very well, but lacks in depth discussions on how to transition to Scala from an object-oriented background. My advice if you are new to Scala and you're an object-oriented developer, learn how to program Scala in a object-oriented way first, then add in functional stuff.

Finally, I have tried two IDE plugins that offer Scala support: one for Eclipse and one for NetBeans. Of the two, I find NetBeans to be more stable, faster, and better able to deal with Scala syntax than Eclipse. There are definitely still some bugs for them to solve, but I'll be sticking with the NetBeans plugin for my Scala development in the near term.


fogus said...

I have finally got some buy-in to use Scala at my workplace... I am looking forward to the experience.

Nice post.

Kristian Domagala said...

I certainly found that taking an in-depth detour into Haskell helped me to understand and appreciate Scala's functional aspects a lot more. Mind you, it also had the effect of pointing out Scala's inefficiencies in this area when I returned to the language.

I've had problems with both Eclipse and IntelliJ's Scala support, though I get the feeling it's due to the way we're using the language. I don't think I'm quite ready to have another go at NetBeans yet, but it's interesting to hear that you've had some relative success with it.