From: "Hal E. Fulton" Date: 2002-08-21T09:33:42+09:00 Subject: Re: What makes a "good" Ruby extension? ----- Original Message ----- From: "Lyle Johnson" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Tuesday, August 20, 2002 6:51 PM Subject: Re: What makes a "good" Ruby extension? > Tim Hunter wrote: > > > So I'm reading the "Comparing Gui Toolkits" wiki page > > (http://www.rubygarden.org/ruby?ComparingGuiToolkits) and I notice that > > the author characterizes one of the Ruby interfaces as "Perl-like" and > > another as "immature." As someone who's been busy beavering away at his > > own Ruby interface to an existing C library for some months now, I'm wondering, > > just what makes a "good" Ruby interface? (After all, I don't want to > > embarrass myself by offering a bad one to the Ruby community :-) > > I think this is a question that a lot of Ruby programmers struggle with, > especially if they've come to Ruby after a long history with some other > programming language. Despite efforts like this: > > http://www.rubygarden.org/ruby?RubyStyleGuide > > there's not really a "checklist" out there to compare your work to (and > I don't think anyone wants that anyways). Tim - what Lyle says is true. There's no one right way to do things. And while I claim my list has some good ideas, it's not definitive and it shouldn't be viewed as a checklist. And as for being embarrassed over a "bad" interface... don't worry about it! Nothing is perfect the first time. That's why we have version numbers. Any contribution is welcome, and a bad interface is better than no interface at all. Usually. :) > Perhaps your best bet, then, is to study Ruby code that *others* have > pointed to as exemplary of "The Ruby Way". That certainly includes > looking at the sources from Ruby's standard library, but a lot of code > from the Ruby community falls into this category as well. For example, > many people have pointed to Sean Russell's REXML library: > > http://www.germane-software.com/software/rexml > > as a very intuitive (read: "Ruby-like") interface. I hope others reading > this thread might throw in their $0.02 about other good examples (for my > benefit ;) Yes, from the little I've seen of REXML, I like it. Hard to compare, since I don't use XML much. Some other good coders (IMO): Dave Thomas, Guy Decoux, obviously Matz, David Alan Black, Michael Neumann. There are others. Study the Ruby core classes and methods (and net stuff) and the libraries. The *API* I mean, not the code. Although the code is good too. :) I guess NOW that is my $0.02 worth. Hal