Learning Scala

15 views
Skip to first unread message

Art

unread,
Mar 8, 2011, 2:35:10 AM3/8/11
to vancouver-scala
Hi guys,

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).

Also, do you guys have meetups or presentations?

Cheers,
-Art

Aleksey Vorona

unread,
Mar 8, 2011, 9:40:48 PM3/8/11
to vancouv...@googlegroups.com
On 07.03.2011 23:35, Art wrote:
> Hi guys,

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

Alex Cruise

unread,
Mar 8, 2011, 10:07:57 PM3/8/11
to vancouv...@googlegroups.com

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

On 2011-03-08 6:59 PM, "Paul Lambert" <popepa...@gmail.com> wrote:
> Hi Art,
>
> 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
>> --
>> This message courtesy of the "vancouver-scala" group.
>> Post: vancouv...@googlegroups.com
>> Unsubscribe: vancouver-sca...@googlegroups.com
>> More? http://groups.google.com/group/vancouver-scala?hl=en
>
> --
> This message courtesy of the "vancouver-scala" group.
> Post: vancouv...@googlegroups.com
> Unsubscribe: vancouver-sca...@googlegroups.com
> More? http://groups.google.com/group/vancouver-scala?hl=en

Paul Lambert

unread,
Mar 8, 2011, 3:04:22 PM3/8/11
to vancouv...@googlegroups.com
Hi Art,

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:

Aleksey Vorona

unread,
Mar 8, 2011, 11:13:03 PM3/8/11
to vancouv...@googlegroups.com
On 08.03.2011 19:07, Alex Cruise wrote:
<cut/>

> 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. :)

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

Dave LeBlanc

unread,
Mar 9, 2011, 2:20:40 AM3/9/11
to vancouv...@googlegroups.com

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

Rodney Gitzel

unread,
Mar 9, 2011, 1:37:27 PM3/9/11
to vancouv...@googlegroups.com, Dave LeBlanc
+1 to Project Euler, I've done nearly 80 all in Scala, and it's been an excellent exercise.  The earlier problems are a good way to learn and practice the Scala collections and looping constructs.  The later ones become less about the language, but will still teach you about Scala memory limitations and why to not create rilly rilly big Lists.  :p

Another excellent learning resource is the Daily Scala, which unfortunately is no longer updated, but still has a lot of useful tips, tidbits and things you might not notice elsewhere:  http://daily-scala.blogspot.com

rodney

Art

unread,
Mar 10, 2011, 1:06:28 AM3/10/11
to vancouver-scala

Some great advice. Thanks guys! Can't wait to dive in.

-Art

On Mar 9, 10:37 am, Rodney Gitzel <rodney.git...@gmail.com> wrote:
> +1 to Project Euler, I've done nearly 80 all in Scala, and it's been an
> excellent exercise.  The earlier problems are a good way to learn and
> practice the Scala collections and looping constructs.  The later ones
> become less about the language, but will still teach you about Scala memory
> limitations and why to not create rilly rilly big Lists.  :p
>
> Another excellent learning resource is the Daily Scala, which unfortunately
> is no longer updated, but still has a lot of useful tips, tidbits and things
> you might not notice elsewhere:  http://daily-scala.blogspot.com
>
> rodney
>
> > More?http://groups.google.com/group/vancouver-scala?hl=en
Reply all
Reply to author
Forward
0 new messages