Tuesday, August 03, 2004

In a comment discussion, I mentioned my disdain for using Perl for anything larger than simple scripts or line-based text parsing (which is what it was invented for...see below). I received some pushback on this opinion from Shelly, obviously from her own experiences with the language.  I enjoy pondering a dissenting opinion when based on experiences or data.  She says:

Using a good OO design and programming techiques, a perl program is not a nightmare for maintainability...just like any other language (yes even assembly).

Obviously, I need to open my mind here. I guess my question becomes: Once you get to the point where you need to apply OO design and programming techniques, are there not more suitable languages for a project like that?  I'm curious to know what other people's opinions are on this.  What are the advantages of Perl over other truly OO languages?  Why would you choose it instead of another language?

For your enjoyment, here's the original manpage for perl:

 NAME
  perl | Practical Extraction and Report Language

 SYNOPSIS
     perl [options] filename args

 DESCRIPTION
      Perl is a interpreted language optimized for scanning  arbi-
      trary  text  files,  extracting  information from those text
      files, and printing reports based on that information.  It's
      also  a good language for many system management tasks.  The
      language is intended to be practical  (easy  to  use,  effi-
      cient,  complete)  rather  than  beautiful  (tiny,  elegant,
      minimal).  It combines (in  the  author's  opinion,  anyway)
      some  of the best features of C, sed, awk, and sh, so people
      familiar with those languages should have little  difficulty
      with  it.  (Language historians will also note some vestiges
      of csh, Pascal, and  even  BASIC|PLUS.)   Expression  syntax
      corresponds  quite  closely  to C expression syntax.  If you
      have a problem that would ordinarily use sed or awk  or  sh,
      but  it exceeds their capabilities or must run a little fas-
      ter, and you don't want to write the silly thing in C,  then
      perl  may  be  for  you.  There are also translators to turn
      your sed and awk scripts  into  perl  scripts.   OK,  enough
      hype.
posted on Tuesday, August 03, 2004 10:32:41 AM (Pacific Standard Time, UTC-08:00)  #    Comments [4]
Related posts:
9-year Anniversary (yesterday)
LinqToStdf now on CodePlex
Image Slicer for Deep Zoom in Silverlight 2
Silverlight limitations and Constrained Callvirt in IL
Happy Birthday Peter
What are the generic Delegates in the framework for?
Tracked by:
"top selling diet pill" (top selling diet pill) [Trackback]
"wave mixer" (wave mixer) [Trackback]
"kodak camers" (kodak camers) [Trackback]
"unicorn tattoo" (unicorn tattoo) [Trackback]
"cellphone pictures" (cellphone pictures) [Trackback]
"early heart attack symptoms" (early heart attack symptoms) [Trackback]
"active mixer device%2C computer volume" (active mixer device%2C computer volume... [Trackback]
"Curling Shampoo" (Curling Shampoo) [Trackback]
"accident attorney" (accident attorney) [Trackback]
"hybrid truck" (hybrid truck) [Trackback]
"very very ugly girls" (very very ugly girls) [Trackback]
"firm tits" (firm tits) [Trackback]
"local rap artist richmond virginia" (local rap artist richmond virginia) [Trackback]
"map of french riviera" (map of french riviera) [Trackback]
"exhaust wrap UK" (exhaust wrap UK) [Trackback]
"young black girls" (young black girls) [Trackback]
"biodegradable packaging" (biodegradable packaging) [Trackback]
"nipple toys" (nipple toys) [Trackback]
"glass doors manufactures ontario" (glass doors manufactures ontario) [Trackback]
"girls tight pizza" (girls tight pizza) [Trackback]
"Beagle puppies" (Beagle puppies) [Trackback]
"elettrostimolatori tesmed" (elettrostimolatori tesmed) [Trackback]
"help desk it software" (help desk it software) [Trackback]
"letter to creditor bankruptcy alternative" (letter to creditor bankruptcy alter... [Trackback]
"tribal turtle" (tribal turtle) [Trackback]
"True Scary Stories" (True Scary Stories) [Trackback]
"funjet vacations" (funjet vacations) [Trackback]
Tuesday, August 03, 2004 1:23:57 PM (Pacific Standard Time, UTC-08:00)
> I guess my question becomes: Once you get to the point where you need to
> apply OO design and programming techniques, are there not more suitable
> languages for a project like that? I'm curious to know what other
> people's opinions are on this. What are the advantages of Perl over
> other truly OO languages? Why would you choose it instead of another
> language?

Well, you said you wanted other people's opinions, but I figured I would chime in since I opened the hornets nest..... :-) (Strangly, I feel like I am back in the early nineties debating the usefullness of this new OO programming paradigm in the comp.sci (???) news group....)

First question:
> Once you get to the point where you need to
> apply OO design and programming techniques, are there not more suitable
> languages for a project like that?

Point 1:
I disagree with your first point completely. Every program, script, shell script, should be using good design (I would even submit OO design if the language supports it) and programming techniques. I started out just throwing scripts together. Soon, I discovered that each subsequent script would have common components. I could save lots of time if I thought about my design and made libraries of my methods, subroutines, objects, etc. And then, much to my surprise, other people started to use my libraries for their programs, etc. I have seen this scenario played out in each of the three companies I have worked at (including the current one).

Point 2:
Why does the project requiring OO design and programming techniques mean that you drop Perl and be looking for a more 'suitable' language? Every language has its strong points and weak points. Just because the project is now big deosn't mean that Perl is automatically out.

Second Question:
> What are the advantages of Perl over other truly OO languages?

I think advantages over OO languages is irrelevant. I would state the question as:

What are the advantages of Perl over other languages?

Well, these are usually my main reasons for choosing Perl:
1. Truly portable - my perl scripts runs on Solaris, Linux, BSD, Windoze, or even System 9
2. Text processing - This is a no brainer (for me at any rate). Perl is so powerfull in this area it is amazing

When I need to add a GUI or do *lots* of database stuff, I lean towards Java

I have yet to lean towards shell scripting for anything

I have yet to do any windows specific programming because anything I have written has needed to be cross platform. I know it sounds wierd, but every shop I have been in had different platforms (usually windows and then several flavors of unix, the most common being Solaris and HPUX).

Third Question:
> Why would you choose it instead of another language?

I think I covered (hopefully in a clear manner) this question above.

Nice debating with you, and if you ever run accross a Perl library that can read and write MS Word, please remember me. :-)
Shelley
Tuesday, August 03, 2004 2:07:06 PM (Pacific Standard Time, UTC-08:00)
Excellent feedback, Shelley. I definitely see where you are coming from.

Even though you say you disagreed with my first point completely, you said something I agree with completely. I'm not sure how that happened. I think that's a story most competent developers can relate to.

The reason I wanted to compare with OO languages was because its strengths (as I understand them) lie elsewhere, such as in text processing as you point out. After all, it's why the language was invented.

Portability is a strong argument, and an advantage over even Java. I guess it also has a large library of modules (which now is almost as big as the source code for Red Hat 6.2 as a recent slashdot story points out) that gives it an edge as well.

Anyone else?
Tuesday, August 03, 2004 4:02:04 PM (Pacific Standard Time, UTC-08:00)
Nope. I think you guys covered what I was going to say.
B-Dub
Thursday, August 05, 2004 8:12:35 AM (Pacific Standard Time, UTC-08:00)
> The reason I wanted to compare with OO languages was because its
> strengths (as I understand them) lie elsewhere, such as in text
> processing as you point out. After all, it's why the language was
> invented.

I see what you are saying now about comparing it to OO languages. Hey, it only took me a couple of days to figure it out. :-)

I guess my response is that supporting OO is certainly high on my list of criteria, but a good implementation of OO is farther down the list. For better or for worse. And this is mainly from experiences in the past.

Java was my first OO language I had experience with. I absolutely loved it (and still do). Then Perl supported OO, and the first revision stank it up. So I tried to do text processing with Java because I thought good OO support was more important...well that stank even more...so from that experience, good implementation of OO was way down on my list of weighted pros and cons. YMMV though. Every developer's list is different, and it should be because that list should also reflect that developer's strengths and weaknesses in program design, implementation, and general problem solving. Then this segues into my disdain for one size fits all managers, but I digress.....
Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):