From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: some days weren't there at all Subject: Re: What's the best language to start with? [was: Re: Should I learn C or Pascal?] Date: 1996/08/09 Message-ID: <320BCBF8.4CDB@skylink.net> X-Deja-AN: 173301910 references: <4uaqqg$203@mulga.cs.mu.OZ.AU> <01bb84b4$75304ce0$87ee6fce@timpent.airshields.com> <4ubnhr$714@news1.mnsinc.com> <01bb8536$892ee260$87ee6fce@timpent.airshields.com> <4ud8m5$ka5@news1.mnsinc.com> cc: huang@mnsinc.com content-type: text/plain; charset=us-ascii organization: Black Iron Prison mime-version: 1.0 reply-to: bigdaddy@skylink.net newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada x-mailer: Mozilla 3.0b4 (Win95; I) Date: 1996-08-09T00:00:00+00:00 List-Id: Szu-Wen Huang wrote: [speaking about the benefit of knowing one/two algorithms deeply vs. knowing five/six more generally] > No, because I know > which book to look them up in, and that's exactly what books are for. > The important thing, however, is that I remember that O(n^2) is bad > for a sorting algorithm, and O(n lg n) is pretty good. > > Now, what about your student that knows *one* algorithm? This touches on an interesting point..I'm inclined to believe that the _mathmatical_/theoretical training behind the coding exercises might make a bit of a difference in how much is retained or understood. It doesn't matter how many sorting algorithms I can code, or how many different times I can memorize if I don't know where they 'fit' in the overall picture. This sort of training should be language-independent. I'm taking a CS class now; freshman-level stuff(I hope). The professor showed us today _why_ a comparison-based sorting algorithm can't take fewer than O(n log n) steps. Maybe I'm a twisted, academic-inclined person, but I acutally found the proof interesting. Maybe I would go so far as to say _beautiful_. He managed to present it in a straightforward way, w/o needing mathmatical notation, in such a way that it became obviously correct. That's independent of language. [responding to comment about all of CS being 'intuitive'] > Many algorithms are obvious. Insertion sort, for example, > is what a human would do (if somewhat parallelized). Quicksort, on > the other hand, is nowhere near intuitive. Be realistic. I would submit that recursive solutions require a different sort of intuition than the normal. At least it seems that way to me. If I'm looking to solve a problem recursively, I'll (now) naturally think about ways to split the problem set in half to minimize work. Why? Because I've been exposed to the idea. It seems to me that this kind of intuition can be developed. In my own case, early experience with Scheme (thank you, Mr. Grillmeyer), has led to a _much_ better grasp of recursion and recursive tree structures. I honestly think it was one of the best preparations I could have had...although I am the first to admit that I can't really back up that statement. :-) In any case, building/reinforcing these patterns of thought should be very important. I want to get to the point where QuickSort *is* intuitive, simply because, well, "it has to be that way". It's that kind of visceral understanding, coupled with the ability (when necessary) to back it up by referring to sound justification, which helps on the programming projects I am compelled to do. When I can't produce it, I flounder. [apologies for cutting the previous poster out of this post] [back-and-forth about assembler vs. HLL] > It doesn't matter. You are burdening beginners with details that > you could've avoided by using an HLL. Um, just as an aside, I do not know assembler, and I do not presume to comment on its complexity or suitability for CS instruction, but many thanks to whomever posted the gcc -S switch. I tried it on one of my current C++ source files, and the result was, well, interesting. I understood little of it, but I spent a very small amount of time, and am unfamiliar with the conventions of the language (what's an .fstab? file system table?). At least I can look at the assembler output now. Never knew I could do that before. Thanks. >My school was contemplating > teaching one freshman class Prolog as a first language and another > Pascal, then switch in their second year to observe which was more > effective. Out of curiosity, why Prolog? I was taught that it represents a different paradigm/model/whatever from both functional and imperative programming; sort of "off by itself". It's not a language I know much about. One more thing to do in the next couple years, I guess. :-) >It's too bad the experiment has practical problems, > because it would be interesting to see if it's easier for a "recursive- > minded" student to study iteration or the reverse. Personally, I think the form/paradigm of the language being studied, as well as what can and cannot be expressed, would have a much deeper effect on coding style and programming practice. The first language I studied academically (I refuse to count BASIC as my 'first language'!) was Scheme. It's a wondefully expressive and functional way to do things, or at least it _appears this way to me_ because I learned the concepts of programming by working with it. I know it has had a profound effect upon my understanding of recursion, and undoubtedly an influence on my coding style. I've gone on to Pascal, and now C++, and have had to adjust accordingly. Making the transition to Pascal was more than just studying iteration (actually, there's a (do construct in Scheme...not reccomended, but it works) - it required a complete change in understanding of what a function is and how it works. I remember one project when I tried to pass functions as arguments...and did not get particularly far. Of course, now, with C++, I can do this. I also have operator overloading. However, I'm trying to be a good C++ citizen and concentrate on this funny objet-oriented concept. :-) > In any case, > you want to train students in problem solving, not why the OS requires > value X in register Y. Any programming assignment in any language will require a great degree of problem solving. I spent/am spending far, far, far too much time tracking down and squashing bugs, no matter what language I have/am program(ming) in. Some of these are syntax errors, but far more are simply not thinking out my algorithm completely enough. Garbage in, garbage out... Again, I do not have the pleasure of being acquainted with assembler, but it seems that a student will simply adapt to the landscape of whatever language is his/her first and then use that to solve any proceeding problems. The question of "What language to learn first?" then becomes "What do you want your mind to look like?" If you've got a hammer... -David Molnar