Posted by Rick DeNatale
Tue, 04 Sep 2007 15:28:00 GMT
I’ve noticed that some rubyists like to use indentation to delineate method visibility.
The first time I noticed this was when Marcel Molina Jr. used it during the
charity testing workshop at the Ruby Hoedown.. I just encountered it again in at least one piece of sample code from Rob Orsini’s “Rails Cookbook.”
During the testing workshop, Chad Fowler expressed displeasure with this style, and I’ve got to agree.
Read more...
Posted in ruby, best_practices | Tags metaprogramming, style | 6 comments | no trackbacks
Posted by Rick DeNatale
Wed, 16 Aug 2006 15:03:18 GMT
An old programming adage goes: “You can write Fortran in any language.”
Computer languages, like natural languages, tend to spawn their own cultures and religions. And it’s not unexpected that the groups associated with these have different slants on things.
One of Ruby’s strengths is that it stole from the best. When I look at the language, it feels like Matz took the best features from a variety of languages including Smalltalk, Lisp, and not the least, Perl.
Two great features which Ruby inherited from Perl are integral support for regular expressions, and Perl’s excellent statement modifiers which allow things like:
to be replaced with the more succinct and usually clearer:
However,
IMHO, overuse of the Perl features in Ruby can make code
too Perl-like.
I’ve seen my share of Ruby code which is hard-to read and understand, and a lot of that looks suspiciously like Perl code re-written in Ruby.
Read more...
Posted in ruby | Tags literateprogramming, peeves, perl, style | no comments | no trackbacks