From: Chris Pine Date: 2002-12-05T23:02:21+09:00 Subject: Re: Ruby Book for People Who Aren't (Yet) Programmers ----- Original Message ----- By the way, I notice in your chapter on strings, you are using single quotes. I'd have to agree with whomever it was earlier who suggested it might be a good idea to start with double quotes, so you don't have to explain "you can also use double quotes ..." when you want to do things like "2 + 2 = #{2 + 2}" later on. ---------------------------- Well, you'd be agree with him, then, because Daniel's the one who said that! My argument was two-fold: 1) With single-quotes, there is less chance that you'll accidentally stumble upon an escape sequence, especially since kids are going to want to bang on the keyboard and print snoopy swearing. 2) Why teach someone "2 + 2 = #{2 + 2}" when they can already build things like: print '2 + 2 = ' + (2+2).to_s? print '2 + 2 = ', 2+2 In any case, new students (and even the rest of us) in practice tend to do this more with strings, so: print 'Hello, ' + name + '! How are you?' This is enforcing ideas like "Strings can be added" (which they already know by the time they are doing variable substitution), rather than adding new (unnecessary) complexities, like 'variable substitution'. Really, I have avoided variable substitution altogether, replacing it with something they already know: string concatenation. In fact, I don't plan ever to teach them this pseudo-variable-substitution; they'll figure it out on their own. Variable substitution often messes up the syntax coloring, too. Not everyone uses vim! My personal feelings about variable substitution was that I put off learning it until I really had to, and I still almost never use it, in favor of string concatenation. I just don't see the point. As my wife (who doesn't program) was reading the pickaxe, she came upon the part describing variable substitution and at first didn't get it. When she did, the first thing she said was "Why do they have this?" Her first assumption was that this was something she *didn't* already know, and didn't see what it was. When I didn't have a good reason justifying variable substitution (at least in terms of what she already knew), she let out a disdainful "Hmmph!" and moved on; clearly, she wasn't going to waste any time on another way to do something she already. My 2 cents, anyway. While I don't think Daniel is focussing on children as his target audience (but I could be wrong?), that is precisely who I am thinking about (despite the obvious irony of using my wife as an example... she does work with kids all day...). :) Chris