views:

179

answers:

5

I'm going to be giving a short (30-40 mins) lunch-time talk on Scala to technical staff at my company. I'd like some suggestions for what would be the most appropriate content. Most people attending will have experience in Java and/or C# (plus various other languages).

What are the key things to cover? I'd like to give a brief introduction to the Scala syntax so that people don't feel lost when looking at code examples. I'll also cover some of the history behind the language and its designers. What would help people get the most out of the talk?

+13  A: 

People are almost certainly coming to talk to get an answer to the question, "Why should I use Scala?" Anything you can provide to help them answer that will be valuable.

  • Keep the discussion of the history and the personalities behind Scala to a minimum.

  • A whirlwind tour of the syntax is useful, but keep it short.

  • Spend a good chunk of the talk demonstrating examples and comparisons to Java. Show cases where Scala shines. You should literally be running and executing code so that people get a real, hands-on feel for how things work.

  • Make sure to cover weaknesses, too! Provide an objective and balanced overview.

John Feminella
+1 Excellent (the first point in particular).
Dario
I think that Martin Odersky's pedigree is relevant. This is not a language which has come out of the blue - it was designed by the author of the Java Generic compiler
oxbow_lakes
@oxbow_lakes: I think it's relevant too, but in a 30-minute talk, there isn't time for an in-depth discussion of the origins of Scala and how it came about. A few short sentences will suffice before moving on. People are there to learn how it's relevant to them, and that's it.
John Feminella
I really am not sure I agree. One of the prime "why should I learn Scala?" concerns is that the language is not here to stay. Emphasizing those behind it (if briefly) goes a long way to allay those concerns
oxbow_lakes
+4  A: 

Tough. One has to balance the new and the familiar. For instance:

  • Talk about traits, how they differ from interfaces and multiple inheritance. Note that most methods in all of Scala collections can actually be found on the trait Traversable, which has a single abstract method: foreach.

  • Speak of functions and partial functions, show map/filter/foreach, and how they make use of functions.

  • Talk about pattern matching -- show how unapply is used to enable representation independence, while at the same time case classes make the common case easy.

Above all AVOID any topic that might be difficult to understand quickly, or you may waste time on them. For example of great topics I wouldn't talk about: self types, variance, for-comprehensions.

Pick more topics than you have time for. Let the public steer the conversation towards the topcis they are more interested in. If anyone starts to boggle down a topic too much, say you'll be pleased to explain it in more details later, and ask if they would mind if you moved to another topic. On the other hand, if everyone seems to be picking up on one thing in particular, stay with it. Otherwise, it might feel like you want to hide something.

Daniel
I've found pattern matching to be another stumbling block for people with Java / C background that gets bogged down with details. I introduce it superfically as 'if/else' on steroids, in which the action taken can access re-use values found in during the predicate evaluation, but omit the details about extractors.
retronym
+5  A: 

I gave a similar talk - mostly to those with a Java background. I felt that taking a piece of real Java (about 30 lines) and iteratively adding scala features worked pretty well. The 30 lines of Java eventually ended up as 6 (six!) of scala. The point being (of course) that 6 lines are more readable and maintainable than 30.

I converted the scala to line-by-line Java equivalent and then introduced:

  • Type inference
  • Option
  • Closures
  • Pattern-matching (on lists)
  • Type aliases
  • Tail recursion

I found that this segment took quite a long time because the audience were very interested in the minutiae of scala's syntax (especially around function-expressions). Before undertaking the pattern-matching bit, I had a slide explaining the various things you could use in a match.

oxbow_lakes
+1  A: 

You could do worse than running through Jonas Bonér's presentation, Pragmatic Real-World Scala. Perhaps skip some advanced topics in there on different applications of traits and self-type annotations.

retronym
+2  A: 

I gave a presentation on re-writing Java classes in Scala. It has lots of examples of Java -> Scala and (hopefully) makes the gains obvious. Feel free to borrow any content you want... presentation took 1hr 10minutes so you might want to cut some stuff out.

Presentation: http://www.colinhowe.co.uk/downloads/rewriting-java-in-scala.ppt

Video: http://skillsmatter.com/podcast/java-jee/re-writing-java-classes-in-scala-and-making-your-code-lovely

ColinHowe