Saturday, August 20, 2011

Is Scala really too complex for average developers?

I have been evaluating Scala for quite some time now as an alternative to Java for enterprise development and one of the most common criticisms I have seen against Scala is that it is too complex for average developers. A quick Google search on Scala Complexity returns numerous links to blogs both defending and criticizing Scala for its perceived complexity. In my opinion one key aspect that has been ignored in this debate is that adoption of a framework/language/whatever in a large enterprise is almost never about technology per say, but has more to do with the culture of the organization.

To better understand the statement ‘Scala is too complex for average developers’, we will have to dig a little bit deeper into the prevalent culture in most IT departments in large enterprise today. This can be done by slightly tweaking the Type XY theories created and developed by Douglas McGregor at MIT in 1960s. In a nutshell Type X developers and Type Y developers are on the two opposite extreme of a spectrum.

Type X programmers could be described as:

  • Individuals who lack ambition, dislike responsibility and prefer to be led.
  • Individuals who desire job security and try to maintain status co by resisting change.
  • Individuals who dislike work and avoid it where possible.

Type Y programmers could be described as:

  • Individuals who are ambitious, self-motivated and exercise self-control.
  • Individuals who consider effort at work as just like rest or play.
  • Individuals who possess the ability for creative problem solving, but their talents are underused in most organizations.

Now with this new classification in mind, let’s see how our two programmer types fare against Scala and its perceived complexity.

Is Scala too complex for Type X programmers?

Scala is definitely too complex for Type X programmers. However

  • Java 5 and beyond is also too complex for Type X programmers.
  • Spring and Hibernate are also too complex for Type X programmers.
  • Multithreading and thread pools are also too complex for Type X programmers.

In a nutshell, anything and everything that is new and require learning is too complex for Type X programmers.

Is Scala too complex for Type Y programmers?

Scala is definitely NOT too complex for programmers who are driven and self-motivated. The seduction of Scala for Type Y programmers in large enterprise is that Scala solves real world problems much more efficiently than Java. Some of the key benefits of Scala in large enterprise are:

  • Much more elegant solutions to Multithreading problems than error prone Java alternatives.
  • A lot less boilerplate code in the form of type inference, case classes and higher level functions.
  • Ability to use existing Java libraries and infrastructure.

Lastly, Is Scala too complex for the management?

Management does not care about the complexity of programming language as long as it is enabling them to achieve faster time to market. In my opinion Scala does not require any additional investment from management as it can leverage all the existing Java infrastructure and is far more productive for their development team since it requires a lot less code than Java to solve similar problems.

So, is Scala really too complex for average developers?

In a large and conservative enterprise, a few Type Y programmers act as change agents by influencing both executive management and hordes of Type X programmers. A few years ago they evangelized Spring and Hibernate in their companies and there is no reason that same cannot be done with Scala. I believe Scala in particular and any new technology in general should just focus on Type Y programmers since Type X programmers will always resist change no matter what the change is. Scala is probably too complex for average developers however the opinions of average developers generally don’t matter. Scala needs to convert that small minority of enterprise developers who are typically responsible for bringing organization wide changes.In this regard Scala is doing a fine job attracting intelligent and self motivated programmers and I have no doubt that it will continue to gain traction in enterprise.