Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!pasteur!ucbvax!cbosgd!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704A-Liber) Newsgroups: comp.lang.misc Subject: Re: Languages and learning (was: Philosophy of C) Message-ID: <3487@ihlpf.ATT.COM> Date: 23 Jan 88 02:46:50 GMT References: <11348@brl-adm.ARPA> <3473@ihlpf.ATT.COM> Reply-To: nevin1@ihlpf.UUCP (00704A-Liber,N.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 91 In article <11348@brl-adm.ARPA> dsill@NSWC-OAS.arpa (Dave Sill) writes: >In article <4186@eagle.ukc.ac.uk> "H.A.Shaw" writes: >>I wholeheartedly agree, and hope I write better C >>programs now for three years of BASIC/PASCAL/FORTRAN/FORTH first. >>They did teach [C] to third year Computer Scientists sometimes. > >This is much too late. Computer education should proceed from a >hardware overview to machine language to assembler language to low- >level compiled languages on up to high-level compiled languages. >Teaching BASIC/Pascal/FORTRAN/Forth/etc first is like teaching algebra >before arithmetic. Yes, but arithmetic is usually first taught without logic and the axioms of arithmetic. If you started your mathematics career with only the Successor function and the few other rules you need to define arithmetic, I don't think you would have gotten very far. Analagously, try teaching someone how to write a exponentiation routine with a Turing machine (or another simplistic model of a computer). (Just wondering: if I wanted to drive a car would you make me build all the parts for the car and then build the car first? :-)) Unless you have a higher level concept of what things like lists, queues, and stacks are, programming in assembler is extremely tough. There are no data structures in assembler, and this makes it tough to do any kind of non-trivial programming. HLLs are much better at learning the fundamentals of data structures and thinking abstractly. >BASIC is a bad joke. The bad habits that it imparts on students are >particularly hard to unlearn (first impressions are lasting >impressions). It oversimplifies the hardware-software interface to >the point where it seems, to the student, to be performing magic. C >on the other hand, is more transparent. It allows the student to see >the gears turning. Unfortunately, the many of the bad habits one picks up in BASIC one also picks up in assembler. One of the major habits is un-structured programming. That is why people have a hard time going from BASIC to Pascal (for instance); the same problem would happen going from assembler to Pascal. Also, many of the manipulations that can be done in assembler should not usually be done in a HLL. About 7 years ago, I disassembled the BASIC ROMs on my TRS-80 Model I. I noticed a curious piece of code (which I will pseudocode here): 0998 LOAD (C), 0 1000 LOAD (AB), 0112 1003 LOAD (AB), 0212 1006 LOAD (AB), 0312 1009 real stuff which pseudoassembles to: 0998 12 0999 00 1000 24 1001 12 1002 01 1003 24 1004 12 1005 01 1006 24 1007 12 1008 03 1009 real stuff And I also found statements JMP 0998 JMP 1001 JMP 1004 JMP 1007 They were taking advantage of the fact the the 12 in 12xx in the operand field was also the operator for LOAD (C)! They were jumping in to the middle of instructions (hmm... maybe this should be an argument against BASIC. After all, this is for an implementation of BASIC :-)) Also, machine language allows self-modifying code, which is a no-no by today's standards. Although some modern architectures do not allow you to do this because of pipelining and other reasons, this is not a problem with the machine language itself but a fault of the designing hardware for speed purposes. Machine language is NOT the place to start learning about computers or to program them. HLLs have too many advantages over machine languages. But you are right, BASIC is not a good place to start. What is, I don't know. Maybe someone out in netland does. -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_