{ by david linsin }

February 26, 2008

Reading Code or Writing Code II

For the past couple of weeks I've been checking out Scala, the new object oriented functional hybrid language, you might have heard of. I'm a big fan of the language and slowly starting to grasp the whole functional programming concepts. Although I'm still new to this functional world, it strikes me kinda odd that I'm beginning to change my view on terseness and readability of code. Take a look at this:

I found this code sample in a blog post by Kirilli Grouchnikov. He compared this closure example from Neil Gafter to a none-closure version.To be honest, a couple of weeks ago, when I first read that blog post, I didn't feel comfortable looking at this code. I couldn't imagine ever writing or maintaining something like that. Somehow my view has shifted and I'm beginning to see what this is all about.Another situation that got me thinking was Item 22 of "Effective Java". Joshua Bloch explains how to substitute C's function pointers with a Java implementation of the strategy pattern. When I read that item, for a moment, I thought: isn't that more complicated and more verbose than a function pointer. I tossed that thought aside, since having statically checked interfaces were and probably are still preferable to me. I'm really excited where this is going and just enjoying growing up.



  • mail(dlinsin@gmail.com)
  • jabber(dlinsin@gmail.com)
  • skype(dlinsin)