On Wed, Aug 27, 2003 at 04:27:15AM -0700, Paul Johnson wrote: > On Tue, Aug 26, 2003 at 11:54:58PM -0700, Loren M Lang wrote: > > If people don't learn C before C++, it A) a little harder to learn > > properly, and B) it's harder for them to learn other languages later like > > C, Objective C, and Dynamic C with are all C dirivatives. > > While I haven't learned much C yet (I can read it better than I write > it), I do have to ask this one: It's possible to write > non-braindamaged code in C++ without learning C first?
I would suggest it may well be easier to write good C++ if you don't know C first. It seems that it's not quite as similar as the name would have it, and habits learned which are reliable in C can get you into trouble in C++ - see thread about C++ memory allocation and dancing pointers, a few weeks back. C is a "dirty" language. It's great for low-level stuff, bit twiddling, messing around with hardware and stuff, which is much more difficult in other HLLs, as well as being equally capable of the higher-level stuff with other HLLs of the era. Assembler programmers like C; it's been called things like "cross between an HLL and a macro assembler". There is a certain strange beauty in writing a chunk of C code and seeing hanging in the air beside it the opcodes for a really neat tight bit of assembler into which the C very directly translates (and a concomitant despair if you then have a look at what the real compiler actually produces...) There's all that wonderful pointer stuff, and you can write things like switch (a) { case 0: if (b==c) { case 1: do_case_1(); break; } else { case 2: do_case_2(); break; } } C programmers hate Pascal. Trying to switch from C to even a real-world variant of Pascal with equivalent functionality - eg. switching between equivalent releases of Turbo C and Turbo Pascal in DOS - is *horrible*. You keep thinking "stupid bloody toy language, can't do this, won't let me do that"... University teaching Pascal is even worse - no string handling, no decent file I/O, no nothing much... C++ is the bastard mongrel offspring of good old C and a bunch of academic theoretical 80s-Thatcherite-type style gurus masturbating in committee. Object oriented programming is cool! Strong typing is cool! Being a programmer with short hair and a tie is cool! Meanwhile, in the real world, more and more computers were running C code written by long-haired C programmers who smoked lots of grass. C++, the PC explosion and the apparent extreme fitness of OOP for Windoze-style interfaces are all part of a plot to destroy creativity and free thinking among programmers by getting them out of their smoky back rooms and making them wear suits and sit in open-plan offices with plastic plants programming boring business stuff, drinking bottled water instead of coffee and using coke instead of grass. Reduce the availability of jobs hacking Unix in a den somewhere, replace them with jobs hacking DOS on PCs, but still using assembler and C. Then introduce extensions on newer compiler versions; call it C++ and make the syntax really complicated to fool people it's still more or less C, but slip in restrictions more straitjacketing than Pascal. Provide few/crappy windowing functions, so the first thing people have to do is extend/hack/patch/write their own, and get all happy about using the OOP features. Once they've finished sorting out the libraries and have to write the rest of their app and find what a bummer it is cos it's all pascally now, it's TOO LATE. They'll all be addicted to coke and Porsches and kissing the system's arse because they're shit scared of not being able to pay the mortgage. And they won't even notice the plot because they'll think it's all "the march of technology". HAHAHAHAAAAA!!!!! With the old guard apparently neutralised, a number of factors changed the scene from Orwellian to more Huxleian. The generation now leaving schools and colleges had been taught from primary school to value style over content, the Illuminati and Masons ceased to back up Thatcher and Reagan and switched support to the Intel/Microsoft axis. Computers became ever cheaper and more widespread; programming environments like Windoze / Visual Basic came out, in which all the hard/interesting work has been taken care of and programming simple applications is a case of join the dots, point and drool and draw some pretty pictures, but programming complex or low-level applications is impossible, and must be left to the indoctrinated, controlled herds at the big corps, who are instantly assigned to drawing pretty pictures if they show too many signs of creative inspiration. To mask this, Visual C++ came out, with the safety features added of (a) continually crashing the entire machine, not just the task and (b) the requirement in the jobs market to have certificates of Microsoft indoctrination. The downhill slide accelerated with HTML, graphical browsers, Javascript and Flash. The flaw in this scheme was the intellectual crippling of the programmers at the big corps, which had the inevitable result that PCs needed to be of mainframe power to run their creations, which then proceeded to crash all the time. This had two consequences. One was that the remnants of the old guard and their spiritual descendants - for creativity can never be entirely suppressed - were in an ideal position to pour their creative energies into alternatives to the Microsoft system, designed to facilitate rather than obscure the art of coding for them, similarly to facilitate the solution of problems, and not to crash all the time. Foremost among these was one Linus Torvalds, who created the kernel known as Linux that finally broke the Microsoft dependency and enabled the spread of a free, Unix-like operating system. The further dependency on Intel was broken by the Debian Project who took an interest in porting Linux to as many different architectures as possible. The other consequence was that bored teenagers who used to hang around in the streets and smash up bus stops, now hung around in their bedrooms with computers, which they used to electronically smash up other people's computers. The poor quality of Microsoft software made this laughably easy, and viruses, worms and other pathological software proliferated rapidly. Their spread was helped by the strategy of keeping people as ignorant as possible about the workings of their computers, so they were long unaware of infection and passed it on widely. An early indication of the potential consequences of this situation was the major power blackout in the US which, it was eventually leaked, had been caused by a virus attacking the Microsoft systems used by the power distribution network; the leak itself was caused by a second virus broadcasting random documents from the company's internal network to random email addresses. Shortly after this the White House was severely damaged when computers controlling the sewage network succumbed to viral attack, pumps went into reverse, raw sewage pumped out of toilet pans and the accompanying methane exploded. The President, fleeing the foul flood, was hit by a fragment of flying debris; fortunately for him, it hit him in the ear, and so was able to pass through and out of the other ear with minimal injury. In the same week the 'Shining Sun' virus, which exploited a flaw in certain laptops to turn up the power to the screen backlight to dangerous levels, achieved notoriety in the UK when the backlight in Tony Blair's laptop exploded, knocking him unconscious into the Thames; he was only saved by the buoyancy of his cranial airspace. The tide really turned in Russia after an exploit against Microsoft Powerpoint caused Vladimir Putin's presentation to the United Nations to inform the assembled delegates that their mother was a hamster and their father smelt of elderberries. A purge on all Microsoft products followed and several million Windoze CDs were ceremonially burned in front of the Kremlin. Bill Gates despatched himself to Russia to try and restore Microsoft's fortunes; his limousine stalled on a level crossing; the driver escaped, but the rear doors apparently jammed and Gates was crushed by a train. Within months every computer in Russia was running Linux, computer dysfunctionality dropped to minimal levels and the effect on Russia's economy was such that the West was forced to follow their example. The change was slow initially, but once enough Western organisations had installed Linux that its success was shown to be no peculiarity of Russia, market forces did the rest, and Microsoft disintegrated. Oops, sorry, we haven't got that far yet... -- Pigeon Be kind to pigeons Get my GPG key here: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F
pgp00000.pgp
Description: PGP signature