Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 1996 00:49:25 -0700
From:      "Michael L. VanLoon -- HeadCandy.com" <michaelv@HeadCandy.com>
To:        dima@freebsd.org (Dima Ruban)
Cc:        joerg_wunsch@uriah.heep.sax.de, lithium@cia-g.com, freebsd-chat@freebsd.org
Subject:   Re: Adduser program in C 
Message-ID:  <199605260749.AAA14805@MindBender.HeadCandy.com>
In-Reply-To: Your message of Sat, 25 May 96 16:04:59 -0700. <199605252305.QAA19014@freefall.freebsd.org> 

index | next in thread | previous in thread | raw e-mail


>> Perl is certainly one of the fastest scripting languages.

>fastest scripting language != fastest programming language.
>I don't think perl script is going to be faster when the same C program.

You're comparing Apples to Oranges.  Perl is a fast interpretted
scripting language.  C is a compiled language.  They are different
things.  Compiled C and scripting-based languages are designed to
solve two completely different problems.

If you aren't interested in the rest of my long dissertation, please
move on to the next message now....

How is C faster when you want to throw something together in two
minutes to do some complex automated task?  In many cases it can be
many times slower, because it will take so much longer to write it,
compile it, debug it, and get it fully functional.

I generally see this attitude the most in "beginners" or theorists who
haven't actually had to design and plan large projects, then make all
the details work, on a repeated basis.  People who haven't been three
months into a project, with lots of issues pending investigation, and
a product half written, who have to make literal trade-offs between
what they will be able to finish writing, and what they will have to
postpone, or remove completely from the product.  There just isn't
enough time in our lives to write all the code to fix all the problems
that we'll want to solve.

Scripting is an enourmously important part of Unix system
adminstration.  When I used to be one of several people running a
large Unix site, if all our adminstration tools had been written in C,
we'd have gotten nothing done.

C is great for permanent, performance-sensative work.  That's why most
of the OS and tools are written in C.

Scripting is invaluable for quick-and-dirty fixes, for administering
things that change a lot, and for writing stuff that will have to be
maintained by lots of people but which isn't performance sensative.

If you have a C program that solves an admin task and finishes in one
minute, and I have a perl script that solves the same task and it
takes three minutes to run, but the C code and the script have to be
changed every few days, I'm going to be using the perl script.

As someone who designs and writes C++ code for a living (8-10 hours a
day, five days a week), I'll guarantee you that you simply cannot
write all the code that you will want to.  Which means you'll often
either have to borrow good code from somewhere else, or hire more
people to write it.  I'll bet I borrow as much code as I write from
scratch.  If you can't even find time to write all the C code for the
development tasks that need it, how are you going to write enough C
code to cover all the tasks that are currently best handled by
scripts?

There have been projects where I knew exactly how I wanted something
written, but I knew I would never be able to get around to writing it,
so I borrowed code from someone else that wasn't a perfect fit, but
was close enough to be functional.  Writing and maintaining good
quality C code is an expensive task.  Why do you think Java and Visual
Basic are so popular?

In our group, *all* the build lab stuff is written in DOS batch files,
awk scripts, sed scripts and perl scripts (this is a Windows NT shop,
if that isn't clear).  They can change a script in 30 seconds if a
component needs to be built differently (which happens frequently),
and they can have college interns and temps, who aren't great coders,
maintain most of it.

Our testers write a lot of batch, perl, and Visual Basic scripts.
Want to quickly change a test, or add a new test case?  Just take 30
seconds to edit the scripts.

And, sometimes if a script gets used constantly, and its features
aren't changing much, then it can become a good candidate for turning
it into C code.  However, if it's not performance sensative, and it's
working, there are even cases then where you'll just have other things
that are higher priority, and you may never get around to it.

If you don't like perl because it doesn't do something as well as
another language used for the same purpose, then you have a valid
concern.  But, if you don't like perl simply because it's not C, then
you are completely missing the point...

Can you tell I had an English minor?  Somehow I seem to have no
problem writing things that end up getting waaay too long...  :-)

-----------------------------------------------------------------------------
  Michael L. VanLoon                                 michaelv@HeadCandy.com
        --<  Free your mind and your machine -- NetBSD free un*x  >--
    NetBSD working ports: 386+PC, Mac 68k, Amiga, Atari 68k, HP300, Sun3,
        Sun4/4c/4m, DEC MIPS, DEC Alpha, PC532, VAX, MVME68k, arm32...
    NetBSD ports in progress: PICA, others...

   Roll your own Internet access -- Seattle People's Internet cooperative.
                  If you're in the Seattle area, ask me how.
-----------------------------------------------------------------------------


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605260749.AAA14805>