An interlude

Over the holidays I became distracted by another project; I stumbled across this post on MetaFilter and started to wonder about how best to model and implement a hexagonal map grid in software.  I’ve spent a bit of time banging together the bones of an implementation in Scala, which the curious can find on github at my account.  Here are some notes from the experience:

  • The Scala API documentation leaves something to be desired, especially when approaching it as a beginner.  In particular, it could use a good deal more examples, as well as explanatory text containing links to relevant classes.  In fairness, this is something the Java API docs also suffer from, and it might be that my own inexperience is at the root of the problem.
  • The Scala IRC channel was extremely helpful; some of its inhabitants gave me advice on some syntax problems I was having (it would have been very difficult to google these) and advice on how to better structure my code.
  • Somebody on the IRC channel described Scala’s Enumerations as a failed experiment, a description which did not surprise me after I tried a use one as a key to a Map.  It seems that case classes (or more precisely, case objects) are probably the way to go for these, in the absence of a Lisp / Ruby – like “symbol” class.  There are more details about this at this blog post.  I may be missing something, but the Scala enumeration class seems less type-safe than the Java implementation does, which is not a common occurrence.

I will probably mess with the hex map stuff a bit more before going back to the random-album-cover project, as it will be a good opportunity to mess around with type parameters and storage in Scala, as well as letting me dust off some graph traversal algorithms.

Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: