Jakub is a Java EE developer since 2005 and occasionally a project manager, working currently with Iterate AS. He's highly interested in developer productivity (and tools like Maven and AOP/AspectJ), web frameworks, Java portals, testing and performance and works a lot with IBM technologies. A native to Czech Republic, he lives now in Oslo, Norway. Jakub is a DZone MVB and is not an employee of DZone and has posted 155 posts at DZone. You can read more from them at their website. View Full User Profile

My Scala vs. Clojure Impression Illustrated with Pictures of Cathedrals

10.23.2012
| 11860 views |
  • submit to reddit

(By kristobalite)

Clojure:
Clean
Structured
Focused

(By agiamba)

Scala:
Adorned
Overflowing
Magnificent

Clojure has a zen-like quality to it. There is extreme focus on simplicity, on defining few elementary orthogonal concepts that can be combined in powerful ways. For example it took 3 years for Clojure to get named parameters – but the result, destructuring, is something much richer and more applicable, that fits the language perfectly and has become a core part of idiomatic Clojure.

Scala feels as if trying to empower the programmer in any possible way, throwing in shortcuts, syntactic sugar, and plenty of methods so that anything can be done with the minimal amount of code. It is overwhelming.

Disclaimer: I have only a few weeks of experience with Scala and are in no position to judge it. This is just an impression I have gained so far and nothing more. I’m sure it is a great language.

AttachmentSize
3258064656_d0fc1b680c.jpg194.29 KB
Published at DZone with permission of Jakub Holý, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Jesper Nordenberg replied on Wed, 2012/10/24 - 3:38am

Martin, the creator of Scala, has an explicitly stated goal to keep the language small and simple. However, it's a compromise as another goal is to have excellent Java compatibility (better than Clojure) which necessarily makes the language more complex.

Another point is that having a rich static type system makes the language much larger and more complicated than a dynamic language. All languages with a powerful type system are complicated, but IMHO in most cases the additional static safety is definitely worth the extra complexity.

Erik Post replied on Wed, 2012/10/24 - 8:18am

Ahh, vague metaphors instead of technical commentary, an admission of inexperience, no mention of some of the crucial differences between Scala and Clojure, and none of the how and why. But hey, there's a table!

David Gates replied on Wed, 2012/10/24 - 9:55am

I recommend checking out Odersky's Scala levels, if you haven't already ( http://www.scala-lang.org/node/8610 ).  They do a good job of indicating which features you actually need to be a productive mainstream user, and it's a small subset: Most people can use the language quite comfortably at only the A2/L1 level.

As an L3 Scala user (Expert Library Designer), the language looks to me like a practical toolbox put together by people that do serious real-world library design work.  There are some strange, esoteric tools in there that mainstream users never end up needing, but the people that create powerful, generalized libraries for them will find themselves in situations where they need and appreciate these specialized tools.

Liam Knox replied on Wed, 2012/10/24 - 8:01pm in response to: David Gates

Sounds like a pompous load of twaddle that levels nonsense.

Best off getting your hands dirty and pick up the API's that seem most relevant the problems you are working on.  All be it you will learn different methodologies on the way. There are thousands of so called level JEE expert level X designers all of who can't code for toffee and follow some broken mantras stated at some point in evolution. Believe me I have worked with many. Theoretical classification like this does no body any good

All I would say from a Java developer dabbling in Scala is it has it's good concise language constructs and seems a more natural real world language a kin to Java to getting jobs done.  Clojure and the Lisp world just seem far to remote to get a large adoption in any future time frame (i.e. ever)

 

David Gates replied on Wed, 2012/10/24 - 9:24pm in response to: Liam Knox

They're actually very practical, since they let you know which language features you can ignore.  Put another way, they  let you get your hands dirty and pick up the language features that seem most relevant to the problems you are working on. 

One of the unusual aspects of Scala is that is has many features that are really only useful for library designers, not mainstream application developers.  You can't just "pick up the API's that seem most relevant" to the problem when your problem is creating an API.  There are libraries I couldn't create without L2 and L3 features, but people using these libraries don't need to know how they work under the covers, and can safely ignore all that business with self types, universal subclasses, and custom monads.

If his post, Odersky explains that higher levels aren't "better" than lower ones; in fact, the higher the level the less mainstream the features in it.  Most applications don't benefit from A3 features, and L3 features likewise only make sense for certain sorts of library code.  Trying to use L3 features when they're not needed will often lead to worse libraries, not better ones.

Liam Knox replied on Wed, 2012/10/24 - 10:10pm in response to: David Gates

Stills seems like Twaddle to me. If you have fold operations as expert and then basic closures for a begineer!

Personally I just dont buy this type of categorization.  Actual development is more based on the function domain, team experience, learning by experience not pigeon holing etc.  

Do the same for Java API's Generics?  Can be used in very simplistic form by any programmer and effectively. Then lets see what some 'expert' API designers do with them?  Common sense should stand out not levels of categorization.

 

David Gates replied on Wed, 2012/10/24 - 11:11pm

It's definitely more of a guideline. As Odersky said about it, "Everybody has a different yardstick. The one I described was the consensus opinion on scala-debate when we discussed it. Not everybody needs to agree with that."  If categorization doesn't make sense for you, that's perfectly valid.  It just means you're not the guideline's target audience.

With Java's generics, you need a much firmer grasp on covariance and contravariance to define classes or methods with parameterized types than to write client code using those classes and methods.  The divide's bigger with Scala's type parameters, where you might need to understand implicit conversions or existential types to define classes or methods but not to use them.

Jakub Holý replied on Sat, 2012/10/27 - 8:35am in response to: Jesper Nordenberg

Hi Jesper, you make a good point regarding static typing. Dynamic and static typing have both their pros and cons and in certain cases one or the other is a better match. Scala is full of compromases that make it perfect fit for something - and less perfect for something else (which can be said of all languages with the exception of those that are perfect for nothing ;-))

Jakub Holý replied on Sat, 2012/10/27 - 8:41am in response to: Erik Post

Hi Erik,

 Thank you for nailing down the weaknesses of this post. I'm sorry if you got the impression that this should be an objective, in-depth comparison of the languages. I believe - and I might be wrong - that it is interesting for people to see what kind of impression a languages makes on a newcomer. Comunicating that impression was the sole purpose of this post as the title tries to convey (what could you expect from an article titled "impression in pictures"?). When I will be in the stand to really compare the two languages, I will be to far from my beginnings with them to be able to remember and understand the original impressions.

Jakub Holý replied on Sat, 2012/10/27 - 8:44am in response to: David Gates

Hi David, thank you for valuable contribution to the discussion and for pointing out Scala language levels (known to me but maybe not to all the other readers).

David Gates replied on Sat, 2012/10/27 - 9:44am in response to: Jakub Holý

Thanks for your post as well; it's an interesting metaphor.  If I were to compare Scala to a building, I'd say it's like a castle.  Crenelations, nested walls, bombardment slits, and drawbridges seem strange and perhaps needlessly ornate, but they're all pragmatic rather than aesthetic.  Castles still aim for elegance, just not at the expense of practical defensive capability.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.