5 ms·
Scala Pros and Cons
- isomorph 16y agoWhen people say Scala is too complex, are they talking about functional programming?
- gcv 16y agoI hope not. I personally think Scala's greatest complexity is in its type system. While algebraic data types are straightforward in themselves, Scala blends them with an object-oriented mindset more rigorous than Java's. In particular, Scala requires a solid understanding of covariance and contravariance — concepts unnecessary in Java or C++.
- johnm 16y agoNo, it's the interactions between all of the boatload of features of the language that causes the explosion of complexity.
- isomorph 16y agoRight. The OO subtyping combined with the type system makes it complicated. I don't mind that, but another consequence is the limitedness of the type inference, which is kind of annoying.
- jamesaguilar 16y agoI'd like to add one to the "Cons" list. This language is even bigger and more complicated than C++. If that doesn't scare you, I don't know what will.
- samstokes 16y agoThis is sort of true in theory, but not in practice. Scala is actually a pretty pragmatic and - for what you actually need in practice - conceptually simple language. In many ways it's simpler than Java. It does have a powerful type system, and people do bizarre and unnatural things with it, but unless you're trying to do those things the complexity doesn't come into play. (That's an interesting contrast with C++, where in theory all its features were designed to be orthogonal so that you don't need to know about exceptions or templates unless you're using them, but in practice in any nontrivial codebase you'll spend days staring at screenfuls of incomprehensible STL errors.)
- hvs 16y agoIt's not even remotely close to as complicated as C++.
- henning 16y agoIt's actually smaller and simpler than Java or C++ as far as I know. It's designed to have fewer edge cases and employ a smaller number of powerful features instead of many less-expressive ones. It's interesting that you use the word "scare." It's a computer language. What's there to be afraid of?
- nimrody 16y agoWith great power and complexity comes great responsibility. Not many people can write decent C++ programs given the complexity of the language. It's pretty easy to abuse the power and write horrible code. Currently Scala is less affected, since there are not many users at this pont. I'd say this group consists of more sophisticated users, too.
- jamesaguilar 16y ago> It's interesting that you use the word "scare." It's a computer language. What's there to be afraid of? I guess you haven't read very much C++ code. :P With respect to the intent of its design versus the outcome, I can think of a few things that have been difficult for me in my playing with Scala. Implicit parameters, type parameters in general, especially the <: and >: operators, and some things like :/ and Ordering.by have confounded me quite a bit. The limited nature of its point-free style is also kind of difficult to get in -- IMO, they should have left that out entirely because two ways to do something is often worse than one. The distinction between = and = { at the end of method declarations, when you do and don't have to put parens on a no-arg method, and various other little quirks of the syntax are also a little annoying. Don't get me wrong. I'd far rather program in Scala than C++ on a day to day basis. But, it seems quite large to me. It's a subjective measure, but that's my assessment as a professional C++ programmer and a beginner Scala programmer.
- harryh 16y agoAs the guy who decided to use scala @ foursquare I am admittedly biased, but I very strongly disagree with this statement. I find scala to be on par w/ Java in terms of complexity (more complex in some areas, more consistent in others).
- jbarciauskas 16y agoIf you believe, as I do, that a given programmer can produce roughly the same number of lines of code per day independent of the language used, you can see how this reduction of lines of code can translate into a substantial increase in productivity and a faster time-to-market. Do people actually believe this? It seems to me the time spent typing actual lines of code is dwarfed by an order of magnitude by the time spent thinking between writing each line or method, cut and pasting for refactoring, etc. To borrow Fred Brooks' terminology, I think the most common languages at this point - certainly Java, Ruby, and Python - are at a high enough level that we spend an order of magnitude more time on fundamental rather than incidental complexity.
- route66 16y agoI Agree. If one would take "concepts a day" or structures/modules/interfaces/whatever-intelligible-concept a day I could follow he author. But lines per day? Put this way developers seem coding monkeys using smaller paper in their typewriter to produce more pages.
- swannodette 16y agoNot true at all. I encounter incidental complexity all the time when writing code in Java, Ruby, and Python. Especially when I need to interface with other libraries and other frameworks. Ruby, Python, Java deal with the expression problem very poorly. The desire to write code generically is real so you have the mess of generics and people run to dynamic langs. In dynamic langs the desire to monkey-patch is real because you often need to extend objects whose source you do not control. In dynamic langs you often want an extension point, that does not a mean a list of methods to call, rather a list of method signatures to implement so I plug my own functionality in w/o reading through your source. All this adds up to countless hours wasted. These are real problems in real software today that current mainstream languages address very poorly.
- ghotli 16y agoThus summarizes the negatives. Do you have any examples of languages with effective solutions to the expression problem?
- johnm 16y agoScala is to Java as C++ is to C.
- lhnn 16y agoThey should have called it J++. Oh, wait.
- technomancy 16y agoNot really; Scala is actually better than Java.
- Dove 16y agoScala provides tools that allow highly competent developers to write very concise code, and if you give them those tools they will use them. Developers who are less competent may then have trouble understanding that code. A wise co-worker of mine once said that it is just miserable when you have to maintain code written by someone smarter than you. So I strive to be concise and clear, but very rarely can I justify using arcane features and concepts to achieve that goal.