|
Re: Java is Dead, But You'll Learn to Love It
|
Posted: Oct 7, 2009 10:03 AM
|
|
Hi Cedric,
> > While there are a few features that I'm not very fond of > and that I documented on my blog (namely, implicits, > matching and structural typing), each individual feature > of Scala sounds great on paper, and I mean that literally > (I quite enjoyed your book for that reason). I think that > what makes Scala difficult is the combinatorial explosion > of all these features, especially when you start using > Scala's generic type system extensively. > I assume you're talking about my book. Frank's book (on Actors) will be out soon, but hasn't been released yet. I did work very hard to make the code in that book look readable and beautiful, in part because I wanted to make an tastefully typeset book for Artima's first book, but also because I knew this was a marketing document. If the code looked ugly and inscrutable in Martin Odersky's Scala book, it would turn people off to Scala. And if it was beautiful to look at, it would help make people feel good about Scala. > I have browsed quite a bit of Scala source code of big > projects to get a feel for what Scala looks like in the > trenches, and I was quite disappointed to see that all the > neatness that I found in your book is gone. All the > compactness and functional beauty that Scala seems to make > so easy to generate disappears to be replaced by hardcore > C-like thick code. Even closures and matching become > difficult to read. > I've seen both. I've seen Scala code that is ugly and scary, and I've seen Scala code that is refreshingly easy to read. (One example is I thought Robey Pointer's Configgy code (on GitHub I think) was quite easy to read when he showed it at one of the ScalaBASE meetings.) What I think is a very valid critique and concern about Scala is that it does give people more rope to shoot themselves in the foot with compared to Java and Fan. Though I'd say this has more to do with the flexibility of the Scala language than its complexity.
I tried in the book to warn people against abuse of implicit conversions and operators, and to encourage a functional style. I also with ScalaTest am trying to encourage these values by example. I'll be writing some blog posts illustrating what I did in ScalaTest in this regard, but people will do what they do. One hopeful thing is that the library designer has a lot of say in Scala about how the client code looks, so it will help if we can get libraries that encourage readable client code adopted. But ultimately, I expect the ugly Scala code will always be with us, along with the pretty code.
|
|