Thu, 01 Jan 2009
I recently watched the first in the series of the Pragmatic Programmers Erlang in Practice Screencasts (by Kevin Smith - no, not that Kevin Smith). As I've not seen them discussed that much else where I thought I'd jot down my thoughts.
First up a disclaimer/warning - I'm not an Erlang person and despite the title of 'Episode 1' this series of screencasts is not aimed at people with no experience in the language. If you want to learn Erlang then I'd suggest you read Programming Erlang instead. Once you've been through the book then you should consider coming back to this series.
Now, to look at the screencasts from a different angle - production quality and value for money. Despite not knowing enough Erlang to understand all the code presented, I found the quality of the screencast to be perfect for watching on a laptop. The video was clear, the presenters voice didn't make me want to kill him (although this is a highly personal thing) and at five dollars the price was right for an hours worth of content.
So would I buy another one? Yes, but not this series. Until I get a chance to work my way through the Erlang book this series is off limits to me, The Ruby Object Model and Metaprogramming on the other other hand is mighty tempting for under five UK pounds...
Sat, 08 Nov 2008
- file_move_safe(move_from_path, move_to_path) + move_file(move_from_path, move_to_path)
Is move_file not as safe as file_move_safe? Is it safer? Dare I read the other diffs to find out? Am I better off not knowing?
Dynamic Languages and joining arrays
I've been spending a fair amount of time recently trying to choose my Language of the year for 2009. I've always been a dynamic language fan (yes, I know this means I should be looking further afield for the next one) and I was surprised at how different even such a common task as joining all the elements of an array together, using a given separator, looks between them.
First let's look at the big three, including perl, my current favourite.
# perl $ perl -d -e 1; DB<1> my @names = qw( A B C); DB<2> print join(" : ", @names), "\n"; A : B : C # python >>> names = ['A', 'B', 'C' ] >>> " : ".join(names) 'A : B : C' # ruby irb(main):009:0> names = [ 'A', 'B', 'C' ] => ["A", "B", "C"] irb(main):010:0> names.join(' : ') => "A : B : C"
The perl approach is very procedural (ignore the use of the debugger as perl doesn't come with an excellent REPL in the core like the other two) and is the one I'm most familiar with so it's hard for me to be too critical about it. If you like OO then it's not for you.
Next we have Python, which is really growing on me as a language - apart from in this case. Putting the separator first and passing the list in as a parameter just feels very wrong and is the exact opposite of the ruby version, which I much prefer. To me the ruby approach of operating on the array is the most natural version and sits well in my head. As a small 'bonus' I also looked at the PHP equivalent -
# PHP $array = array('A', 'B', 'C'); echo implode(" : ", $array);
This is close enough to the perl version that I can't really object to it, other than to (rhetorically) ask why the hell it's called 'implode'?
I guess all I can say in summary is round one to ruby.