On Tue, Jun 05, 2001 at 05:49:30PM -0400, John Porter wrote:
> > By preventing lots of little gotchas, you free the mind to pay attention
> > to what it is doing rather than the most minute details of how to do
> > it.  This is a quite powerful effect.
> 
> Interesting you should mention this.
> It is, without a doubt, the main reason we like to program in
> Perl, instead of in low-level languages like Fortran and Java.
> And it may explain why programs written in Perl -- dynamic,
> weakly-typed though it be -- are at least no more buggy than
> programs written in low-level languages.

Yes, this is something I've been meaning to investigate somewhat in
the "Why I Am Not A Java Programmer" thing, but didn't really feel
confident enough about to get into.  

By reducing the amount of code you need to write, very high-level
languages can drastically reduce bug counts.  This is partially
because programmers tend to have a constant bug-rate per Kloc
(thousand lines of code), so less code means less bugs.  Its also
because smaller code means less to remember and easier to keep in your
head.

Of course, any low-level language can achieve similar wins with
sufficient libraries/classes to raise its level of encapsulation to
that of a high-level language, to a certain extent.  Obviously, trying
to drag assembler up to the level of Perl wouldn't quite work.  Then
again, you can view Perl as just a bit abstracted interface to C...

Removing incidental work also helps.  Explicit type-checking can be
seen as just that.  Its not strictly necessary, you can strip it all
out and the code will run exactly the same (with a bit of hand-waving
towards type-casting magic).  Other things you can strip and/or
automate are memory allocation, privacy rules, accessors, etc...  None
of these things directly effect your real goal, which is the encoding
of a reality onto bits.

Now, this same argument can be taken too far.  Documentation, tests,
comments, whitespace... these too are incidental.  But strip them at
your peril!  You must draw a personal line and decide for yourself
what is necessary and what is just paperwork.

The problem with Java is they've drawn the line for you.  You must use
strong types, you must set up privacy rules, you must write all your
code by hand, you can't allocate your own memory, etc...

The problem with Perl is you can only draw the line at certain places.
Privacy?  Take it or leave it.  Strong types?  Ummm, sorry.


> But I think we've strayed into the topic of advocacy.

Interesting advocacy, nevertheless.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
I am not one of those stupid moron who don't know what I am doing. I know about
FDA. FDA raids hundreds of small businesses every year that deal with
alternative medicine or therapy. They take away your computer, seize your
$200,000 inventory, and drive your company totally out of business in no time
if they ever approach you.
             --Alex Chiu, Immortality Guy

Reply via email to