6 ms·
Is it easy for programmers of all abilities to understand and use? Will I still understand my own code in 9 months time? I think that their is more to being a
by timclark 15y ago
Is it easy for programmers of all abilities to understand and use?
Will I still understand my own code in 9 months time?
I think that their is more to being a good language than a list of features.
- soc88 15y agoYes, yes and yes.
- dkhenry 15y ago>Is it easy for programmers of all abilities to understand and use? Thats a loaded question. I don't know about you but I have met alot of People who write VBScript in excel spreadsheets that call themselfes programmers. To say the language is bad because programmers of all abailities can't understand and use it will make all languages even the simplisest ones fail that test. You should be asking can programmers that I will be asked to work with understand it and use it, however your answer to that question I think will say more about the programmers you hire / work with then it will about scala.
- codelion 15y agoThe list of features were meant to just illustrate that Scala is not some programming fad, it is strictly more expressive than Java and based on solid programming language principles. Although,I agree the code may not be easy to understand for everyone in the beginning but with effort and training I believe every programmer can learn enough of it to be more productive.
- timclark 15y agoWhat can you express in Scala that you can't express in Java?
- trurl 15y agoYou do realize the futility of such questions given Turing completeness, right? It is not about what can be expressed, but about how you express things. You do not need function literals in Scala, but it is sure is more concise and cleaner than anonymous classes in Java. You do not need traits in Scala, but it avoids code duplication or the overhead of wrapper classes or proxies in Java. You do not need case classes and algebraic pattern matching in Scala, but it is far more concise and less error prone than having to write the obscene amounts of boilerplate you would write in Java. And so on.
- timclark 15y agoOk, so can I express that this method returns a collection of a single type and that collection always contains 10 items?
- trurl 15y agoYes, you can do that by using types indexed by a number. See https://apocalisp.wordpress.com/2010/06/16/type-level-programming-in-scala-part-4a-peano-number-basics/ https://apocalisp.wordpress.com/2010/06/16/type-level-progra... for one take on this.
- rue 15y agoScala, with its “type-level programming”, crazy operator overloads and weird DSLs, is at a similar precipice as C++ was back when people started doing insane stuff with template metaprogramming (around the time of Alexandrescu's “Modern C++ Design”, 2001 maybe?). Unfortunately, I don't think many Scala users were around at that time or in that community, so lessons of the past might be learned the hard way again. There are many encouraging signs too, though, toward better and simpler practices. We'll see which way things go.
- trurl 15y agoYes, I guess I answered the letter of his question... but I personally wouldn't use collection types indexed by a size unless (a) I really really needed to be sure about this particular invariant (b) there was a bit more sugar and automation. In most cases the added verbosity and complexity involved would not generally be a win over just using an assertion. However, it is nice to know you have the option of static enforcement should it be desirable.
- timclark 15y agoShouldn't that be as simple as func bar() [10]foo with var a [8]foo = bar giving an error like cannot use bar() (type [10]foo) as type [8]foo in assignment Is it necessary to use Peano arithmetic to specify a simple type in a general purpose programming language?
- soc88 15y agoFor instance you can implement a library providing Units of Measurements such that you can track the correct type through computations, e.g: val time: Time[Int] = 15 s val length: Length[Int] = 450 m val speed: Speed[Int] = time / length The type annotations are of course completely optional. The interesting thing is that while the implementation is quite complex, the actual user has a very simple interface to develop against. So while you can write complex code in Scala, Scala allows you to keep the complexity in the library-side, while it would bleed into the use-site in Java (use-site generics, anyone?). Java can't do that. In fact, they already failed twice with it.
- channing 15y ago> Is it easy for programmers of all abilities to understand and use? I am working with two guys right now who have less than 8 months of programming experience. They are not having a problem with scala. They can do useful work in it. What they have a problem with is all the other stuff that you just have to learn about building systems.