Why Scala seems difficult but really isn’t

When I learned C++ and Java a long time ago, I loved Bruce Eckel’s books Thinking in C++ (two volumes) and Thinking in Java .
They had very clear and detailed explanations and I learned a lot from them. So I value his opinion. Bruce also often wrote very positively about Python, a with language I like a lot.

A few days ago, he published a great article about Scala:

Scala: The Static Language that Feels Dynamic”

It is a very interesting article which shows that Scala is not complex – at least not more complex than Java. He writes “… Scala should be a lot easier than learning Java!”.

I agree. When you use the subset of Scala that let’s you do with Scala what you can do with Java, it is not more difficult at all, probably even easier than Java.

Here are a few reasons why I think Scala seems more difficult:

1) Programmers think they can master Scala within a few days or weeks

Programmers are used to Java and learning something new is always an effort. Not everyone is willing to really make the effort. To truly master Java, it takes years of practice. Some programmers think after programming in Java for 10 years or more, they should become as proficient in Scala as they are in Java within a few weeks. But that’s not how it works, no matter how easy a language is. You can write simple or even somewhat complex programs in Scala after recovery a few days studying it, but to truly master it, it will take a lot of time and effort. But this can be very rewarding. I am still relatively new to Scala and don’t claim to be an expert or even understand everything about the language. But when I play with it, learn or read something about, I always have fun and learn something. But I know to give it time to become an expert. If you just started with Scala, give it time. When you are stuck, ask on the mailing lists or try a different website or book with explanations. Don’t give up. Even if you end up not liking Scala very much, you will definitely become a better programmer by learning it.

2) Programmers don’t know anything or not much about functional programming

Java is not a functional programming language. If a programmer has been using mostly Java and C++ for the last years, he may have cheap mlb jerseys created great software with Java in an object oriented way. This with works great with Java and there is absolutely nothing wrong with that. I love Java and OOP is a great way for building software. But when people start playing with Scala they are also meditación) confronted with functional programming. You can do Scala in a pure OOP way but you will get more out of the language if you also master functional programming (FP). Because most programmers don’t have much experience with it, it seems very difficult and strange at first. But like I wrote above, you will have to give it some time to really understand it. It will be worth it and you will even think differently about your Java code when you’ve played more with high order functions, closures and recursion. FP is not always better or worse than OOP. It is another tool that is good to have in your toolbox. Sometimes FP Smart is a better fit, sometimes OOP and sometimes a combination. This is why Scala supports both.

3) Many Scala websites are blogs can seem intimidating to beginners

When someone is really good at a language, he or she often want’s to show it. This is why Ruby sometimes looks very complicated when a Ruby guru writes a blog post with 50 lines of code and 10 different meta programming techniques within them.
The same is true for Scala. In many blog posts and websites, you find stuff about Monads, advanced FP, very concise but not necessarily very readable code and other things you won’t need in your cheap jerseys daily business and other stuff that is way too confusing for a beginner.
This can be and sometimes is very intimidating for beginners who just want to read a file with Scala.
That wholesale jerseys doesn’t mean I don’t like those blogs, but I think the Scala community should publish more simple stuff.

4) Lack of a good cookbook for Scala

Many programmers learn by examples of how to do everyday tasks like opening files, sending an emails or building a socket server. Nieuwsbrief For many languages there are great cookbooks with hundreds of recipes about how to do that. Such a book does not yet exist for Scala. I think it could really help to bring even more people to this wonderful language.

Conclusion: Scala is not difficult – just keep on learning

This are just a few reasons why I think Scala sometimes seems more difficult than it really is. If you don’t know Scala yet, I highly recommend reading Bruce Eckel’s article mentioned above.
If you already know some Scala but struggle a bit to grasp some of it’s concepts, keep on learning. As I wrote, you cannot become a Scala expert within 3 weeks. Keep pushing until you are comfortable with Scala and you will very likely really love it. And if you don’t you will nonetheless have learned a lot. (Btw, this holds true for all languages).

I remember my Mom was in the kitchen getting Replica Oakleys my lunch ready, but crying. I asked her what was wrong. I remember her saying that the President had been assassinated. I had cheap jerseys to ask her what assassinated meant. I was ten years old and did not know what the word meant. When she told me that it meant that he was shot and had died, I then asked why she was crying. At ten years old, I didn’t understand.The tennis star has always been a staunch advocate of Fake Oakleys women having a healthy body image: “I want women to know that it’s okay. That you can be whatever size you are and you can be beautiful inside and out. We’re always told what’s beautiful, and what’s not, and that’s not right.”What matters most in her book is that breastfeeding mothers get comfortable, which often means leaning back a bit and putting their feet up. “If she’s comfortable, it’s Cheap Oakleys so much easier cheap china jerseys to get the baby into a comfortable position,” Burger explained. This is one area where partners can really step in, looking at moms to spot any ways in which they might be uncomfortable, then helping by giving them a pillow, a shoulder rub . whatever.If you want to order a bottle of the iconic ray ban outlet and highly loved Veuve Cliquot Yellow Label louis vuitton outlet Champagne, sac chanel,sac a main you can do so on giuseppe zanotti Amazon for $265. swarovski It coach purses turned beats by dre out uggs outlet to ugg boots be vans outlet decentralized ralph lauren outlet online households. Perceive that I the guy at the bar who has all the answers, said Pereira, 66, who will be in the broadcast booth in Dallas for the Cowboys Thanksgiving Day game against Washington. look at me as the go to guy, and I like that. Sunday, he did both, taking issue with the zebras for giving quarterback Sam Bradford special treatment when he lined up at receiver, and butting heads with color analyst Troy Aikman over a roughing the passer call.We hypothesized the association between the inner retinal change and the intraocular inflammation. In order Cheap Jerseys from china to investigate this relationship, we measured the aqueous flare value, as an intraocular inflammatory parameter, in RP eyes http://www.cheapjerseys2013.com using laser flare cell meter. We also determined its association with the thicknesses of different retinal layers measured using OCT, best corrected visual acuity (BCVA) and visual field in this study.My basic body armor was replaced by a full leather race suit, my shoes substituted for armored boots, and I climbed warily on to the back of a specially adapted Yamaha R1 (about the closest thing you’ll find to a road legal MotoGP bike), behind Tech 3 Yamaha rider Bradley Smith.

12 Comment

  1. alphazero says: Reply

    I think you are 100% correct in regards to learning and investment of time. I would argue that is not necessarily true for any language switch (but it is the case with Scala or say C++.)

    The counter argument here is this: Going forward on the JVM, we developers want a suite of languages ranging from scripting to something like Java. Functional is fine; it is not an issue as Clojure has proven.

    To have this plentiful toolkit, we need focused languages that let us get things done and which do not demand a huge investment of time before they are used effectively. And no, Scala is not a Java replacement. Java is not cryptic.

    1. joe says: Reply

      You don’t have to invest a lot of time to use scala effectively.
      Using case classes, lesser typing for simple classes, tuples as return values and filter/map/ etc.. builtin collection classes actually make you more productive after 2 days of intensive reading/testing (repl!).
      Tooling is now also there – finally!.
      The only problem is java collection interoperability.
      There are now unfortunately 2 ways to do this in the scala library.

      The rest will follow.

  2. M15K says: Reply

    I think Scala will definitely get there. It’s a great language. I would have to disagree with Java not being cryptic. Starting with Scala, it can be a head scratcher trying to piece together how to integrate a third party library.

    Which, lets be honest is the whole point to Scala. It is to be able to use those third party libraries but in a better way. Java is so verbose it is a hairpull to try to figure out how to integrate a new library without really digging into it. YMMV.

    By the time you really dig into the library it feels as if you might as well have written it yourself. It often doesn’t feel like the blackbox upon which you feed some information and wait for a result.

    I have found the Scala-centric libraries relatively refreshing and easy to work with.

  3. davenatx says: Reply

    Great post! I’ve personally experienced these exact reasons and would like to elaborate on how I’ve overcome much of reasons 3 and 4.

    I especially struggled with reason 3 because I found many of the “introductory” sites and books present examples that use unfamiliar syntax and concepts without really elaborating on them. E.g. partially applied functions. I’ve found the book Programming in Scala Second Edition (Updated for Scala 2.8) very helpful. Not only does it fit my learning style, it does an excellent job presenting the concepts it is currently discussing. If a feature of the language is presented before it is covered the authors explicitly mention it will be covered later and provide the reader with that section in case they want to explore it right then. Let me caveat my praise by mentioning I do have a Java background so if one is coming from a different language this book may not be as helpful.

  4. Markus Jais says: Reply

    @davenatx: I agree that Programming in Scala 2nd edition is an awesome book and I also agree that previous Java knowledge definitely helps. This is not a beginners book.
    Cay Horstmann, author of the wonderful Core Java and Core JSF books is currently working on a book called “Scala for the Impatient” which is scheduled for November 2011 according to amazon.com. This probably will be a great to learn Scala once available.

  5. Hey Markus,

    great blog. I agree with all four points! Nevertheless, two more comments:

    1) “When you use the subset of Scala that let’s you do with Scala what you can do with Java, it is not more difficult at all, probably even easier than Java.”

    That may be true, but here your third point comes in: Not only blogs, but also most books use too complicated examples. Besides, you can look at code of open source projects. In Java, you could learn from such code, in Scala you do not understand anything (I tried this by myself when I started with Scala – I looked at Scala code of Apache Camel and did not understand any one code line).

    It is very difficult to start as beginner due to stuff like own DSLs, several solutions for method syntax, and so on.


    2) In my opinion, the killer argument against Scala still is the bad IDE support! Yes, IDEA works great in the meantime, but about 95 percent (I guess) use (or have to use) Eclipse in their enterprise projects – as I do. I hope that Odersky can speed up the development of the Scala Eclipse plugin even more…


    Nevertheless, I really like Scala and hope that it will be used more in future projects!


    Best regards,
    Kai Wähner (Twitter: @KaiWaehner)

  6. Markus Jais says: Reply

    @Kai: I agree about the IDE support. There is still room for improvement for the Eclipse plugin although I think it already is much better than it was about 6 months ago.

    I also hope the Netbeans plugin continues too improve. It is not bad but not yet a match for the Java part.

  7. Javier Ortiz says: Reply

    Hopefully NetBeans takes advantage of the lack of cookbooks and do something with the plugin that is in the community hands right now…

  8. Bruce Fancher says: Reply

    I recently asked the author of a book on Scala to compare and contrast the experience of using Scala with the experience of using Clojure. He said that with Clojure, all the pain of the learning curve was up front, while with Scala, every time you thought you’d climbed the learning curve, you’d run into something that would drag you back down again.

    Scala is a very impressive piece of engineering, but it’s just too damn complicated. Just learn and use Clojure instead. If you have any doubts about why you’d want to learn and use a Lisp, read Paul Graham.

  9. yuem says: Reply

    if you want a simple and powerful language, try REBOL.

    http://www.rebol.com

    There is also another promising language RED

    http://www.red-lang.org/2011/07/redsystem-goes-beta.html?m=0

  10. Kevin says: Reply

    I think you are 100% correct in regards to learning and investment of time. I would argue that is not necessarily true for any language switch (but it is the case with Scala or say C++.)

    The counter argument here is this: Going forward on the JVM, we developers want a suite of languages ranging from scripting to something like Java. Functional is fine; it is not an issue as Clojure has proven.

    To have this plentiful toolkit, we need focused languages that let us get things done and which do not demand a huge investment of time before they are used effectively. And no, Scala is not a Java replacement. Java is not cryptic.

  11. Dave says: Reply

    Regarding point #2 – I think you mean that Java is a purely imperative language and that is the biggest difference between it and Scala. Scala is an OOP language through and through, but the diffence between the imperative and functional paradigm is the primary difference between Java and Scala.

Leave a Reply

This blog is kept spam free by WP-SpamFree.