[ABE.pm] OOP design question

Faber Fedor faber at linuxnj.com
Mon Jan 24 20:51:22 PST 2005


Being raised back in the days of procedural languages, I never really
wrapped my head around objects; they just seem like glorified C structs
with virtual function pointers to me.But after reading up on Lisp,
Python and tonight Ruby, I'm going to give OOP another go.

I've got a client for whom I'm writing a bunch of small Perl scripts; the
largest one being 12K + a 9K module. They generally consist of fetching
a text file, putting it into a table (maybe with some massaging), doing
some SQL, maybe outputting a subset of the data to a text file.  That's
it. Nothing special (although they were impressed that I reduced the
original programs run-time from six days to 20 minutes, but that's another
story).

So I'm looking for an opportunity to use OOP here; language doesn't
matter, but let's keep it to Perl for this group. Problem is, I can't
seem to find a reason to use OOP.

Here's one of the simplest programs I've written for them:

1. Get the date and some other options from the command line (like print
debug statements, etc.).  I use GetOpts for this.

2. Open up a text file. 

3. toss the first 13 line

4. take fields 1,3, and 13 and put into a temporary MySQL table

5. Do a join with another table.

6. fetch the results 

7. Print results to an output file.

The non-simple ones included the above steps and some exploratory data
analysis. BFD.

How would you use OOP for something like this?  Sure, I could shoehorn
it into an object but that doesn't make it Right. And would there be any
benefit to doing it as OOP?  I certainly don't see any.

Discuss.

-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com





More information about the ABE-pm mailing list