From: Kevin Smith Date: 2001-09-21T14:21:09+09:00 Subject: [ruby-talk:21479] Re: Ruby/objects book in style of The Little Lisper --- Christopher Sawtell wrote: > > The question is: can I pull it off? To see, I wrote the > first chapter, > > which you can find here: > > > I think it's promising. I do think you could pull it off, but it's definitely not "there" yet, for me. I haven't read the original, so I have no idea how this compares in style. A few comments, which you can take or leave as you wish: 1. Pet peeve #1: factorial should not be implemented using recursion. It's just a loop. Simpler. Faster. Safer. # warning: untested code ahead! def factorial(n) result = 1 n.downto(2) do | value | result *= value end return result end 2. Pet peeve #2: programming books that focus on math. I don't mind having factorial in there somewhere, but putting numbers first will turn off a lot of non-math folks, I think. 3. The first function in your book is pretty complex. I would tend towards something simpler. In the numbers realm, a method that returns n*n, or n*2. In the words realm, a method that always returns "Bob" or something, perhaps? 4. The persona on the right seems more knowlegable than I would expect. Describing the factorial function in English would be reasonable, for a math-person, I suppose. But a non-math person won't be able to relate. I was surprised that the right side introduced most of the terms, like "while loop", "message", "argument", and "self". I guess it's part of the style. 5. Naming a method factorial2 is confusing. I thought it might be factorial 2 aka factorial(2) at first. 6. To answer your question about "object variables", I do in fact call them "object members" sometimes. Perhaps you could postpone "instance", or just punt and say they're called instance variables "just because". 7. The pace so far seems somewhat uneven. Sometimes we jump ahead further than I'm comfortable with, or make passing references to things we haven't covered yet. I chalk all of that up to it being an early draft. If it's something you want to do, I say "go for it!" Be sure to get plenty of feedback from typical members of your sample audience so by the time you publish it's a gem. Kevin __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/