Showing posts with label san francisco. Show all posts
Showing posts with label san francisco. Show all posts

17 October 2008

October's Bay Area Scala Enthusiasts Meetup, Part 2

I promised some technical notes on the Bay Area Scala Enthusiasts meetup earlier this week, so here we go.

Coding Guidelines

As I mentioned previously, the presentation by the Twitter folks focused on the informal guidelines they have been using internally for Scala coding (PDF of their presentation). I like their guidelines generally. Something that may be controversial in the guidelines is their policy not to use implicits. DSLs especially can make good use of implicits, so I would imagine that would have to be the exception to their rule. Maybe someone should take their coding guidelines as a starting point to make a coding guidelines page on the Scala Wiki?

Structural Types

One of the topics mentioned at the meetup was structural types, which I hadn't used before, so I checked them out. Structural types seem to be a way to accomplish the same sort of "duck"-typing that you can do in Ruby and Python. Let's say you don't care about what the inheritance hierarchy of a parameter is, just that it can perform some operation. There are at least two ways to do this: traits or structural types.

Using traits:
trait Jumpable {
def jump() : Unit { print("Jumping!") }
}

class Bunny extends Jumpable { ... }
class PogoStick extends Jumpable { ... }

class Controller {
def makeThemJump(jumpers: List[Jumpable]) = {
jumpers.foreach { jumper =>
jumper.jump()
}
}
}
Using structural types:
class Bunny { def jump(): Unit { print("Jumping!") } }
class PogoStick { def jump(): Unit { print("Jumping!") } }

class Controller {
def makeThemJump(jumpers: List[{ def jump(): Unit }]) = {
jumpers.foreach { jumper =>
jumper.jump()
}
}
}
The Twitter guys pointed out that it might be a good idea to avoid structural types due to their use of reflection, which may be slow.

Dependency Injection


How to use dependency injection (DI) with Scala was brought up. There was some argument on how applicable DI was in Scala, with developers coming from a Java background supporting it and those with a Ruby background questioning its relevance to Scala. Either way, this in depth article by Jonas Bonér was brought up.

Development Environment

There was a short discussion on what ide/editor people were using for Scala. The Twitter guys were using TextMate or Emacs, and a few people in the audience mentioned Eclipse and NetBeans. I am really curious what luck developers have had with the different environments. I am using NetBeans right now, but I am not completely happy with it. Can anyone make any recommendations?

15 October 2008

October's Bay Area Scala Enthusiasts Meetup

Tonight I attended a meeting of the Bay Area Scala Enthusiasts, a user group focused on the Scala programming language. The meeting was held at Twitter's office in San Francisco, only a few blocks from my company's office, so it couldn't have been more convenient for me. I expected to encounter around 5-10 people there, but I was surprised when around 30 had gathered. The Scala community is definitely growing!

Alex, Steve, and Robey from Twitter hosted the meeting, and explained how they are using Scala at Twitter. They are using it both in middleware and in front-end code and seem to be committed to expanding its use in Twitter-- good things for Scala and Twitter both. Their main presentation focused on establishing a set of coding conventions for the Scala community, which I think could be a really good help for new programmers to have some structure. Robey showed us some of his open source code up on github, including configgy, which I plan to take a serious look at soon.

Some other interesting discussions at the meeting included preferred development environments and strategies to deal with the paradox of being paralyzed by having multiple ways to accomplish the same thing in Scala, usually at least a functional and an object-oriented way of doing things. The concensus seemed to be that each group will ultimately end up with their own style or Scala programming, somewhere between the extremes of writing Java in Scala or Haskell in Scala.

We also learned that there are no less than three Scala books in the works:
  1. Programming in Scala by Odersky, Spoon, and Bill Venners (who was also present and shared some good stories about his experiences in the language as well as the origin of the "/:" operator)
  2. Programming Scala: Tackle Multi-Core Complexity on the Java Virtual Machine by Venkat Subramaniam
  3. Programming Scala by Alex Payne and Dean Wampler, published by O'Reilly
Notice a pattern in the titles?

All in all, a great meeting where I meet some very interesting people. It's great to see the community of Bay Area Scalists so... well, Enthusiastic :)

Update:
Added exact authors of the new O'Reilly Scala book.