Author: Vasik Rajlich
Date: 03:52:49 08/13/04
Go up one level in this thread
On August 11, 2004 at 18:38:38, Anthony Cozzie wrote: >It appears that I need to expound a little bit on the idiocy of C++, and why it >is the _worst_ language ever to walk the face of this planet, except for >possibly Java and COBOL, and why people who go on and on about iterators and >templates make me want to throw up. > >In the beginning, there was Assembler. People were very annoyed that code they >wrote on one machine could not compile on another. Thus C was borne. C is >basically portable assembler. You have pointers and typecasts, and that lets >you do whatever you want. With a modern compiler, C is just as fast as >assembler, slightly more maintainable, and very portable. Unfortunately, it is >also very easy to shoot yourself in the foot with C, and doing anything is a lot >of work due to all the memory management the programmer has to do, etc. > >Thus, people desired "High Level Languages", in which abstract mathematical >descriptions could be written. My personal favorite is ML, but Haskell and Lisp >are also good. The advantage here is that all code is very neat and simple, >because the programmer is freed from worry about the little details. The >problem is that all high level languages are _slow_, from 50% (OCAML) up to 10X >(Java) slower than C. > >Then, we have C++, which tries to make a high level language out of a low level >language. Guess what? it _doesn't work_. It is an exercise in stupidity. >There are two ways to write C++: you can write it as C with a few nice syntax >features to clean up your code, or you can (as you are evidently advocating) >write it as an attempted high level language. The only problem with this is that >you will fail miserably, because you still have to do your own memory >management, etc. So you end up with the same development time as C and the same >speed as a high level language. > >This is why languages like C++ and Java are the anus of the body of programming >languages. If you want to sacrifice speed and write in Lisp, I may not agree >with you, but I can at least see where you are coming from. If you want to >write in HLA-attempt-C++, I can only consider you a moron. > >anthony Doing OO in C++ (vs pure high-level languages, ie. smalltalk, clu, lisp etc) isn't always a bad idea. Some advantages: 1) Speed. 2) Compilers widespread. 3) Existing tools & libraries. 4) Can mix low-level & high-level in same code. For example, if you wanted to write a windows app (in the pre-.NET days), VC++ with MFC was the way to go. Also, the OO support in C++ is not that bad. A few points: 1) It's true that the static type system can be annoying, but templates can help you around most of the problems. For some really interesting template stuff, check out books by Alexandrescu. (sp ?!) 2) Memory management. Having a garbage collector was of course discussed many times during C++ standardization. It was not included with the language because: a) there are many gc's out there b) you can write your own smart pointer classes. This is not a major issue. 3) Functional programming can be done in C++ by overloading the () operator. This technique is used throughout the STL. A good example of the power C++ gives you once you are ready to become more familiar with it. Vas
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.