Hi! I am starting to feel lonely in the list...
> I've just started learning Scala over the past week or two. Just
> wondering if you guys have some suggestions for tutorials or some
> ideas for a problem to solve to really get into the functional mindset
> (another thing that's hard to do coming from a Java background).
I read Programming in Scala, found it very easy to read and useful. I think it is very
good as the first book on Scala. Never opened second edition, though. Do not know if it is
much different.
Also, keep an eye on the blog at scala-lang.org, sometimes articles on language get
mentioned there.
As an exercise... I started with re-implementing several of my bash scripts in the
functional way with Scala.
>
> Also, do you guys have meetups or presentations?
I've been to recent Erlang Hackatoon, was handy in setting mind in functional way. Have
not heard about any Scala meetups though...
-- Aleksey
Hey folks!
I second the PinS recommendation, it's an exceptional book. Make sure to get the second edition though.
As for meetings, I'm planning to set up another one soon once 2.9 goes beta.
If anyone else has a topic they'd like to talk about, I'm all ears! I've been trying to get Chris Shorrock to tell us about what he's been doing at EA but maybe it's too secret. :)
Also, I've been toying with the idea of doing a training course, which would be very cheap for the inaugural sessions, let me know if you're interested, everyone!
-0xe1a
I'm a recent convert myself, so I might be able to help. As far a reading material & tutorials go, "Programming in Scala" really is *the* go to book, it's fantastic. I almost read it cover to cover in the last two weeks which is something I've almost never done with a computer book. The second edition recently came out, so all the 2.8 stuff in there too now: http://www.artima.com/shop/programming_in_scala_2ed
A free alternative is http://programming-scala.labs.oreilly.com/ which is the o'reilly answer to the previous book and is published openly at the given address. I haven't been through it much myself, so I can't comment on the quality but I assume it must be alright.
That said, coming from a strong java background you really can just dive right in, it's close enough. To me scala feels like java++. I surprised my co-developer at Matygo one morning telling him I started rewriting our java backend in scala, and he sat down and spent the whole day working on it with me, fairly effectively, having never written a line of scala before in his life. Do you have an old project you want to rewrite? A new little one you've been thinking of trying? Do it. It won't be the best or prettiest scala ever written, but it'll get the ball rollling. Dive in, iterate and improve :)
As far 'functional mindset'... like with the rest, just dive in. Functional programming conceptually is much simpler than imperative I find... it's really all about lack of side effects and referential transparency. for example you know if there's no return value (eg :Unit or using .foreach) you're dependent on side effects. So always try to return something. Use maps and folds whenever possible. Use vals. Of course ask yourself 'why' - no point in being functional just for the sake of it. Usually there is good reasons, like conciseness, expressiveness, the ease of reasoning with referential transparency, concurrency, etc... - but if those don't feel apparent in a particular case don't force it.
As far as meetups... I'd like to get a van scala meetup going. I searched meetup.com and there doesn't seem to be a group. I think this list has had some before, but I don't know I'm new ;)
Paul
On 2011-03-07, at 11:35 PM, Art wrote:
Cascal written by Chris while in EA is definitely not a secret, it is released as open
source: https://github.com/shorrockin/cascal
The rest of the code is secret, I believe. I am one of the developers who take care of
Chris's legacy in EA :) I wish I could talk about that...
<cut/>
-- Aleksey
Hi Art, good luck on your journey, I think you'll enjoy it, scala is a pretty amazing language. It's rare that I actually get real amounts of fun from programming these days, and Scala has yielded that in droves.
As for challenges, I've found project Euler to be useful, if a little too mathy at times. Mostly restricting yourself to purely functional programming, recursion, only vals, etc - takes a lot of discipline and really pays off. It also shows where it's not a good fit. The Python challenge is good too, though there's a few that you can't do in scala. Still fun for the first dozen or so. Be sure to learn ScalaTest, it's a great way to test in Scala, and is a fine example of a good scala based DSL.
I'd recommend trying to focus on expressiveness. It's pretty easy to make scala look like a cousin of bad perl code, it's also very capable of being far more readable than the equivalent Java code. Especially with the appropriate use of things like the higher order collections methods (.map(), .filter(), .foldLeft(), etc), case classes, pattern matching, and recursion.
Reading the Odersky/Venners book 'Programming In Scala' is highly recommended, it's one of the best programming books I've ever read. I'd steer clear of Programming Scala at first - some of it can go into depths that aren't all that useful right away. Definitely good once you've got your feet wet.
I'd also suggest to find a good itch to scratch, and code it up in scala. A simple game, a useful utility. If you can come up with a concurrency use-case, actors are a lot of fun. You can make android apps pretty easily with Scala. How about a highly concurrent game? Distribute it with Akka! :) Speaking of which, be sure to follow Jonas Boner and Debasish Ghosh (among others) on twitter - they often post useful links.
To the group - I'd certainly be up for a little scala meetup some time.
- Dave