Language unfamiliarity and design decisions breed frustration

June 2, 2009 at 9:40 pm (Scala, Week 11) (, )

Today was all Scala, all the time. I came in thinking that I knew my stuff after my refactoring discoveries yesterday, but I quickly took a detour into Frustration-Land as I hacked away on Tic-Tac-Toe.

I struggled with some design decisions, as I wanted to do things from scratch and avoid too many parallels with my Java version. These problems I can’t really blame on my noob-ness with the language; I’m just trying to shift my paradigm to a more functional style. I don’t know yet if I’ll be implementing a GUI for my Scala version (apparently there’s a way I can hook into Swing), but I’m trying to think ahead, since I had lots of issues when moving my Java version from console to GUI. I’m debating whether to have my Player classes (driven by my Game class) waiting for input from my event listeners – I got the impression that this design (which I used in Java) was kind of unorthodox – or if I should instead have the application flow driven more by the events. I’m leaning in that direction, but need to do some more whiteboarding and reading. I did quite a bit of reading on and practice with the Actor model to see if I might be able to apply it to GUI event and game messages, but I’m concerned it might be an extra layer of complexity that’s unneeded.

My woes with Scala were basically due to me not knowing the libraries, and that will definitely come with time. I bought a book last night: Programming in Scala by Martin Odersky (the language creator), Lex Spoon, and Bill Venners. I’d checked out a bit of Dean Wampler and Alex Payne’s online book draft, which is great, but I just like having paper – I stare at the laptop enough during the day.

When I moaned that I had been a little frustrated today with my (lack of) progress on Tic-Tac-Toe, Micah pointed out tactfully that I had kind of jumped into things before really learning much of the language. It’s true – I felt like I needed to be constantly writing tests and typing code today, but what I should probably have done is take a step back and spend some time learning the language: reading, code kata, and typing examples from the book. I’ve spent some time tonight catching up on the language, and I’m going to continue some practicing now. There’s a lot to be said for applying a brand-new language (and paradigm) to a problem, but the less familiar the language, the more work I need to do before I feel comfortable in an actual project.


1 Comment

  1. Micah said,

    Jumping right into the code is not a bad thing at all. Although I can understand your frustration as I imagine you have to look up Scala tidbits regularly. But there’s nothing like the need for knowledge to help you retain the knowledge.

    I would have been skeptical had you decided to read the book, cover to cover, without writing a line of code.

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: