Posted by Rick DeNatale
Thu, 20 Sep 2007 15:36:00 GMT
On ruby-talk, Sammy Larbi recently asked if it would make sense to add a length method to Range, something like this:
class Range
def length
self.end - self.begin
end
end
This led to an interesting discussion about the varieties of ranges, and ultimately led me to this article about duck types.
Read more...
Posted in ruby | Tags ducks | 3 comments | no trackbacks
Posted by Rick DeNatale
Thu, 20 Sep 2007 13:20:00 GMT
Obie Fernandez just went off about Java vs. Ruby/Rails.
No time to comment, read it for yourself.
Posted in ruby, rails | Tags languagewars | 1 comment | no trackbacks
Posted by Rick DeNatale
Tue, 11 Sep 2007 23:24:00 GMT
One of the Rails mantras is “Convention over configuration.” Today I bumped up against that one in spades.
Being an agile sort of guy, I tend to make frequent small refactorings, ofen this involves renaming things. I’m working on a project which will involve talking to a remote legacy database. I’m building migrations to set up a
local development database which mirrors the schema of this database. I’d already generated a migration, and while
working on it decided that it needed to be renamed. So I changed it to something like “007_create_LEG_Frammis_table.rb” since the legacy table had the name (changed to protect the guilty) of LEG_Frammis.
I was shocked when I ran rake db:migrate only to find that rake blew up. Turning on the—trace option to rake
showed that it wasn’t even getting to my migration code. Instead some code in vendor/rails/activerecord/lib/active_record/migration.rb was getting an unexpected nil and trying to send the message first to it.
A quick look at the code didn’t reveal an obvious reason, so I broke out ruby-debug and ran rake under rdebug.
It turns out that rails REALLY expects migration names to match the regular expression /([0-9]+)_([_a-z0-9]*).rb/, those uppercase characters were the culprits.
Update
The patch, which Ben mentioned that he submitted in his comment, has been turned down because it would violate the assumption that round trips can be made between class names and file names.
Posted in rails | 1 comment | no trackbacks
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
Mon, 03 Sep 2007 01:08:00 GMT
Some months back, I got the opportunity to work on an existing web site,
implemented in Rails, which uses PayPal subscriptions to control access.
Since them, I’ve learned more about PayPal subscriptions than I cared to. Today’s revelation on Slashdot of the
latest paypal subscription glitch prompts me to share a bit of this hard-earned knowledge.
Read more...
Posted in rails | Tags activemerchant, paypal | no comments | no trackbacks
Posted by Rick DeNatale
Sun, 02 Sep 2007 21:35:00 GMT
I’m catching up on my RSS feeds this afternoon, and I just ran across the
latest from John Lam. Which exposed an interesting coincidence.
Oh yes, Merlin is the original code-name for our team, which was originally IronPython but has now expanded to include the Dynamic Language Runtime and IronRuby.
- John Lam
The codename for IBM’s original VisualAge project was “Camelot.” Various subcomponents
and follow-ons were dubbed with various names from Arthurian legend. For example, there
were components with names like “Lancelot” and “Guinivere.”
Sometime after the initial success of VisualAge, it was decided that IBM would actually
produce a separate Smalltalk language and IDE packaging, a product which was originally named
“IBM Smalltalk” at launch.
But during development IBM Smalltalk had Arthur’s wizard as its namesake. As usual there
were tee shirts, and this article starts with a picture I just took of my copy of the IBM
Merlin Tee, which my wife still uses as an exercise tee.
And in case you can’t read them, the words in the
crystal ball read “think BIG/TALK small” a combined reference to IBM, Smalltalk, and I suppose, Teddy Roosevelt.
Now old Merlin might look more like a Swami than the wizard of Camelot, but here’s the proof
from the front of the shirt:
So to paraphrase my old buddy Kent Beck, I knew that Microsoft was trying to implement
Ruby, but I didn’t know it would be called Merlin!
Posted in ruby, war_stories, smalltalk | Tags ibmsmalltalk, ironruby | no comments | no trackbacks
Posted by Rick DeNatale
Sun, 02 Sep 2007 20:52:00 GMT
In my thirty-two year career at IBM, I can’t begin to count how many times I was bothered by
the IBM software development process.
When I started, in 1974, I found myself trying to swim under the waterfall. Everything
hinged on “Requirements Documents,” “Initial Functional Specs,” “Design Reviews,” etc.
Managers were constantly wanting line of code estimates. Far more effort was wasted on
process rather than progress. Sometimes the process overhead was fatal. My first project at
IBM was part of IBMs major initiative in the 1970s to replace the IBM/370 with a new system
called “FS”. One of my heroes at the time was John Sowa who worked in the architecture
department and whose role seemed to be the resident iconoclast. In one of his memorable
memos available on his web site,
John made the observation that the system architecture specification comprised fifteen
registered IBM confidential documents, each with an individual need to know. A fact which
effectively prevented anyone in the company from understanding the system
and its problems.
So, it should be no surprise that I came to an appreciation of what are now called
agile methods, early on in my career, and fought for the processes and technologies which
enable agility inside IBM, and evangelized such approaches to IBM customers.
Fred George was one of my allies during part of this struggle. Fred was a middle-level IBM
manager who came to the IBM lab in Cary, NC about the time we started using Smalltalk, and
I was developing a prototype application development tool which morphed into VisualAge.
I worked in Fred’s organization and claim influencing him on dynamic OO technology, and agile
methods.
Fred now works for ThoughtWorks, and blogs about agile methods. Recently he has been
writing about how to push back against bean-counting. I get the sense that Fred shared
many of my frustrations with the old IBM process.
Posted in war_stories | Tags agility, IBM | no comments | no trackbacks