I've been picking up Scala on-and-off for the past few months. "Programming in Scala: Second Edition" is one of the best tech books I've ever read. The authors assume you already know how to program, offer mutable & immutable approaches to nearly everything, anticipate esoteric questions in the footnotes, and even have a good sense of humor.
The book also weighs in at 883 pages and I was astonished how much of it I needed to read to even get started. Once I did, I very much like what I saw. But I was a big fan of ML back in grad school.
I do share some of the blog author's gripes though. Most of the popular Scala libraries are just a mess of DSL operators that have no real world association. I'm constantly having to look up what an operator means. I still have no clue how to use the Dispatch library, since the concepts it encapsulates are about 400 pages deeper into the book than I'm currently at. This, just to issue an HTTP GET request. I really thought there might be something on the lines of Ruby's rest-client library.
Additionally, my issues with versioning occur at a much simpler level. The release notes of any given Scala release are devoid of anything useful. Usually it's just a list of JIRA issue numbers (not the issue titles). And then there was this whole debacle around 2.9.0.1 and how SBT called the version. That took me 4 hours longer to work than was really necessary.
So, anyway, I do have some Scala projects. Incidentally they're all Java interop because I just can't wrap my head around how to use most of the Scala-specific libraries. But I've found it works really well in those situations. Deep down I really do like the language. The Scala ecosystem leaves a lot to be desired, but fortunately I can pull in stuff from elsewhere on the JVM.
BlueEyes is a framework for writing high performance web services. For it's use cases you care whether you're getting or putting. Thus it is explicit. Similarly, you care about performance, and so don't want to parse strings if you can help it -- thus you set the host once rather than parsing a URL.
For a pure ease-of-use library Dispatch is probably the best, if you can figure out the syntax (see earlier discussion). In Dispatch you can write something like
No, I don't take (much) issue with your example's readability, I just thought you were offering a typical snippet for the easy path for "I need to perform a GET".
Of course, more involved interactions require an API with more knobs. Clojure has a number of options, including touching the JDK's HTTP client API, or using a wrapper around something more grounded like clj-http[1] / Apache HTTPComponents.
Dispatch is so often used as an example of hard to read Scala code/operator overloading abuse, that I think it should be shuttered just for the greater good of the Scala community.
That being said, programmers can over-engineer things in any language; it's just that in Java, over-engineered things are "incomprehensible and huge" while in Scala over-engineering things are usually "incomprehensible and small".
Thanks. I ended up using scalaj-http, which was much simpler. But it took me a few days to find it. Dispatch does very well SEO-wise for Scala HTTP. The only other option I had come across was using http-client.
Have any good recommendations for JSON parsers? This was another case where I found the common libraries to be rather obtuse.
I use BlueEyes here (I'm a big fan of BlueEyes). It's JSON library is based on Lift-JSON. Lift-JSON is fairly commonly used, so perhaps you've run across it already. It's actually fairly simple to use and is one of the few parts of Lift that has decent documentation:
The book also weighs in at 883 pages and I was astonished how much of it I needed to read to even get started. Once I did, I very much like what I saw. But I was a big fan of ML back in grad school.
I do share some of the blog author's gripes though. Most of the popular Scala libraries are just a mess of DSL operators that have no real world association. I'm constantly having to look up what an operator means. I still have no clue how to use the Dispatch library, since the concepts it encapsulates are about 400 pages deeper into the book than I'm currently at. This, just to issue an HTTP GET request. I really thought there might be something on the lines of Ruby's rest-client library.
Additionally, my issues with versioning occur at a much simpler level. The release notes of any given Scala release are devoid of anything useful. Usually it's just a list of JIRA issue numbers (not the issue titles). And then there was this whole debacle around 2.9.0.1 and how SBT called the version. That took me 4 hours longer to work than was really necessary.
So, anyway, I do have some Scala projects. Incidentally they're all Java interop because I just can't wrap my head around how to use most of the Scala-specific libraries. But I've found it works really well in those situations. Deep down I really do like the language. The Scala ecosystem leaves a lot to be desired, but fortunately I can pull in stuff from elsewhere on the JVM.