views:

4282

answers:

16

I've recently become interested in learning Scala, my first thought was a simple compiler, but I don't have very good knowledge of Automata theory.

So my question is: what's a good project or tutorial to learn scala with?

+16  A: 

I used scala in combination with Processing to make computer games! What better way to learn a language than to use it!

Of course, I also made functional-friendly programs in the beginning. Fractals are an excellent example of this, as are image filters. However, it took a traditionally-imperative problem such as an Asteroids clone to make it really click with me.

EDIT: On a similar note, writing a scheme compiler in scheme really helped me learn the language, but that's not nearly as simple or feasible with a language as complex as Scala. Maybe write a scheme compiler in Scala?

duane
+2  A: 

I'm currently using the exercises from here. I'll admit that his approach is not really specific to scala, but it is a really nicely stepped approach to moving from the basic idioms up into the special-purpose libraries of a new Language of the Year..

Update(09.27.2008): Here's a really good primer to the syntax of Scala: link

Ryan Ransford
+17  A: 

There is very good a book called "Programming in Scala" that is being written at the moment. You can buy a preprint PDF at Artima.

Of course there is also a lot of free information available on the Scala site. Look at the Scala Reference manuals.

If you have questions you can go to the Scala mailing lists, which are also reference on the Scala site.

Arco Oost
+6  A: 

Cay Horstaman has his lectures and exercises for a functional programming course with Scala here.

Lars Westergren
I'm following his course too - it's really helping me get out of the OO mindset! My next plan of attack is to do some Project Euler problems.
Julie
+3  A: 

I'm currently reading though a mammoth list of scala blog posts by the Code Commit guy. He's a fairly talented writer, and many of the posts are aimed at Java developers like myself.

You can find all his scala posts here.

SCdF
+3  A: 

If you come from Java, I think that a good way to star is reading this series of articles from IBM.

Ted Newar give us a nice and funny explanation about Scala, sometimes comparing to Java what makes you lear faster in a consistent way.

Good luck!

paulosuzart
+9  A: 

For a Java programmer I would recommend Daniel Spiewak's Scala for Java Refugees tutorial series.

Theine
That is a great series.
Kevin Albrecht
+6  A: 

As Lars mentions, Cay Horstmann's languages course is a great way to get started. I have been following it regularly, and his slides are filled with hands-on examples to try out. While some may be disappointed that the course specifically hones in on the functional aspects of Scala, it was great for me coming from a Java background to break out of the OO mindset for a bit.

Another way I'm learning Scala is to blog about it, comparing it with Java (pros/cons/when would I want to use each). In general, one good way to learn is to compare it with another language you already know. Implement the same problem in both languages and evaluate the pros/cons of each, so that you can see where you would want to use each one.

The third way is to do problems in Scala. I find I learn best if I have a specific objective in mind. Whether it be to implement an entire application, or just solve little problems here and there. Because I'm doing this in my off time, and don't have a lot of bandwith to solve big problems, I plan on solving problems from Project Euler. That way, I can focus more on learning the language than coming up with problems to solve.

Julie
I'm also doing project Euler in my spare time, with Scala. :)
Lars Westergren
+1  A: 

besides the Artima Venner/Spoon / Odersky book, pragmatic is also doing a book which should be in beta PDF soon:

http://pragprog.com/titles/vsscala/programming-in-scala

Gene T
+1  A: 

O'Reilly is also writing a book on Scala, about time, I need all of the help I can get....

http://www.al3x.net/2008/10/im-writing-book.html

Randin
+1  A: 

How about joining (even if temporary) an open source Scala project that is interesting. - Lift Web Framework - Crank on GitHub a Incrementally Scalable Key Value Storage System.

Both are in Scala and I'm sure there are others.

+2  A: 

I’m finding that converting some of my “hobby” open source projects from Java to Scala, along with the excellent Venner/Spoon/Odersky book has been a huge help.

http://davebsoft.com/applications

http://briccetti.blogspot.com/2009/01/dbschools-overlapping-blobs-and-name.html

Dave Briccetti
+2  A: 

So far, the Code Commit Blog and Scala By Example proved to be the most invaluable learning resources for me. (Your mileage may vary, depending on your programming records.)

In practice (learning by doing is best!), you should start with transforming one of your former minor Java projects (or a module of them) and you shall see how boilerplate is eliminated and the need for complex frameworks is disappearing quickly!

thSoft
+3  A: 

Why not write your specifications/tests for your java code in Scala?

You can have a look here (in the "Unit testing" paragraph) for a set of available libraries:

I personally would advise to go with specs (haha, I'm the author,...) or ScalaTest.

Eric.

Eric
+1  A: 

I'd suggest pipe programming. :-)

Do you use Unix? Have you ever written long sequences of grep, awk, cut, sort, uniq, sed, wc and such commands piped together? If not, sorry, my answer is not for you. If you have, though, you'll find yourself written similar code in Scala.

It's mostly about collections. You think of Sets, and Lists, and Arrays and Sequences... You don't need to worry much about what type of data you have -- you can easily convert from one type to another.

Learn the basics of using those structures. Look up 99 Scala problems (based on 99 Prolog problems) on the Internet, and try these exercises. This will give you the basics of manipulating those types.

Next, start beefing up on map, flatMap, exists, forall and filter. These are the workhorses of collections. It's like grep&sed. Try replicating pipe commands in Scala (scala.io.Source makes it easy to generate lists from file lines).

After that, get the Scala API and pay attention to the methods defined in all collections. Think of creative uses for them.

That's what did it for me in the end.

Daniel
+1  A: 

Some tutorials here: http://reboltutorial.com/blog/category/scala/

Rebol Tutorial