On Tue, May 29, 2007 at 06:31:18AM +0900, znmeb / cesmail.net wrote:
> Quoting Crep Cat <nospam@[127.0.0.1]>:
> 
> > I am trying to decide on a language to learn - and would be grateful for
> > help.
> > My reasons for wanting to learn programming are firstly to have fun
> > and secondly to learn more about how computers work.
> 
> In that case, I'd recommend either "Everyday Scripting With Ruby" or "Learn To
> Program". Both are available as either paper, PDF or combo packs from the
> Pragmatic Programmers. Judging by your example below, I'd recommend "Everyday
> Scripting With Ruby" first.

I, too, would recommend "Everyday Scripting with Ruby".  I'm reading it
now, and it's excellent -- and well suited to this sort of introduction
to the language.


> >
> > I have thought of one thing I would like to write - and wonder if Ruby
> > (or perhaps Python?) would be suitable.
> 
> Ruby is suitable. I'm guessing Python and Perl are as well, although I haven't
> used them for this sort of thing.

Ruby, Python, and Perl are among the best languages for hacking together
something like that.  Not only are they fairly high-level languages with
great list-handling (only LISP dialects really provide better basic list
handling, from what I've seen so far), but they also provide excellent
libraries ("modules", whatever) specifically for dealing with data
formats like CSV and XLS files.  You could conceivably do the same with
C, OCaml, Logo, VB.NET, or Prolog, but my first instinct would be to
recommend Perl, Python, or Ruby.


> 
> Here's what I recommend:
> 
> 1. I'm assuming that "spreadsheet" means Excel, and that you're on Windows. If
> that's not correct, please post otherwise.
> 
> 2. Download the One-Click Ruby Installer for Windows and install it on your
> machine. If you're in a corporate setting behind a firewall, you may need to
> have your IT people help you with "gem" updates when you get to that point, but
> since you're a beginner, you probably won't be doing that just yet.
> 
> 3. There is a library in the Windows versions of Ruby that talks *directly* to
> spreadsheets using the Windows OLE API. There's no reason to mess with
> intermediate files when you can just talk directly to the spreadsheet in Ruby.
> 
> 4. I think the One-Click Installer comes with a copy of the free version of the
> Pickaxe Book ("Programming Ruby"). And I also think that the Windows OLE API is
> documented in that version. So that's where I would start.

Good advice.  Add to that the recommendation of "Everyday Scripting with
Ruby", and you've got a winner.

. . . or talk to people in the Perl and/or Python communit[y|ies] about
how best to approach the problem in either of those languages.  I
personally prefer either Perl or Ruby, rather than Python, for anything
I do -- for a number of reasons.  Most of those reasons are specific to
my individual tastes and preferences, but one in particular for data
munging is that Python's regex engine is a trifle more clunky than that
of Ruby or Perl (though my understanding is that, once you get past the
clunkiness, Python's is slightly more "powerful" than Ruby's, putting it
not far behind Perl's).

One more note on the decision: If you're planning on doing any OOP, I'd
recommend either Python or Ruby over Perl.  I personally would rather
use Perl for OOP than Python, but that's because I dislike Python, not
because Perl's better at object oriented programming.  Objectively
speaking, Python's OOP characteristics are much better than Perl's.  Of
course, so are Ruby's (and I even think they're better than Python's,
though my bias might be showing on that one), so if I have my choice of
language for an OOP project I'll choose Ruby over either Perl or Python
any day of the week.

Your mileage may vary.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
print substr("Just another Perl hacker", 0, -2);