From: "David A. Black" Date: 2009-02-19T04:52:43+09:00 Subject: Re: What are your favorite Ruby features? --1926193751-484023248-1234986773=:17102 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-484023248-1234986773=:17102" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-484023248-1234986773=:17102 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Thu, 19 Feb 2009, Juan Zanos wrote: > > On 18 f�vr. 09, at 10:04, David A. Black wrote: > >> This message is in MIME format. The first part should be readable text, >> while the remaining parts are likely unreadable without MIME-aware tools. >> Hi -- >> >> On Wed, 18 Feb 2009, Juan Zanos wrote: >> >>> >>> On 18 f�vr. 09, at 09:07, Robert Dober wrote: >>> >>>> On Wed, Feb 18, 2009 at 2:38 PM, Rick DeNatale >>>> wrote: >>>>> On Tue, Feb 17, 2009 at 2:40 PM, David Masover >>>>> wrote: >>>>> def foo bar >>>> That is very hard to read indeed, but why? >>>> def foo( bar ) >>>> This is not so much better! >>>> We are all totally accustomed to the fact that foos and bars designate >>>> the same kind of thing. >>>> I therefore think that >>>> def fact n >>>> is more readable for most people than >>>> def n( fact ) >>>> which is nonsense of course (in the particular context). >>>> Naming seems more important than params or not params (of course if I >>>> might say?). >>> >>> Good point. Syntax isn't all there is to readability. But it does have >>> some effect. >>> >>> In this case the parenthesis don't make anything inherently more readable >>> and aren't helpful in resolving the nonsense names. The parenthesis are >>> only meaningful if you already know what they mean. Readability arguments >>> are often tainted by experience with previous languages. And it must be >>> remembered that no programmer is born knowing a previous programming >>> language. If we insist, implicitly or otherwise, that readability means >>> that something looks like 'C' or Java or any other language then we place >>> limits on how much we can simplify syntax. I'd actually say that each >>> example with parenthesis requires a lot more explanation of why they are >>> their, what they mean, what are the syntax rules that govern them, etc. >> >> I agree (except for your last sentence). I honestly don't give C or >> Java (or Lisp, etc.) a moment's thought in any of this, when I'm >> writing Ruby. Just Ruby. >> >> One thing I've had to come to terms with, reluctantly (because it >> would be so nice if it were otherwise), is that there is literally no >> such thing as inherent readability. Readability simply does not inhere >> in the notation, any more than it does in a given alphabet. > > Ok. We don't have to agree completely. We both seem to agree that there are > arbitrary aspects to syntax conventions that do not inherently affect > readability. Perhaps where we disagree is that I do believe something can > be inherently more or less readable and you do not. I believe that overly > complicated syntax becomes less readable and even more unwritable. So I > tend to prefer a simpler syntax even if it's slightly different from a > particular convention. That just offloads the subjective judgment onto the concept of "overly" :-) I guess it comes down to this. If someone says they find def m a, b, c=1 clearer or more readable than def m(a,b,c=1) I have no idea what they're talking about -- but I have to assume they really do find it more readable, and that whatever is going on in their brain when they look at the first version is similar to what goes on in my brain when I look at the second. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) Ruby Training Atlanta! April 1-3, http://www.entp.com/training/atlanta09 --1926193751-484023248-1234986773=:17102-- --1926193751-484023248-1234986773=:17102--