home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!max.fiu.edu!serss0!feathers
- From: feathers@serss0 (Michael Feathers)
- Newsgroups: comp.lang.c++
- Subject: Re: Give me safe C++
- Message-ID: <BzICnn.LDx@fiu.edu>
- Date: 19 Dec 92 13:11:46 GMT
- References: <1992Dec6.131757.7448@ucc.su.OZ.AU> <716@ulogic.UUCP> <1992Dec18.134937.14313@bony1.bony.com>
- Sender: news@fiu.edu (Usenet Administrator)
- Organization: Florida International University, Miami
- Lines: 69
-
- In article <1992Dec18.134937.14313@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
- >In article <716@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
- >
- >[...]
- >
- >>Safety (when not being enforced by the language) is to a large
- >>extent (IMHO) a matter of good programming practices. Like a
- >>seemingly ever-growing segment of the general populace, the cry
- >>comes "oh powers that be, protect us from ourselves", and thus
- >>we get laws requiring people to wear seatbelts. It is no that
- >>I am against seatbelts (or safety), but I was perfectly capable
- >>of wearing a seatbelt before the law existed. To my mind, there
- >>was no *need* for the law.
- >
- >This analogy with seat belts bugs me. Here is why. Seatbelts are there
- >for the benefit of consumer of cars.
- >
- >This implies that programmers are *consumers* of programming
- >languages. This misses the point, that programmers are the
- >*manufacturers* of software.
- >
- >Don't you agree, that safety regulations forced on the manufacturer
- >are a good thing? Rememeber the Ford Pinto?
-
- I don't. The bad press that Ford got because of the Pinto out stripped any
- incentive towards safety that a regulation could generate. Believe it or not,
- safety is a side effect in a free market.
-
- >If you are writing safety critical software - let's say software that
- >controls the brakes in *my* car - I'd rather have you code in PASCAL
- >and run with all the runtime checks on. I don't want my brakes to stop
- >working just because you forgot an ampersand.
-
- I wouldn't rather have the code written in Pascal. The reason has to do with
- one of my experiences as an undergraduate.
-
- Before I started majoring in computer science, I took it upon myself to teach
- myself C as a first language. Everyone I knew at the time said that C was
- a hard language to learn and I figured that if I was capable of doing that I
- probably wouldn't get half way through my degree and then discover that I was
- not cut out for programming.
-
- Well, I spent a good amount of time writing over the edges of arrays and
- dereferencing null pointers before I finally figured out that I should really
- understand my code before it executes and construct it in such a way that I
- know when a run time check is or is not necessary. I learned this lesson
- thoroughly only after getting extremely tired of crashing in C.
-
- In my last year as an undergraduate, I remember looking over my shoulder in the
- labs at the terminal of my neighbor. He had a run-time bounds error message
- on his screen. At that point I had been doing Pascal projects for a few years
- at school and I had never seen one of those before. Checking around, I
- discovered that they were not too uncommon. My conclusion was that run time
- checking was being used as a crutch.
-
- If I had it my way, I'd have C taught as a first programming language in CS
- curricula. If nothing else it would teach students that the best safety
- measure they can take with their code is to understand it. The iterative
- cycle of getting run time errors, patching them and then getting more run time
- errors should never have to occur and should never be relied upon my
- beginning students.
-
- I've seen students who learn C first have no problem wih Pascal other than
- claustrophobia, and I've seen students who learn Pascal first have an
- extremely agonizingly difficult time learning C because it does not have their
- familiar crutches.
-
-
- Michael Feathers feathers@fiu.edu
-