139 points · by ot · 11y ago · 53 comments
Materials I've read / watched / done so far:
- Martin Odersky's Functional Programming Coursera course
- `Scala in Action`
- 47 Degrees' Scala Koans
I'm currently reading `Scala in Depth`.Most Scala books were written pre 2.10, which makes them outdated enough that it would be hard for many new adopters of the language to get much out of them.
First 1/3 of the book is free online. The entire book is only $20 or so on Amazon.
If you've done the first Odersky course in coursera, the one he does with Roland Kuhn and Erik Meier is a very natural progression that will be far more practical than the original.
There are good series of blogs out there that, although somewhat outdated at times, explain concepts far better than the IMO dreadful Typesafe documentation. The twitter school, for instance, will at the very least give you names for features that, if you saw in code, you'd not be able to easily search for, due to their very generic syntax: For instance, context bounds. Another good set of blog posts comes from Bill Venners in the Artima website.
Good luck with your quest!
Second, come check out the #scala channel on Freenode. It's fantastic, has a REPL bot so you can show everyone in your compiler issues and get realtime help, tons of people, always active, very beginner friendly. Give it a shot.
Unless somebody like Tony Morris needs to feel better about his day. The average IRCer is really nice but (at least when I was over there) there is an ugly and abusive side that almost burned me out on Scala.
2. "Functional Programming in Scala" http://www.manning.com/bjarnason/
3. stackoverflow.com
If you're only familiar with scripting languages, it's going to be sort of a leap into learning Scala and could be done I think, though probably not the language I would recommend starting with since it's easy to abuse. The syntax is nowhere the same, but Scala sort of reminds me of the "Perl of statically compiled languages" in that you can write some really obtuse code without even trying if you're not careful. I don't think that's a bad thing necessarily, because it's a language that gives you a lot of flexibility (and more than enough rope to hang yourself). If you work with someone else, be sure to discuss some sort of agreed upon standard to using Scala, else you'll end up with some messy code.
Scala looks a bit like Python in parts as well as Swift, but I consider it more closer to a progressive version of C# with F# mixed into it.
When I was learning Scala, I was intimidated by a lot of the syntactic sugar that it had. It's a calming effect to realize that all of that desugars into very simple, regular things. Java happens to be a very regular, unsurprising language.
So despite how surprising/special Scala may seem, under the hood it's just a bunch of methods.
There will be an acclimation period where you eschew the fancy stuff and stick with the Java style. But as you encounter the same structures and pain points, you will begin to see which Scala structures you like and will become comfortable with.
Find a style guide. Don't go crazy with point free. In general, it's a bad idea. (It's good if your DSL is super sexy/robust/easy to understand)
I also like the language is functional first, meaning you are not forced to place functions inside companion objects or classes.
Thanks!
Seriously though, that's a pretty cool project.
Instead, teams that want to grow big in scala have to come up with their own agreements on which features not to use.
The deeper concern I see is the lack of introspection and defensiveness in the community when the critique is brought up. I've never seen programmers before take such offense and have to resort to banning programmers criticizing feature bloat.
It's not a personal attack or trying to kill Scala. There's a legitimate feeling the language tacked on way too much, too soon.
When it comes to a programming language, negative comments won't kill it. All languages grow their warts over time. Look at all the critique C absorbed.
Scala does seem to attract a disproportionate amount of criticism. And a lot of it is vague, nonconstructive, or simply wrong (and "writing something in scala feels like a waste to me" is nonconstructive in my book). Some defensiveness is warranted.
One safe rule of thumb is, as grammar and rules expand, the performance and simplicity of the compiler begin to deteriorate, particularly if features aren't added carefully.
The second is in practice, the additional grammar gives you far more ways to tackle the same problem. The is the conundrum that metaprogramming gives in languages like Ruby. Teams begin the phase of coding to the domain before letting other things fall into place.
Thinking ahead is good, but I think the issue is Scala's grammatical flexibility makes it too tempting to dig ourselves into a DSL before we're really ready. This is why we'd get so grumpy when PM's came to us asking for new features that'd require a refactor. We bought in to our own idioms, if we programmed things without the DSL, we'd be more nimble.
And we're not dumbasses. We're experienced programmers with experience programming in that domain before, but the target always ends up moving for reason's outside of engineering's control. From experience we know, DSL has no place until you're very secure in what the needs of the business is.
That said, no codebase is future proof to the rest of the team needing last minute changes - but I feel scala forces you into design decisions too early, and we thought that was an advantage.
Actually, I liked scala for not having Java's boilerplate. Then I began to miss those old things java forced you into.
It was painful, because the ego investment the team had in scala was huge. A lot was on the line. Crow had to be eaten.
[1] http://en.wikipedia.org/wiki/Principles_of_Compiler_Design
A lot of people certainly feel this way, and this feeling has given rise to the first crop of post-Scala languages: Ceylon and Kotlin.
I'm sure there will be more.
(Also, the designer of one of the languages mentioned was completely unaware of Scala when he created his own.)
The grammar of the language has no relationship with compilation speed.
What did they "tack on way too much, too soon"?