Interview with an ESME Scala Developer

Created by bagwell on 2009-03-25.
Updated: 2009-03-30, 17:22

Vassil Dichev

Vassil Dichev, one of the community of programmers dedicated to developing ESME, talks about his experiences with Scala. The Enterprise Social Messaging Experiment (ESME) is an important Open Source project that has become the foundation of a Siemens initiative to boost productivity in the Enterprise. Having chosen Scala as their development language the ESME team has worked together in a fabulous way to break new ground in company internal communications. Vassil took time out time to talk to us about himself, about the project and about some of the typical questions other programmers ask when coming to Scala. You can find more about the ESME development project on the ESME blog site and on the Apache Incubator page. All the project code is Open Source, you can find it in the Apache Subversion repository.

How did ESME get started?

Vassil: The idea for the project emerged when enterprise experts discovered the power of Twitter for communication and wanted to apply this in a corporate environment. The enterprise has specific requirements, like the need to protect access to messages for certain groups of people and the need to integrate with existing systems, each with their own information stream. That's where Scala comes in, providing flexibility, scalability and reliability. Securing messages in access pools and integration are a priority for ESME and a significant goal for the project. Then people got together and decided to develop ESME as an Open Source project.

How did that work?

Vassil: Just great. In the end it’s the people that make things work and make it fun too. Contributions to the project have come from people all over the world, the US, Austria, the UK, Norway, India, Germany, Bulgaria, among others. Everyone is so enthusiastic and totally committed. Before the big demo day in Berlin just about everybody was doing all nighters to make sure everything was absolutely rock solid. The group had written roughly 6K lines of code that live in about 40 files. That doesn’t seem much, but that’s the point, it’s surprising how much we can make ESME do with so few lines of Scala.

Suddenly it all comes together then you realize just how many people have contributed to the project with code, support, design, ideas and popularizing ESME. People like the long-term committers who have made it all possible. David Pollak, the man behind the Lift web framework, gave the project a big boost by creating the initial prototype. Darren Hague supplied the connecting force in the project and provided essential Scala, Java and jQuery expertise. A recognized UI expert, Anne Petterøe always has the patience to remind us that style and what the user thinks is in reality the only measure of success. Mrinal Wadhwa, the RIA specialist, contributed a lot of FLEX code to the ESME Desktop client. While Richard Hirsch, the organizer of the project, continues to be a tireless dynamo directing and popularizing ESME. It seems when he’s not eating or sleeping he’s talking or blogging about ESME anywhere and everywhere. They're great people to work with.

What type of work did you normally do before becoming an ESME contributor?

Vassil: My day-to-day work until now was not really related to ESME or Scala. For my previous 10 years in the professional IT world, I mostly used enterprise Java, mixed in with some Aspect-Oriented Programming.

The first language I really found inspiring was Python. I was astounded to find how much more expressive and powerful its concise syntax could be. I especially liked list comprehensions. Since then, I feel very frustrated if a language I must use doesn't provide abstractions like map/collect, fold/reduce or functions as first-class objects. Scala is top-notch in this regard.

How did you become a Scala programmer?

Vassil: I often wrote scripts in Ruby or Python, typically to automate some particular task. There seemed to be a big gap between these "scripting" languages and Java. Then I came to see that Scala could not only fill that gap but also scale nicely from scripting to beyond Java. I kept hearing about functional programming and the benefits it can provide. I was excited by the idea that solutions might be available for the tough problems of concurrency, problems that plagued our development everyday. I heard the buzz about Scala coming from the popular Java online communities, so I decided it was time to learn it.

Some programmers think Scala is difficult to learn. What do you think?

Vassil: Scala is really no harder and somewhat less complex than what Java has become. In order to use enterprise Java productively, you need to know so much more than the core language. In the Java world multiple frameworks and libraries abound for doing the same thing.

Scala already has a lot of what Java wants to become. You only have to look at all the Java language change proposals. It might help to start by thinking Scala's a better Java. The small things,for example, like the required override keyword; inheritable singleton objects instead of statics; multiple inheritance done right with traits; fine-grained access modifiers... but you find out that Scala is much more than that, and has much more to offer.

What do you say to people thinking about programming in Scala?

Vassil: Some people may find the syntax unfamiliar. However, it's worth getting over this initial hurdle and getting used to it. Ruby, for example, isn't so easy to learn for the Java programmer either. Yes, unlike Java, Scala variable types are defined after the variable; yes, "val" is used instead of "final"; "object" is used to hold what are static members in Java. But overall the syntax is much more terse and readable. All these little changes can be off-putting.

It took a while to get used to pattern matching, a new concept for me and a big step up from Java. Many people will find it a stretch, as I did, but it is well worth the effort. I was used to the dynamic typing in Python and Ruby and was naturally sceptical about going static. But then I discovered that the static typing in Scala doesn't get in the way at all. I just find out about problems earlier than I would with my favourite dynamic language. This can't be a bad thing. In fact even Guido van Rossum (Python's creator) has mentioned that "[the future] will most likely involve more compile-time checking for potential errors"

While learning Scala, I fell in love with the interactive console and the continuous compilation that Scala provides. You get the feeling that scala is very agile and behaves a lot like a dynamic language. There is an immutable collection library along with utility methods that are just great. Then XML processing is a breeze and I discovered Actors are a great way to do concurrency.

You may never end up using Scala professionally, however, it's totally worthwhile to learn. The experience will improve your skills and the things you learn will make you view your existing code and knowledge in a new light. It will show you paths you didn't see and highlight problems you've learned to ignore.

How good a fit was Scala for the ESME project?

Vassil: When I started contributing to ESME, Scala had already been chosen and a prototype had been implemented in it. It was the fact that ESME was in Scala that I was excited to contribute. I didn't choose Scala for ESME; I chose ESME because of Scala.

The problem ESME tries to solve is easy development of a scalable and flexible micro-messaging platform. Scala's actors are really well suited to the problem domain of concurrent messaging. The power of Scala, combined with the ease of Lift allowed me to solve problems with almost no effort on my side. Some of my work in Scala involved parsing an RSS/Atom feed, and XML parsing was easier to the point that just a few lines of Scala code managed to do more than the existing Java libraries dedicated to 'feed' parsing.

Another problem which ESME tries to solve is parsing expressions to filter and redirect messages. This results in a mini language (DSL), which Scala handles magnificently due to its parsing combinators.

At home, my brother kept telling me horror stories about maintaining concurrent systems in legacy C/Fortran applications, apparently a nightmare and the experience contrast was huge. This reminded me how lucky I was to be so productive with Scala.

Now ESME is finished. How did it work out? Did Scala live up to your expectations?

Vassil: The project is not finished at all. We’ve got lots of ideas and getting super user feedback, so I feel we are just at the start of a new development phase. There's so much more we can do.

As for Scala, I find something to like about it every day. I don't think there's one perfect language for everything and all languages will evolve. But after one year, I would still pick Scala for being the most practical and convenient to use, yet at the same time productive and exciting.

The best Scala feature is that it's so extensible. The core is not very big and things like actors are implemented as a library. That continues to be the powerful thing about Scala. You can extend the language with libraries. It is only as complicated as you want it to be. You can be productive with very little and learn as you go. No need to know how everything about implicits as a beginner. No need to bother about operator overloading right away. Scala just seems to do the right thing most of the time.

Scala is also not dogmatic. It doesn't reject object-oriented programming. It will not disallow mutable state. This makes for a smooth transition for everyone who might feel uncomfortable with trying a new language. Chances are, Scala has something for everyone.