Tuesday, April 21, 2009

Clean Scala?

In recent posts, I've reviewed "Programming in Scala" and "Clean Code". These two books have very different goals, but reading them concurrently got me thinking about how the relationship between a programming language and its users (i.e. software developers) changes over time, and the implications that has on code quality.

Programming in Scala and Clean Code are both products of their respective languages' life cycle. After several years in incubation, Scala is just starting to make its way into production applications and generate some buzz. Right now, experienced Scala developers are probably outnumbered by curious newbies by a factor of ten or more. The timing of "Programming in Scala" could not be better - an excellent introductory book is exactly what the nascent Scala community needs to bring more developers into the fold.

In contrast, there's absolutely no need for another introductory Java book. Since the mid-90's, literally dozens have been published, and some are now in their seventh or eighth edition. There's no shortage of Java developers, just a shortage of developers who can code Java well. Hence the need for books like "Clean Code", which advise developers on how to deal with poorly-written Java code, and discourage them from writing any bad code of their own.

Reading these two books concurrently had me wondering if some years' hence, there will be a need for a "Clean Scala" book. I certainly hope not. The creators of Scala took advantage of many "lessons learned" from Java (and other languages, presumably) to craft a better language. One of their goals was to allow developers to write concise code that more clearly expresses their intentions. I think Scala has achieved that goal, but making expressive code easy is not the same thing as making it mandatory.

The elegant code examples in "Programming in Scala" make it hard to imagine that anyone could ever write crufty code in Scala. However, I've learned - the hard way - not to underestimate a developer's ability to warp and misuse a language in ways its creators could have never imagined.

At this early stage, it's not clear to me what the most notorious abuses of Scala will be, nor how much frustration they will cause the developers who have to clean up the mess. Will future Scala masters still exhort novices to use expressive variable and function names, to avoid repeating themselves, to follow the Law of Demeter? Will the beauty of Scala make these truths self-evident? Or will Scala introduce its own unique set of anti-patterns? My hopes are for the best, but I guess we won't know for a few years.

4 comments:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  2. Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training Java Online Training

    Hibernate Online Training Hibernate Online Training Spring Online Training Spring Online Training Spring Batch Training Online Spring Batch Training Online

    ReplyDelete
  3. Hi,

    Thanks for share this information... helped to me.....
    cleaning materials in chennai

    ReplyDelete