Once again enjoying Ruby
After a strange trip through Smalltalk-land, I'm back to enjoying Ruby. As I alluded to in my wrap-up post for 2010, I'm now working with Ruby
more frequently than I was a year ago.
One of my main frustrations with Ruby used to be how slow it was. Now
with Ruby 1.9 & rvm I'm much happier using it. The way that rvm
manages gem sets for you and setting a per-directory .rvmrc file
really makes switching between various rubies & gems for various
projects really easy. I'm working on two projects right now that both use Ruby 1.8.7, but
all my new Ruby development is done in Ruby 1.9 as well as migrating
said 1.8 projects to 1.9.
Another change is that digging into Lisp lately combined with my year
and a half of Smalltalk has given me a new appreciation for Ruby's
meta-programming abilities, each for different reasons. The Ruby code that drives meta stuff might be ugly, but at least its
easy to write & understand. Ruby doesn't have macros in the same way
Lisp does, but after working in Smalltalk what Ruby has is good
enough.
I'm pretty tired of everything being a "pattern" in Smalltalk.
Metaprogramming can be done with Smalltalk but its more tedious than
Ruby because there is no good way to explicitly show the logic you're
using, and you need a class for everything. But that'll be in another
post soon. I once again enjoy development in Rails because of the changes in
Rails 3 too. I still get perpetually annoyed by the occasional gem
that just decides to monkey-patch code at will, but if you use gems &
plugins judiciously and read their code its not too bad. Also, the Lisp code I've been writing for fun has given me a new
appreciation for code-as-data. Ruby can't do that easily, but you can
go the other way and use data structures to generate code. Rails uses
this a little to its advantage, but I've been using that style more
lately for my code too. Instead of writing a collection of small methods to assemble a larger
method, I've been writing more generalized methods that use various
parameters to dynamically look up method & classes (as one example). This results in a Lisp-like coding style where I write a "mini-DSL"
that concisely states the logic then implement the code to drive that. In the end I'm thankful for the ambitious community behind Ruby, and
Rails and all of the great work everyone is doing. It's good to see
problems getting fixed and the technology continually improving. It's
also nice to actually have people living near me who also work with
this stuff daily. I can't say that for Smalltalk or Common Lisp! In my next post I'll outline my qualitative experiences using Common
Lisp vs. (Pharo) Smalltalk.
more frequently than I was a year ago.
One of my main frustrations with Ruby used to be how slow it was. Now
with Ruby 1.9 & rvm I'm much happier using it. The way that rvm
manages gem sets for you and setting a per-directory .rvmrc file
really makes switching between various rubies & gems for various
projects really easy. I'm working on two projects right now that both use Ruby 1.8.7, but
all my new Ruby development is done in Ruby 1.9 as well as migrating
said 1.8 projects to 1.9.
Another change is that digging into Lisp lately combined with my year
and a half of Smalltalk has given me a new appreciation for Ruby's
meta-programming abilities, each for different reasons. The Ruby code that drives meta stuff might be ugly, but at least its
easy to write & understand. Ruby doesn't have macros in the same way
Lisp does, but after working in Smalltalk what Ruby has is good
enough.
I'm pretty tired of everything being a "pattern" in Smalltalk.
Metaprogramming can be done with Smalltalk but its more tedious than
Ruby because there is no good way to explicitly show the logic you're
using, and you need a class for everything. But that'll be in another
post soon. I once again enjoy development in Rails because of the changes in
Rails 3 too. I still get perpetually annoyed by the occasional gem
that just decides to monkey-patch code at will, but if you use gems &
plugins judiciously and read their code its not too bad. Also, the Lisp code I've been writing for fun has given me a new
appreciation for code-as-data. Ruby can't do that easily, but you can
go the other way and use data structures to generate code. Rails uses
this a little to its advantage, but I've been using that style more
lately for my code too. Instead of writing a collection of small methods to assemble a larger
method, I've been writing more generalized methods that use various
parameters to dynamically look up method & classes (as one example). This results in a Lisp-like coding style where I write a "mini-DSL"
that concisely states the logic then implement the code to drive that. In the end I'm thankful for the ambitious community behind Ruby, and
Rails and all of the great work everyone is doing. It's good to see
problems getting fixed and the technology continually improving. It's
also nice to actually have people living near me who also work with
this stuff daily. I can't say that for Smalltalk or Common Lisp! In my next post I'll outline my qualitative experiences using Common
Lisp vs. (Pharo) Smalltalk.

Also, I can't wait for your post on metaprogramming comparison between Smalltalk and Ruby.
You can dynamically create classes & methods in Smalltalk, but most metaprogramming I've seen and made isn't so much programming as just complicated class lookup & method dispatching. Typically one would outline some logic in the doesNotUnderstand: method that does method dispatch to other methods, however those method names are up to you to name.
So your method names end up being programming by convention if you want the names to clue you in on anything. You also have method protocols, but I've found those are typically out of sync with the latest updates in my code and other libraries I've used.
It'll be a month or two until I get the post about Ruby vs. Smalltalk metaprogramming up. So be patient :)