Typo update

Posted by Rick DeNatale Tue, 19 Jun 2007 16:02:00 GMT

I finally spent some time yesterday to update this blog to use the latest version of typo.

Things were a bit shaky for a while so there might have been some trouble getting to the site. I ran into a bug in typo database migration and had to do some creative mysql work to get back to normal

Things should be working now. Let me know if there are any surprises.

Posted in  | Tags  | no comments | no trackbacks

A Meeting with "Gill Bates"

Posted by Rick DeNatale Fri, 15 Jun 2007 20:27:00 GMT

A recent thread on ruby-core which touches on the issues of subclassing prompts me to tell another war story.

Back in the late-1980s to early 1990s, the software industry was starting to warm to the possibilities of object-orientation. I’d gotten to be seen as one of the experts on OO inside IBM so I found myself in a series of interesting meetings, but inside IBM and with other companies.

That’s how I found myself at the headquarters of a well-known company in the Seattle area which at that time was one of IBM’s major partners. This company was the major supplier of IBM’s operating systems for personal computers. I don’t want to give too many hints, so I’ll give a pseudonym to the CEO, let’s just call him “Gill Bates”, and I’ll refer to the company as “BigSoftware” or “BS” for short.

Read more...

Posted in  | Tags , , ,  | 2 comments

Polishing That Chain

Posted by Rick DeNatale Tue, 12 Jun 2007 21:22:00 GMT

A few days back I wrote this:
The metaclass’ superclass is set to the metaclass of the classes superclass.

Since I first wrote it I’ve gotten some feedback that the last sentence is a little hard to digest, so I’ve added an example.

Let’s say we create a class MyNiftyClass as a subclass of Object. The singleton class of the class object referenced by the MyNiftyClass global gets created at the same time as class object, no waiting for one of the things which trigger the creation of a singleton class for a non-class object. Thesuperclass of the MyNiftyClass is set to object, and the superclass of MyNiftyClass’ metaclass is set to Object’s metaclass.

Besides the fact that their creation occurs immediately, there is one other difference between singleton classes of objects and singleton classes used as metaclasses. The later can have subclasses, while the former cannot.

I’ve gone back and editted the original post, but I’ve summarized it here in case anyone else has actually already read it.

Posted in ,  | 1 comment

Die Hard?

Posted by Rick DeNatale Tue, 12 Jun 2007 15:24:00 GMT

At the last meeting of the Agile RTP group, I won Michael T. Nygard’s book Release It! which I’m reading as a background task. This morning I ran across this:

Interpreted languages such as Java and Ruby almost never crash. Sure they get application errors, but it’s relatively rare to see the interpreter or virtual machine crash. I still remember when a rogue pointer in C could reduce the whole machine to a navel-gazing heap.

I remember “back in the day” when there were endless arguments between the C++ and Smalltalk advocates. The C++ folks would often quote Bjarne Strroustrup’s fear of flying in an airplane whose flight control system was written in Smalltalk, and threw a “message not understood” exception.

Those of us in the Smalltalk camp found this amusing, since the alternative was a system crash caused by an invalidpointer.

Now maybe Nygard framing rogue pointers in C as a memory means that the problem has been solved, but I seem to recall having seen it recently.

It’s Not Just The Language Stupid

One point here is that pet-features such as strong vs. dynamic typing or garbage collection vs. allegedly more performant[1] manual memory management aren’t panaceas. They can have a major effect on aspects such as easo of development, or tweaking out the last bit of performance, sometimes in non-intuitive ways.

Making robust software requires more than just choosing a language, it requires craftmanship, adherence to best practices for the chosen language(s) and technologies, and a realistic understanding of the challenges at hand.

Release It!

And that’s where we come back Nygard’s book. Although I assume that most of my readers are Rubyists, and Nygard is a Java guru, there is much of value here for anyone concerned with producing robust software that can stand up to the real world.

Based on what I’ve read sofar, and skimming the rest, I can recommend it. If you’re interested you can buy it directly from the Pragmatic Programmers, or via the amazon.com link. The later would help feed the duckdogs who run this site, and lower my distraction from their gowling stomachs.

[1] The “allegedly” will no doubt be explained in further posts here.

Posted in , ,  | Tags , ,  | no comments

Sapir-Whorf

Posted by Rick DeNatale Mon, 11 Jun 2007 20:32:00 GMT

Recently, I’ve seen the Sapir-Whorf hypothesis used to motivate new spins on old ideas, such as behavior-driven design. For those unfamiliar with Sapir-Whorf it comes from the school of linquistic determnation, and taken to the extreme posits that a person’s language determines the way he or she thinks.

I’m going to post some thoughts about bdd soon, but this appeal to Saphir-Whorf reminds me of an experience I had about 10 years ago.

Read more...

Posted in ,  | Tags ,  | no comments

Update on Continuations

Posted by Rick DeNatale Wed, 06 Jun 2007 21:00:00 GMT

Robert Dober discovered that the continuation example which I gave in last night’s article behaves badly if you run it with ruby rather than irb.

I’ve made note of this in the original article, and I’ve added a simpler example which does work under ruby. I’ll try to come back with a new article which shows an example of how continuations are normally used.

Posted in ,  | Tags ,  | no comments

Money is the Root of all ..

Posted by Rick DeNatale Wed, 06 Jun 2007 03:16:00 GMT

$. Or at least implicit $

Just seen on ruby-talk:

|If we call gets(), the returned string is copied to a special variable $_
|Do we have such things for getc(), too?
No, implicit global variables are evil. I’d rather remove $_ in the future.

matz.

Maybe the reason that Matz picked $ as the sigil for global variables wasn’t to follow perl!

And this just after we learn that “Fahrenheit-451” was about the dangers not of government censorship but of TV.”

Posted in ,  | Tags  | no comments

Closing in on Closures and Jumping into Continuations

Posted by Rick DeNatale Wed, 06 Jun 2007 01:41:00 GMT

Recently on ruby-talk someone asked if continuations and closures were the same thing.

They are related in that they both are tied to a particular point in time in the execution of a program. The difference is that closures are like a souvenir of a trip, while continuations are like a kind of time-machine. Read more...

Posted in ,  | Tags ,  | no comments

Ruby Extensions vs. Smalltalk Primitives

Posted by Rick DeNatale Mon, 04 Jun 2007 14:16:00 GMT

One of the ways in which Ruby differs from Smalltalk is in how much of the implementation is buried in C, which forms a barrier for deep understanding.

For the purposes of this article, I’m going to use the term extension a little loosely to refer to both core library and extension code written in C.

For example, in Ruby, much of the code which implements core classes like Array, is implemented by C code. This is good for performance, but for those with a need or desire to grok the code, not so much. In contrast, Smalltalk has a large brigade of Collection classes which are written in Smalltalk.

This is not to say that Smalltalk doesn’t use the equivalent of extensions. Smalltalk calls them primitives.

There are some interesting differences which might be interesting for the Ruby Core team to ponder, if they haven’t already.

Read more...

Posted in ,  | Tags , , ,  | 3 comments

Chain, Chain, Chain

Posted by Rick DeNatale Sat, 02 Jun 2007 22:28:00 GMT

I’ve noticed some confusion lately on the part of some newcomers to Ruby about how methods are found at runtime, and in particular, the relationship between instance and class methods.

A week or so ago, someone posted some questions on ruby-talk about this issue, and then today I ran across this blog review of David Black’s “Ruby for Rails” which contained this:

On every method call, Ruby will search its object space in the following order:
  1. Current instance, followed by class methods
  2. Mixed in methods
  3. Superclass instance (repeat 1)
  4. Object methods, followed by Kernel mixin

I often get confused with mixin, class, and instance method precedence, so this is a useful model to revisit and keep in mind.

I don’t know where that reference to class methods in item 1 came from. I don’t think David said that in his book.

Here’s how it really works

Here in the form of answers to the questions posed on ruby-talk last week is my explanation of how Ruby finds methods when a message is sent to an object

Read more...

Posted in ,  | Tags , ,  | 1 comment

Older posts: 1 ... 7 8 9 10 11 12