I open this blog following a controversial topic :).
Scala is Bad:
I recently found this blog
Scala considered harmful for large projects? please check it out. Now back to me. Now back to comments section in that blog. Now back to me.
After reading the post you might get an uneasy feeling that it might be right and Scala is not so cool and blah blah blah and then when reading the comment's you can see everyone offering a quite different point of view that the whole post falls apart.
Another similar interesting read is
The next big JVM language.
And yet another misleading post
Scala is not a better java.
It has some jewels like:
He says:
- "Java is culturally opposed to these ideas: it is deliberately simple."
- "This definition of a good programming practice is one that Scala vehemently opposes." followed by contradictory "Java was supposed to start small and grow"
- "Java is proud of removing multiple inheritance. "
- "If you're stuck with the JVM, I guess the question is: how much rope do you want to give your programmers? Scala is essentially the opposite answer to Java."
I say:
- Java is not simple nowadays. People cried over generics and Collections aside it's still a pain to use them. Boxing - Unboxing. And several other problematic areas I don't care to list. Ok you don't trust me? Read "Effective Java" to really understand that there are tons of pitfalls and most likely we are guilty of several of those in our code we think is so good. Oh but wait, read "API Design" by Jaroslav Tulach en then you might also realize that designing software even in Java it's so god damn easy to get wrong. Then think about all those cool framework you probably use. Dependency Injection, Aspect Oriented Programming, external config XMLs and many other ways of making the code's context hard to understand.
- Actually read the link. I dare you. My favorite lines that summarizes it perfectly "A true library does not change the rules of meaning for the language; it just adds new words." and "But the key point is that
the new words defined by a library should look just like primitives of the language.". OMG it's exactly like Scala so Scala is actually what they tried to do back in 1998 according to this article.
- Like every statement I found everywhere spelled like that I must say "Says who?" or like wikipedia "Need reference". Ok multiple inheritance is problematic if done wrong and that statement is probably true. But Scala doesn't have multiple inheritance. I don't see how Java is better than Scala in this aspect. Java avoided the problem altogether causing pain for the good developers, Scala solved it gracefully empowering even beginners with the inclusion of Traits.
- "Stuck with the JVM" ok, deal-breaker, this guy hates Java and the JVM anyway I honestly don't trust his opinions regarding the JVM ecosystem.
Scala is Not Bad:
A more reasonable explanation was written by Jim McBeath here
Scala Pros and Cons check his "Other Posts" links too then please bookmark his blog and read it often.
Other good read is
The Scala is too Complex Conspiracy but don't waste your time in the comments section (unless you Ctrl+F "Odersky" and read his comment, then close the window).
Scala is Good:
An excellent read
Scala == Effective Java ? clearly shows an example of how Scala is actually simpler than Java and removes a lot rope you could hang yourself with. The thing is we are so used to Java's problems that we think it's simple and deceive ourselves.
Another thing people tend to pick on are the operators. Java deliberately avoided operator overloading, it's a design choice. Scala solves it gracefully. It has just a simple rule, "a.method(b)" can also be written as "a method b", as an extra method's name can be made out of symbols like '+'. No surprises, everything is a method.
People tend to think operator overloading is a great chance to mess up your code because it's hard to tell what's happening. The imaginary problem is that a crazy programmers starts littering the code with unrecognizable operators making it hard to read. If I name a method that adds two number "fhwgads" it's pretty much same. If you can't trust in your team's ability to pick names you have bigger problems.
Then there is this whole thing about making a programming language so simple that nobody can get it wrong. But hey, we have reached a place where software is complex because it defines a complex reality, that's where languages are lacking. The problem is that complicated stuff becomes overly complicated to express. I can't understand why would anyone want a limited programming language nowadays, that is not where the world is going, check out the emerging languages in the last decade. No one wants or need a "stupid" language, there is a real need for an expressive language to help us convey a complex reality in elegant ways. Languages are converging to Lisp's features. The next main stream language is not one lacking the features every goddamn decent developer is craving for so stop looking for the "The Next Big Dumb JVM Language".
The thing is Scala IS simpler if used like Java. The novice programmer will find that simple tasks take less lines than Java and it's easier to not mess it up. They will also code algorithms imperatively and everything will work just as in Java. The only thing I'm sure they will miss are "continue" and "break" but are definitely going to love "match" vs the old "switch". Casting, if any is changed from "((Cast)variable)" to "variable.asInstanceOf[Cast]", albeit verbose it doesn't force you to add the almost always necessary enclosing parenthesis. You might also have to fix some number casting with a "num.toInt" or stuff like that.
Leaving "break" and "continue" aside all you Java code base can be translated to Scala without breaking a sweat.
Then as you get deeper into Scala you will discover the cool stuff that nobody forces you upon and you will like it. You will only have to work as a team to learn and improve. Read the Scala books. Talk about it, say "hey check out this cool way of doing x I discovered in Scala!" and that's it. All you need is a passionate team to go ahead and learn it together. As more people stop cowering behind their false sense of safety and leap in Scala the less we have to go around protecting the "dumb programmers", let's all break our ignorance and embrace self improvement, encourage it and even demand it.
Please check Odersky's opion on the different level programmers can have
Scala levels: beginner to expert, application programmer to library designer and a great response to close this article of mine
Critique of Odersky’s Scala levels.