From: Robert Klemme Date: 2005-10-06T21:26:49+09:00 Subject: Re: Object Orientation Dave Howell wrote: > On Oct 5, 2005, at 8:56, Robert Klemme wrote: > >> Krekna Mektek wrote: >>> By the way, why are methods not named following the >>> lowercaseUppercase convention, as in Java? >>> This way I can see more directly that something is a method, and not >>> an instance variable. >>> >>> I'd like to do it that way, but am not sure if this is against some >>> Ruby philosophy.. >> >> No problem with that. It's just, um, that you will die a slow and >> painful >> death if you use CamelCase. Don't ask me how it works - it's Matz >> Magic(TM) built right into your Ruby runtime. > > I've always found underscores hard to type and annoying to read, so > I've never used them in any of my programming. > > All of my code looks like > > def newMartini > attr_reader :withOlive > > def initialize(dryness) > > end > > def shakenNotStirred > end > end > > and so on. It's regrettable (and generally a poor design choice) that > case is significant, so you can't capitalize the initial character of > methods or variables, but other than that, name them as you like. > > ++ warning: rant below ++ > > [Why a poor design choice? Because except for certain specific > enclaves in computer programming (e.g. Unix, but not Mac, not > Windows, not DEC VAX, not BASIC, not Pascal, not REXX, and not > Modula-2, to draw from personal experience), case isn't > "significant." Including, oh, the entire rest of the world's written > literature. Nobody thinks that Dave and DAVE and dave are three > different people, or that a Ph.D is different from a PH.D. Recipes > can have Tbsp or tbsp, and on and on and on. You'd have to look long > and hard, or find a Unix programmer, in order to find somebody who > thought WordPerfect was spelled differently than Wordperfect, and e. > e. cummings gets filed after Carter but before Dostoyevsky, not > somewhere after the Z's. Capitalization is used for readability and > convenience, but explicit meaning, especially identification, does > not allow itself to change through mere capitalization; a message in > all caps states the same things as one in all lower case > (notwithstanding the possible *implicit* messages of emphasis). An > italic R, a lower-case R, a cursive R, a bold R, a capital R: they > are all the same letter, and functionally interchangeable. Except in > a tiny minority of cases. Like Unix. And Ruby.] Huh? How are printf(), Printf() and prinTf() in C the same? Did I miss something? Case significance of identifiers is present in a lot (if not most) major programming languages. And you can even have capital starting letters of method names in Ruby (although I find this utmost ugly and irritating): >> def Foo() "bar" end => nil >> Foo() => "bar" Regards robert