Scala: Where Ingenuity Lies

Love(d) It!


From my two years of “making money” with Scala, I went from loving an every bit of it to disliking majority of it. Not all of it though, since I still feel that “guilty pleasure” when I get to do Scala: it is a more concise Java, all the stream APIs built in, e.g. map/filter/groupBy/reduce/.. (Java 8 calls them Streams), pattern matching, nice way to construct things, “suggested” immutability, etc..

AKKA and Visual Basic


I am lucky I learned to be dangerous in Erlang before I picked up Scala. Hence as I was going deeper and deeper into AKKA, I could not help but notice how AKKA is missing the point of Erlang simplicity. It was 1.2, and of course 2.X fixed a lot of it, but again, it still has this feeling of leaking “unnecessary cleverness”.

And of course Erlang process isolation is what makes it the platform for distributed systems, where AKKA’s biggest limitation is, well.. JVM really. It had become apparent to me that, while I still liked Scala, whenever I need to create/work with distributed systems, Erlang is a lot simpler and does a much better job. With enough time put into Visual Basic, it can also “embrace” OTP, but .. why?

Ain’t Exactly Hammock Driven


Doing Scala I constantly lived in the world of the category theory. Not that it is necessary to know it to write decent Scala code, but anywhere you go, everybody “talks” it. It was ok, but felt somewhat like an unnecessary mental overload. Not the category theory itself (it was very nice), but the burden of constantly staying on your monad toes.

It’s About Time: Scala State Succeeded by Clojure


Finally, learning and appreciating Clojure, made it quite obvious that Scala is just.. overcooked. At that point it seemed to be an ML’s ugly step sister. Something that I could do in 10 lines of Clojure, I could also do in 15 lines of Scala (more often than not), but what an ugly, and not at all intuitive, 15 lines that was in comparison.

Clojure also taught me that it is a lot easier to reason about time when the whole codebase is just a series of state successions: (f””’… (f” (f’ (f 42)))), which makes a “time increment” be just a single increment from (f) to (f’). This, by the way, is also the reason why the resulting codebase in Clojure is tiny compared to Scala. Not because it is dynamically typed, but because Clojure is opinionated as a language (immutability, composition, state succession, …), and Scala is opinionated as a community, while the language lags behind.

It is Not Because Of Type


Typed Clojure is great and makes Clojure optionally typed.

Interesting thing though.. I have had problems with “would have better checked it at compile time” in Groovy, but rarely, if ever, in Clojure.

I suspect the reason behind this is immutability and just plain simple seq API (a.k.a. collections): [], (), {}, #{}, where everything has pretty much the same semantics.

Scala however, is a soup of mutable and immutable collections, with another soup of functions (which are explicitly objects => may also carry state) and “stateful” classes. Hence when you program in Scala, it is imperative to have a strong type system, otherwise there is no way to know whether A is contravariant to B and covariant to C and the method M can take it. In Clojure it is mostly a function that takes a seq or a map => not much to sweat about.

Where Ingenuity Lies


Simplicity and elegancy take a lot of work and dedication. It is a lot easier to write yet another ML, but make it several times more complex. It is hard however to absorb and channel all that complexity through a very simple set of APIs with minimal syntax, as Rich did with Clojure.

8 comments

  1. @Scala however, is a soup of mutable and immutable collections, with another soup of functions (which are explicitly objects => may also carry state) and “stateful” classes. Hence when you program in Scala, it is imperative to have a strong type system@

    You need to read a book to get a basic understanding about scala – why is has mutable collections and why they exist etc, looks like you judge scala without really knowing how to use ti :)
    Scala is a langulage which is very easy to use, but compare to python or java requires deep understanding of magic behind. I’d love to hear a couple REAL arguments why scala is bad -coming from many years of experience with java\python\scala etc

  2. You also need to understand basic difference b\w scala and clojure, where scala is a better choice for OOP developers(nice try groovy!) and clojure which gives some benefits of course but fully functional language. Scala gives more flexibily to choose how to do development. in the same time of course it’s very personal and you can hate scala for no particular reasons, for example because of the steep learning curve(hello php) ;)

    And I can assure you, clojure will soon provide static typing like groovy did, not sure though if the reason would be major performance issues like it happened with groovy or something else

  3. @Ant,

    Thank you for your biased thoughts. While I find your response somewhat entertaining, there was no need to assure me, or tell me what I “need to.. read/understand”.

    You represent something that I intentionally omitted from the article: a pissy Scala community. The reason I did not talk about it, is because my several very good friends are Scala devs, and they are not a “fuck you Kevin” nor a “you need to read a book to get a basic understanding” kind of guys, but rather great human beings.

    Without going down to your level, and get all personal about what you should do, I just wanted to tell you that I delivered two big systems (for the course of my Scala craze) and got paid for every hour of it, so yes: “you can do things with Scala” (and Visual Basic for that matter). I would also like to wish you become more open to new technologies, and less arrogant in your opinions, it will most likely come naturally as you mature.

    /Toly

  4. well, I am not in love with scala, and don’t represent scala community,
    so you are wrong here. I worked with different java frameworks, grails, scala, rails and got paid in most of the time believe it or not.

    Second – just because you got paid to do something in scala doesn’t make you right or an expert either – you are wrong here as well.

    I am open to the new technologies and don’t refuse clojure or whatever else is new, even if it’s not production ready, that’s fine so you misunderstood my point here as well, probably because you don’t want to listen.
    Just because you fell in love with something new doesn’t make scala worse, each has pros and cons and I am sorry about one thing – maybe not you, but every professional developer should understand that.

    but I advise you to learn more about scala because your thoughts are somewhere entertaining but have no real information except(“i feel” and “i like”), and it also looks like even thought you worked with scala, and heard of it, and maybe even managed few developers, you don’t know enough about it to justify any of your thoughts. So sad.

    P.s. if you friends are ok with you sharing thoughts about something you don’t understand(doesn’t matter spring mvc,play, or jsf) – well – they are not as good friends as you may think.

    Again didn’t hear any argument except, “I did big projects and got paid”, do you have anything specific to say to show your knowledge on the subject? Not for me – for others at least? NO? I thought so, who’s arrogant now? lol

  5. @Ant,

    It’s ok, that you understand neither the article nor arguments, nor my friends for that matter, again, it’ll come later as you mature.

    You comment above is a great contribution to the pissy Scala community, which you are a part of.

    There is no need to play psychologist, and “figure me out” either. Again I wish you can do a much better job in, say 20 years? But this part will not come naturally, you’d have to work for it.

    I’d be glad to discuss all the points above, that you did not get, either in person or here, or over IM but with a real person behind the nick, so if you feel strong about your negativity above, open up, tell me your name, contact, etc.. and let’s have a grown up discussion. I like languages and people, but I am a bit indifferent to trolls. Well I do like them in fairytales, but they have real names and personalities there as well.

    /Toly

  6. @Ant

    I am not sure what makes Scala such a great choice for OOP developers. I can see the familiar syntax of Java/C++/C# being an advantage but besides that I do not see the appeal. The whole point of picking up Scala or any other functional language is to think and write programs in functional style. I am a big fan of not reasoning by analogies[1] and learn a new way to think without any imperative crutches.

    Scala still encourages you to think non-functionally and that’s why it’s problematic. Languages like Clojure and Standard ML let you know via their syntax that you’re doing something weird if you’re doing imperative stuff, Scala doesn’t do this and it’s a big negative.

    Another problem I noticed is that when I saw my (very smart) co-workers try to learn functional programming in Scala they get confused. How many different syntactic ways are there to make a lambda expression in Scala? Why?

    For anyone who wants to learn Scala I recommend they first learn Standard ML and then think of Scala as a convoluted implementation of SML with a broken type system.

    1) http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1036.html

  7. There is a great article on hackernews about it
    https://news.ycombinator.com/item?id=6829725

    basically it doesn’t work for some people like many other languages. But scala is not a “bad” language compare to “clojure” of course and in many ways is probably “better” . However it’s more a philosophical question than anything else. And depends largely or what you use it for. However the debates like “i hate XXX I can do YYY with ZZZ much better will never stop”

tell me something...
  1. (required)
  2. (valid email - optional)
  3. Captcha
  4. (required)