Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 1996 10:39:52 +0100 (BST)
From:      " Stephen P. Butler" <stephen@dcs.rhbnc.ac.uk>
To:        freebsd-chat@freebsd.org
Subject:   Re: Adduser program in C
Message-ID:  <Pine.OSF.3.91.960526095725.8711B-100000@platon>
In-Reply-To: <199605260749.AAA14805@MindBender.HeadCandy.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The general trend in Computer Science has always been away from lower
level languages towards higher level languages.  Since we all have
more ideas than we can implement, and the timeframes in which products
have to be shipped in continually reduce, nobody can afford the time
to write all of a program in hand optimised assembler anymore.  

If something is seen to be time critical however, then those bits (and
those bits only) that cause the problems may be replaced by hand
written assembler.  In those cases however, the need for this has been
established by testing the program and finding it lacking.  No doubt
people will say that C isn't assembler, you're not comparing like with
like but stop and think about it if you do...

We trade the efficiency of the lower level languages for higher level
notations that allow us to get more work done in the shorter amount of
time.  We also gain:

        a) Portability in ever increasing (hopefully!) amounts.
        b) Better error checking - less bugs in programs due to silly 
           mistakes.
        c) Reduced development times.
        d) Lots of other things that escape my mind that no doubt
           people can remind me of.

If your Perl (or TCL or shell) script is taking too much time or memory,
don't waste your time rewriting it in C in the hope it'll be smaller
and faster - find out what's wrong with your script!  You might
be able to fix the script in a couple of lines, saving yourself days
or weeks.  It's more likely of course that you'll find that one
particular section requires most of the time, and in that case you can
concentrate on maybe writing a custom program which does that bit
well, rather than rewriting the whole thing.

The other thing of course is to make sure you don't fall into the trap
of having seen some things done badly in a particular language, that
this means the language on the whole is bad.  We all know you can
write completely inpenetrable programs in C that leak memory faster
than you can stuff in the 32MB SIMMS and attach the 20GB swap disks
we just try and avoid doing that.  And hey, maybe our program does
leak a little memory, but it works and if it doesn't cause too much of
a problem then you need to be sure that fixing it is justified.
Chasing perfection for perfections sake is OK if you've got nothing
else better to do.

I believe that every professional programmer should probably know a 
scripting language (damn I'll have to learn one now).  We should be
aiming to produce a working program at as high a level as possible, so
the development time and maintenance costs for that program are as small
as possible.  If the program is useful, and execution speed is shown
to be a problem, then consider how to produce something that can meet 
the execution time (or memory size or whatever) requirements.

I don't believe it's true to say that programmers no longer care about
execution speed and memory size.  We still care about those things,
but we also have other concerns which are more important, such as
getting the job done, and having some free time.  These days, hardware
is much cheaper than the software development costs.  If we
artificially elevate the costs of software development, we're causing
our employers, customers and ourselves a disservice.

[* Philosophy Mode On *]
You might argue that you're not a professional programmer, and that it
doesn't really matter if you take the time to write something in one
language and it takes three days, when you could've written a three
line shell script that does the job in 30 seconds. Sure, if you
want to that's your perogative.  On the otherhand, are you sure that
you couldn't of have used those three days less 30 seconds in a better
manner?
[* Philosophy Mode Off *]

Regards,
  Stephen.
--
----------------------------------------------------------------
|Stephen Butler                       |stephen@dcs.rhbnc.ac.uk |
|Computer Science Undergraduate.      |                        |
|Royal Holloway, University of London.|Finger for PGP public   |
|                                     |key.                    |
----------------------------------------------------------------





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.91.960526095725.8711B-100000>