Slashdot Mirror


Bjarne Stroustrup on the Problems With Programming

Hobart writes "MIT's Technology Review has a Q&A with C++ inventor Bjarne Stroustrup. Highlights include Bjarne's answers on the trade-offs involved in the design of C++, and how they apply today, and his thoughts on the solution to the problems. From the interview: 'Software developers have become adept at the difficult art of building reasonably reliable systems out of unreliable parts. The snag is that often we do not know exactly how we did it.'"

116 of 605 comments (clear)

  1. In my experience... by Wizard052 · · Score: 3, Informative

    ...at a university I know, they start teaching you programming in...Visual Basic. I can imagine the effect that has on the poor confused heads here who never eventually grasp other languages (including VB).

    Maybe if they started with something like Pascal or something...but thats just not 'modern' or cutting edge nowadays...

    I think this is the case in many institutions leading to low quality coders.

    1. Re:In my experience... by bogaboga · · Score: 4, Interesting
      In my case, we were presented with a problem and asked to "produce" a possible solution in a month. From the tools we had, VB was the most obvious. No body dictated what we should be using in our solutions.

      With a little research, nothing could beat MS-Access with its VB. We quickly had working GUIs integrated with business logic. Things were beautiful. PHP was available but the its abilities at the time were very limited.

      Sadly, there is still no real answer to MS-Access' programming paradigm in the Linux world. Gambas http://gambas.sourceforge.net/ comes close. So does RealBasic http://www.realbasic.com/. Other wannabe environments are simply wasting time at present, and do not appear to be serious.

      I am meant to understand that Kross http://conference2006.kde.org/conference/talks/2.p hp is progressing well, but was not impressed when I tried it.

      Having powerful programming environments that are friendly to newbies is OK, but making them actively hostile to power users on the other hand is insane. Those two items aren't mutually exclusive, but Linux programmers tend to think so - sadly.

    2. Re:In my experience... by atomicstrawberry · · Score: 4, Informative

      My university started everyone out on C. Having seen some of the horrible code that some students produced even in the final year, I'd say that the problem lies deeper than the language they started out on.

      Though I'd hate to have started with Visual Basic all the same.

    3. Re:In my experience... by omeg · · Score: 2, Interesting

      You know what, this may sound strange, but I would recommend ActionScript for beginning programmers. Why, you ask? Well, aside of the fact that ActionScript is very simple, it's fully integrated with the capabilities of the SWF file format. That means you can make some kind of visual representation of what you're doing extremely quickly, and you won't have to worry about advanced rendering code, since it's all already there. You can have people algorithmically draw lines and shapes and graphs in virtually no time at all. Whereas you'd just be oversimplifying things if you gave people Python and a good library to take care of the visualization part.

      Now that there's a free and open source compiler around, I think that schools should start considering it.

    4. Re:In my experience... by americangame · · Score: 4, Insightful

      Well in my experience they had me learning C on Unix, then Bjarne Stroustrup (along with another professor) taught us C++. I must say that learning a programming language from the creator isn't the best way to do so, as he will begin to go into the extreme detial of how a pointer in C++ works with no regard for the fact that it might be too much information for the first week of class. But it is a great way to scare the ever living piss out of freshmen in college that are considering to become computer engineers.

    5. Re:In my experience... by Wizard052 · · Score: 3, Insightful

      Actually, I like VB. I believe it's good for what it's for- RAD and if properly used (as applies to any tool). But too often its seen as some kind of panacea, at least in this part of the world, for IT education. It's probably the power of the Microsoft brand (if not the product(s) ) at work here...

    6. Re:In my experience... by Garridan · · Score: 5, Insightful

      VB is a rapid prototyping environment. And just like an RP machine, it makes a flimsy product that you can send back to the drawing board without much expense. But you don't ship a product you've made on an RP machine -- it's crap. You take your prototype, and make a real product out of it using sturdy materials. Same goes for VB. You make something that works the way you expect, then you make it work in a real language. Good thing about VB is that you can replace pieces at a time with DLLs compiled from C++. If that isn't a part of the VB curriculum, it's a waste of time.

    7. Re:In my experience... by arivanov · · Score: 4, Insightful

      Exactly.

      C, C++, Java and god forbid VB should be prohibited by law for university courses and any person teaching them during the first 2 semesters in CS should be prosecuted for child abuse. Pascal (even without the object oriented extensions) remains the best language for teaching the first years in CS. Once students are past their data structures course and know how to deal with linked lists, pointers, objects hashes and the like you can switch to C, C++ or Java with minimal fuss. Before that its outright criminal. In fact the total amount of hours spent till the point when the students can produce something that will pay their daily bread will most likely end up being less than the required when teaching directly in C/C++.

      There was a very good article on the subject by Joel called The perils of Java schools and I tend to agree with it 100%. In fact I will extend its reasoning further to C and C++. Probably the most important part of teaching a data structure course is to teach it in a language that has a clear syntax and "one way to get it right" for pointers, linked lists and the like. C and C++ are insufficiently clear and unambiguous. Java simply does not allow you half of the things you need to do in that course.

      Many people advocate for the usage of Java and especially VB from the perspective of "look how fast can I learn to program in these". That is irrelevant as far as university courses are concerned. What is relevant is will the student learn to produce literate, commercially viable code or not. If he has been subjected to VB - never, Java or C++ - not bloody likely, C - it may work but it will be anything but readable for the first 10 years of his career.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    8. Re:In my experience... by weicco · · Score: 5, Informative

      I've worked in project that was/is probably the most largets VB project in the world. It started in 93 and I don't think they are going to end it soon. I personally hate VB, it's not-so-strongly-typed variables, funny rounding rules and so on, but I wouldn't say that all you can do with it is crap!

      The software we were making just works. It has worked for 13 years and keeps working. Maybe it could be little faster if written with some other language and tools or it might have more fancy UI blaablaablaa but it doesn't need those. And rewriting those hundreds of thousands lines of code... Let's just say that I wouldn't like to be in that team.

      --
      You don't know what you don't know.
    9. Re:In my experience... by RAMMS+EIN · · Score: 4, Insightful

      I don't think the main issue is which language you start with. What's important is that you teach people multiple paradigms and multiple languages, so that they are aware of them and their strengths and weaknesses.

      --
      Please correct me if I got my facts wrong.
    10. Re:In my experience... by $pearhead · · Score: 5, Insightful

      I disagree. Programming isn't something you learn from someone else. Programming is something you learn by yourself. Of course, you can get excellent help/lectures/tips/advice/insights/whatnot at an university for example, but my point is that in the end you have to sit down and think and then write some code (and figure out why it doesn't work) by yourself. I would say it doesn't matter if you start with Visual Basic or Pascal; if you haven't got the ambition/derive/whatever to really sit down by yourself and figure things out, you will never be a (good) programmer.

    11. Re:In my experience... by Anne+Honime · · Score: 3, Interesting

      If I had mod points, I'd gladly give them all to you ; I'm not a programmer by education, but I've always programmed tools since I have a computer. Basic could be abused in the past (in fact it was more or less a requirement with MS-BASIC on 8 bits computers - 48 Kb RAM !) but since OOP has become widespread, you just can't beat that language for day to day scripting, SQL access etc. Even in the mid 80s, if you were lucky enough to have a better PC than the average plastic toy, you could go with Basic-E or CBasic, which were by many aspects precursors to Java.

      The sad truth is today's Basics (VB, Gambas...) have an unfounded bad reputation ; you can't really abuse them anymore, and with a bit of care, they make a very good entry point in the programming realm for everybody. And if Linux is to become relevant on the desktop, it needs power users to be able to switch the enormous base of custom applications made in VB for every business out there on Linux. The VB6 converter in Gambas might become soon the killer app of Linux, in that respect, combined with superior DB access and tight KDE integration (yes, you can use DCOP in Gambas).

      To me, Gambas, being free software, fills the same spot MBasic was fulfilling on Amstrad CPC or Commodore 64. It gives control to the user, and that is priceless. Since my 8 bits days, I've learned bits of x86 ASM, Clipper, C, C++, perl, and liked the extra power it gave me ; but I've indulged in Gambas for a couple of months, and realisticaly, it's the only way to create a cool looking, desktop integrated application on spare time in a pinch. If I were again the teen I was, I'd like to begin programming with it because it would be the quickest rewarding experience in programming. You get to love programming cool things you can show to the world before you actually begin to like programming correctly for the sake of it.

    12. Re:In my experience... by Skrynesaver · · Score: 2, Interesting
      I'm of a similar background, self-taught in QBasic, Turbo Pascal, Perl, C, C++.

      Since finding Perl I've written most of my tools in it and these days if I want to develop a GUI quickly I do the logic in Perl, the database on MySQL and the front end in Tcl/Tk.

      Granted Perl's a whole new command set for "Power users" to learn and doesn't provide portability for personal VB apps, however for my quick and dirty development of tools that I and others in the company use every day I find the combination untouchable.

      The number of available modules for Perl, particularly for administration/network tools, and the simplicity of Tcl/Tk make for very rapid development of tools, granted the abscence of anti-aliased fonts and other eye candy does break the "Pretty is a feature" rule but hey, it's for admins not users.

      --
      "Linux is for noobs"-The new MS fud strategy
    13. Re:In my experience... by sgt101 · · Score: 4, Interesting

      The languages students need to study are :

      Prolog
      Miranda/SML/Haskell
      Java/C++/C#/Smalltalk/any other imperative with OO

      Because these show the different choices in representation that programmers essentially have : declarative, functional, imperative (scripts). OO is a useful concept to describe to students because it gets them used to the ideas of abstraction and forces good programming practice like information hiding.

      Later on it would be good if Universities taught web development (Php for example) and database development (SQL, possibly microsoft tools).

      Interestingly universities do not teach, and I think rightly, the most common activity that CS grads end up doing in the real world, which is installation, integration, customisation and configuration of COTS products like CRM systems.

      --
      --------------------------------------------- "In the end, we're all just water and old stars."
    14. Re:In my experience... by Anonymous Coward · · Score: 2, Funny

      No! No! No! You are posting to slashdot remember? Your post should be a pontificating rant about how all development should be done in C/C++ (or better yet assembler) punctuated with the occasional sneer at VB developers. You would get bonus points if you could some how disparage Web Developers and fit in a whine about AJAX.

    15. Re:In my experience... by namekuseijin · · Score: 2, Interesting

      There's a good reason why MIT's introductory computer science courses are teach in the Lisp dialect Scheme: so that they can focus on teaching algorithms, modular design and other high level concepts rather than doing the grease monkey work of dealing with manual memory allocation and an old CPU design when the world quickly changes to a more parallelized approach.

      --
      I don't feel like it...
    16. Re:In my experience... by Flodis · · Score: 5, Insightful
      VB is a rapid prototyping environment. And just like an RP machine, it makes a flimsy product that you can send back to the drawing board without much expense. But you don't ship a product you've made on an RP machine -- it's crap. You take your prototype, and make a real product out of it using sturdy materials. Same goes for VB. You make something that works the way you expect, then you make it work in a real language. Good thing about VB is that you can replace pieces at a time with DLLs compiled from C++. If that isn't a part of the VB curriculum, it's a waste of time.
      Sigh... To me, this sounds like a typical rant from someone who doesn't have any actual experience.

      Anyway... I think the problem may be that VB is too easy to use. People who would not be able to write the makefile for their 'Hello World' program in C++, are able to write working but very rickety/ flimsy VB programs.

      I happen to make a living as a computer consultant. This means I get to see a lot of different organizations and their in-house software... This means a LOT of VB code... And of that VB code, a lot (maybe 90%) is written by people who may know their business but don't have a clue about programming. I can definitely see how that would create the reputation that VB programmers are bad, but not how it makes the LANGUAGE bad.

      As for stability, I can promise you that some of my VB programs are a hell of a lot stabler than the memory-leaking SEGF/GPF-ing C++ hacks they replaced. In case you didn't know - it's perfectly possible to write shitty C++ code too. It's just that you have to get above a certain level to even get the compiler to work, so most of the would-be self-made computer wizards turn to something easier instead.. Like VB.

      The big question here is: Is it better to have a flimsy but functioning VB program or a defunct makefile? I'm not sure of the answer myself. A defunct makefile is a 5-minute job to fix, whereas some of the VB messes I've seen would literally take years to get straightened out. (I hate people who think they can program just because their $h!+ compiles.)
    17. Re:In my experience... by try_anything · · Score: 2, Insightful

      It's better not to encourage the belief that one language can be good for everything. Students invest themselves in that belief quite strongly anyway just because of wishful thinking.

      They also acquire the belief that unfamiliar syntax is a serious barrier to learning a new language. Forcing students to learn a few languages with different-looking syntax might help. The superstition seems to be reinforced by the fact that their every attempt to learn a new language lasts about two weeks, so giving them brief exposures in a class about programming language concepts would only reinforce it. Better to teach a language by making it the official language of a certain class and requiring that all programs for the class be written in it.

    18. Re:In my experience... by Alioth · · Score: 2, Insightful

      Grrr.

      If that's a computer science course, or any other degree that purports to teach fundamentals, that's so wrong it's not even wrong.

      You have to learn the fundamentals, not use ready made components. Indeed, I'd advocate at least some assembly language programming, because this forces you to think HOW the machine actually does things. It needn't be x86 or anything particularly fancy - but something that will at least teach the student on an absolutely fundamental level what happens when you get a buffer overflow that starts overwriting the stack.

    19. Re:In my experience... by tehcyder · · Score: 2, Funny
      No! No! No! You are posting to slashdot remember? Your post should be a pontificating rant about how all development should be done in C/C++ (or better yet assembler) punctuated with the occasional sneer at VB developers. You would get bonus points if you could some how disparage Web Developers and fit in a whine about AJAX.
      You forgot about acting horified at the mere name "COBOL", and also possessing the ability to imply that you are simultaneously a thirteen year old multi-millionaire programming superstar whilst also having been around to help Alan Turing with his soldering and probably Einstein with some of his more difficult sums.
      --
      To have a right to do a thing is not at all the same as to be right in doing it
  2. ... but doesn't remember how he did it?? by jarich · · Score: 2, Funny
    "Software developers have become adept at the difficult art of building reasonably reliable systems out of unreliable parts. The snag is that often we do not know exactly how we did it."

    So he doesn't remember how he created C++ huh? That explains a ~lot~!

    ;)

    1. Re:... but doesn't remember how he did it?? by jarich · · Score: 2, Funny
      Only problem with it is it leaves off at 1993 or so, just as the ISO process was getting to its feet.

      Ah ha! I thought so!

      (It's humor! Come on... laugh with me!)

  3. Problems with Programming by pchan- · · Score: 5, Insightful

    I wouldn't take programming advice from a guy who overloads the bit-shift operator to perform I/O.

    1. Re:Problems with Programming by _merlin · · Score: 4, Insightful

      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      Of course, there are arguments for the other side, two. One is that people will create similarly named methods on different objects that do completely different things, and ambiguous operators are no worse than ambiguous method calls. Another is that in cases where the normal operation of an operator is meaningless, it should be acceptable to overload it with different functionality.

      Overloading the bit shift operator on I/O streams is a case of the second way of thinking: a bit shift makes no sense on an object, so why not use it for something else.

    2. Re:Problems with Programming by 2short · · Score: 4, Insightful

      Why, because you've been confused by that? Because anyone has ever been confused by that ever? So you see:

      cout << "You are a bazooty head";

      and you think, obviously, that is supposed to shift the bits of the standard output stream left by "You are a bazooty head"?

      I wouldn't even call it an overloaded operator except in an overly technical sense. It's an operator that means two different things, and while that may in general be a bad idea, in this case the possible contexts for those meanings are so different, it's not anything close to a problem.

      Now I'm sure people will deluge me with examples of cryptic, intentionally obtuse code that dumps the results of shift expressions directly to streams, and thus abuses this construct to create confusion. That's not the point. In decently written code, it's not a problem.

    3. Re:Problems with Programming by compact_support · · Score: 2, Interesting

      There's nothing intrinsically wrong with operator overloading as other posters have indicated. One thing I do think C++ could do better is have operators in a family. For instance, == and != have well understood and complementary functions. When we define equality on a type, the definition for inequality is pretty obvious. In the spirit of C++, there should be a way to specify completely different functions for them of course, but generally bool operator!=(const X &x1, const X &x2) { return !(x1 == x2) }; Just like x x. Or we could go further and say that y >= x is the same as !(y x). This is how Haskell handles its operators. Eq types can define equality, inequality, or both.

    4. Re:Problems with Programming by QuantumG · · Score: 4, Interesting

      Some say C++ didn't go far enough, in that you can't define arbitary operators. As such, you have a small limited number to choose from and therefore overloading is all you can do. I'd love to be able to define an operator like .= to do string concatenation, but I can't, so I use += and live with the confusion and possible errors that causes.

      --
      How we know is more important than what we know.
    5. Re:Problems with Programming by misleb · · Score: 2, Insightful
      Overloading the bit shift operator on I/O streams is a case of the second way of thinking: a bit shift makes no sense on an object, so why not use it for something else.


      Especially when you can make it do something intuitive (if only visually). I mean, "" looks like "I/O" to me. It looks like the are sending the item to teh right towards/into the item to the left. Makes sense to me.

      If only the rest of C++ was the intuitive. ;-)

      -matthew
      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    6. Re:Problems with Programming by epine · · Score: 4, Insightful

      I've been involved in more threads than I wish to recall slinging mud at C++ and there is always a strong representation from the crowd who aren't willing to invest the time to understand the object they are criticizing. The criticism fundamentally boils down to: why should a language force me to think?

      The fact of the matter is that the conceptual challenge of writing pointer-correct code is isomorphic to other forms of resource-correctness which one must still confront in whatever saintly language one employs. When I worked with microcontrollers (fairly hefty ones), in actual practice I never lost any sleep over pointer correctness. However, I did sweat bullets over real-time response in my nested interrupt handlers. Pointers were small potatoes compared to fundamental challenges posed by the design of the hardware we employed. A few small changes to the hardware design would have saved enormous challenges in the software layer. No language would have spared me that challenge.

      Certainly overloading can be abused. Has it ever caused me a problem? Never. Excess delegation in an object-oriented framework? Nightmares.

      Another post blames C++ for having an accretion-based design process. Oh, that stings. It was an explicit design approach to gain real-world understanding of one feature before designing the next. The two areas where the C++ design process got ahead of itself were multiple inheritance and templates. The former Stroustrup has confessed was perhaps a misguided priority. The later was caused by discovering that templates were an exceptionally fertile mechanism very late in the standardization process. C++ templates evaluate at compile time as a pure functional language. What makes templates difficult is that they are too much like other languages (e.g. Haskell) that the same people go around praising.

      If one fully understands the cascade of implications of the original decision to take a relatively hard line on backwards compatibility with C, there isn't much in C++ that strikes me as "could have been vastly better". OTOH, I've come to the opinion that for someone who lacks that deep historical perspective, the overhead involved in mastering all the syntactic quirks that stemmed from that root is excessive. I don't regard C++ as a language that justifies the learning curve unless the person is suited to the kind of challenge involved in writing a real-time correct interrupt handler on a random piece of hardware that wasn't necessarily designed to make this easy.

      Just the other day I commented out a section of PHP code in website skin (a language I use irregularly) to roughly this effect:

      <!--
      <markup> ... </markup> <?php require ("somefile.php"); ?> <markup> ... </markup>
      -->

      somefile.php executed regardless and emitted an HTML comment which closed my open comment in the first line above, leaving my closing comment exposed in the rendered document. Sigh.

      At the end of the day, I find it extremely obnoxious the sentiment that some kind of pure language design can save us from this misery. There is no salvation to be found among programmers who brag mostly about thinking less.

    7. Re:Problems with Programming by 2short · · Score: 4, Insightful

      As a former co-worker once put it "C++ is a professionals language"; while this sounds at first like snobish looking down ones nose at other languages, it's not. If you're going to be spending much of your productive work hours over some significant chunk of your career writing code, C++ may be the language you want to do it in. If not, it's probably not.

    8. Re:Problems with Programming by jcr · · Score: 3, Insightful

      The criticism fundamentally boils down to: why should a language force me to think?

      No, the fundamental criticism is: why does C++ introduce so much complexity for so little benefit? It's not like Stroustrup didn't have plenty of examples of better work at the time. He can't claim that he made his mistakes because he wasn't familiar with the literature.

      Another post blames C++ for having an accretion-based design process.

      No, I don't blame the accretion, I blame the people who allowed it to continually adopt new misfeatures to try to work around the previous mistakes.

      Oh, that stings.

      Hey, if Stroustrup suffers a little bit of "stinging" for the thousands of man-years of pain he's caused to a generation of developers, I'm not going to shed a tear for him.

      -jcr

      --
      The only title of honor that a tyrant can grant is "Enemy of the State."
    9. Re:Problems with Programming by Anonymous Coward · · Score: 2, Insightful

      You hit the nail on the head with: "The criticism fundamentally boils down to: why should a language force me to think"... the problem (and it's a doozy) with C++ is that it forces you to think about the language, not about the problem you're trying to solve. I cry when I see someone farting around with templates and eight different programming abstractions just so they don't have to use cast on a pointer, when the pointer code would have been ten times easier to understand and maintain. Examples of C++ masturbation are endless on any real-sized project, the language provides far too many different ways to accomplish basically identical tasks, and nobody can agree on one aesthetically pleasing subset to stick with. C++ turns genious programmers into incomprehensible sages of the minutia, and mediocre programmers into outright dangerous ones who cause more regressions than forward progress (this is experience programming in ~million-line C++ projects for the last 25 years talking).

    10. Re:Problems with Programming by GreatBunzinni · · Score: 2, Informative
      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      You mindlessly claim that allowing people to make operators do different things on different types is a bad thing. Do you actually know what's good about supporting operator overloading? It's the ability to make operators do different things on different types. Now that's a pickle for you. Care for an example? Let's take a class that represents complex numbers. Tell me what's bad about being capable of doing something like:

      Complex c1(0,1);
      float f = 1.0f;
      Complex c2 = f*c;
      Complex c3 = f + c;
      Complex c4 = f/c;
      That piece of code is only possible thanks to operator overloading. The same applies to vectors, matrices, tensors, etc... Heck, what about those extended precision/range number classes? Where would they be if it wasn't possible to overload the basic algebraic operators?

      So it is easy to see, at least to anyone which has at least a basic grasp on C++, that operator overloading is obviously a good thing. Heck, where's the bad thing about being capable of defining operators on a data type?

      OTOH, if you have a problem about the way some coders use operator overloading (i.e., doesn't match your personal taste) then put the blame where it should be put: the coder's decisions. No one forces anyone to use, for example, a multiplication operator to concatenate strings or an addition operator to insert objects into a list. Stroustrup isn't holding a gun to that coder's head, for God's sake. Yet, to some people the use of those operators for those particular tasks is a nice thing to have.

      So please don't claim that a feature is bad or broken just because you fail to realize it's usefulness and potential.

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    11. Re:Problems with Programming by quigonn · · Score: 2, Funny

      Can you bring a concrete example? In my C++ programming, I never had to cast a pointer, except for maybe a dynamic_cast or two. In my experience, the shitty and ugly code comes from programmers who learned C++ in the early 1990s and didn't have a closer look at modern C++, with features such as RTTI, exceptions, and a usable standard library including (most importantly!) a string class (I have seen so many inferior own implementations of this, it's unbelievable).

      --
      A monkey is doing the real work for me.
    12. Re:Problems with Programming by hey! · · Score: 4, Insightful

      I wouldn't take programming advice from a guy who overloads the bit-shift operator to perform I/O.


      Well, in the real world we have these things which often seriously limitthe elegance of our designs. They're called constraints.

      In the case of C++, Stroustrup wanted to add extensions to C that would turn it into a complete object oriented programming language. With the hindsight of years of experience, some things that were then thought to be critically important turned out to be of only marginal value. Multiple inheritance for one thing. Another thing was allowing object classes to act as "first class types", which implies the need to create and overload operators. However, given the state of knowledge at the time, they were reasonable goals.

      So, Stroustrup needed to implement operator overloading. He also chose to implement C++ as a preprocessor that converted C++ into C. There were some undesirable consequences of this, but for the most part it was a good decision for the language. What he accomplished at one stroke was creating a complete and highly capable object oriented programming implementation available on a vast number of systems. The big advantage of C is that is small size made it the most portable language ever; piggybacking on it brought much of this advantage to C++, with minimal effort (another real world constraint).

      IIRC, one of the undesirable consequences of his implementation approach was that it was much more convenient to limit C++ operators to tokens that are recognized as tokens in the C compiler. This means that to allow classes to be first class types, the operators we define on those classes were "overloaded" C operators.

      From a design standpoint, this kind of "overloading" is a totally different kettle of fish from normal operator overloading. "Overloading" proper implements a kind of conceptual parallelism: floating point addition is analagous to integer addition, even though it has a totally implementation. True OO operator overloading plays the same role in expressions that polymorphism does in method calls. The C++ use of existing C operators to implement new concepts (e.g. I/O) is a pure kludge.

      This is what is known in the real world as a trade-off.

      We thought, back in 1979, that making classes first class types with their own operators was pretty important. Stroustrup needed to implement it then, but he also wanted to piggyback C++ on the existing C compiler for the reasons noted above. This trade-off satisfies both constraints at the cost of some aesthetic inelegance. Redefining the bitwise shift operator for I/O is conceptually inelegant, but it gets the job done and creates no confusion in practice. This is also a good trade-off.

      In retrospect, Stroustrup could have left certain of the features of C++ out, becuase either they have proved more problematic than they are worth (e.g., multiple inheritance) or they are not really as useful as people thought they were going to be (operator overloading). Perhaps what we really needed was more like Objective C. But C++ became the dominant systems programming language, and Objective C did not. Speaking as somebody who worked through the era of C++'s rise to dominance, this is a direct result of Stroustrup's choice of trade offs. C++ was more widely ported. And C++ was a convincingly complete implementation of nearly everything we thought was important to have in an OO language at the time.

      There is no doubt that C++ is a work of genius -- what's more a rare mix of pragmatic ane theoretical genius. If you need proof, consider that after twenty five years, C++ remains an indispensable systems programming language, if not the indispensible language. You can hardly fault Stroustrup if it is not quite what we'd come up with today.
      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    13. Re:Problems with Programming by maxwell+demon · · Score: 2, Insightful
      Except that for operator overloading, I've never seen any argument which cannot be used for named functions as well. Indeed, I've only ever seen one argument: Operators not doing what the operator symbol suggests are confusing. Of course they are, but that's the same with functions:

      bigint add(bigint a, bigint b)
      {
        bigint result;
      // code setting result to the product of a and b
        return result;
      }
      --
      The Tao of math: The numbers you can count are not the real numbers.
    14. Re:Problems with Programming by radish · · Score: 2, Interesting

      Speaking as a professional who doesn't use (or want to use) C++, I disagree. Whilst I agree that there are tiers of languages, and there are plenty I certainly wouldn't want to use on a regular basis, C++ is by no means the only one worthy of serious consideration. Java is one other obvious candidate, also (as much as I hate to say it) C#. And I'm sure we all know a 20+ year pro who uses Perl for everything :)

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    15. Re:Problems with Programming by Kupek · · Score: 3, Interesting

      I'm curious why you think multiple inheritence in C++ is more trouble than it's worth.

      As far as operator overloading is concerned, the intent was to provide the conceptual parallelism you explained. In D&E, he talks about C++ users asking for the capability for things like matrix addition. Using << and >> for stream input and output was an afterthought. Further, I don't think it was leveraging the C compiler that precluded him from overloading operators other than what were already in C. He easily could have supported new operators, as Cfront was not just a preprocessor, it was a full compiler that happened to compile down to C. Since I've never read anywhere (either in interviews, D&E, or TC++PL) why he chose to not allow arbitrary operators, I assume it was because he didn't feel they were necessary. I know that D&E has discussion of an exponent operator, which was eventually ruled out.

    16. Re:Problems with Programming by 2short · · Score: 2, Informative


      Which is why I said C++ may be the language you want; certainly there are other candidates. I'm saying I would not reccommend anyone use C++ on an irregular basis. If you're a biologist who does some coding on the side, don't use C++; and don't be surprised if it seems unsuited to your needs.

      By analogy, I'm a coder who occasionally does some welding in the garage on weekends. Professional welders would scoff at my hobbyist-level equiptment, and be insanely frustrated by its limited capabilities. But were I to use their equiptment, I would quickly reduce my project to a bubbling pile of slag, and probably set something on fire.

      I know sys-admin types, who use a lot of Perl for the myriad little bits of programming they have to do. For real software development, Perl is not an option.

    17. Re:Problems with Programming by cbciv · · Score: 2, Insightful
      That's the outflow of an inherent problem with allowing operators to be overloaded. People will inevitable make them do different things on different types, making it impossible to know what an operator does without knowing something about the types of the arguments.

      Bad programmers will fuck up in any language. Pruning features from a language won't stop this. It will only hamstring good programmers.

    18. Re:Problems with Programming by radish · · Score: 2, Informative

      Completely agree, on rereading I realise I misunderstood the last line of your post as implying that if you don't want to use C++ you're not a professional. Mea culpa :)

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    19. Re:Problems with Programming by hey! · · Score: 3, Interesting

      I'm curious why you think multiple inheritence in C++ is more trouble than it's worth.


      Because nearly always composition is a better way to deal with the design problems multiple inheritance attempts to solve, especially as the situation becomes more and more complex. Also, inheritance often implies more than necessary -- multiple inheritance multiply so. You usually are most concerned with guaranteeing an object's behavior when you use inheritance, but you also get an implementation whether you want it or not. This creates unnecessary complexity and problems when you use multiple inheritance simply to ensure that object class memebers provide certain services.

      I'm not saying it's never useful of course. But it is never necessary and often a bad thing.


      He easily could have supported new operators, as Cfront was not just a preprocessor, it was a full compiler that happened to compile down to C. Since I've never read anywhere (either in interviews, D&E, or TC++PL) why he chose to not allow arbitrary operators, I assume it was because he didn't feel they were necessary. I know that D&E has discussion of an exponent operator, which was eventually ruled out.


      You make some good points. My guess is this: allowing user created operators probably made lexxing difficult or impossible. You wouldn't be able to tell whether a sequence of characters was an operator or something else until you had parsed the operator's definition. You couldn't have a fixed grammar either, which might preclude further parsing even if you had a clever way of guessing that some string is probably an operator.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    20. Re:Problems with Programming by 2short · · Score: 2, Insightful

      Well, quite a few of us see the benefit (and frankly don't think it's all that complex). If you don't, don't use it; nobody is holding a gun to your head. Nobody is holding a gun to the head of the many, many programmers who do choose C++. C++ is a wildly popular language; if you can't figure out the reason why, that doesn't mean there isn't one.

  4. Code Structure vs. Function by Salvance · · Score: 5, Insightful
    Bjarne says:
    Think of the Mars Rovers, Google, and the Human Genome Project. That's quality software
    but then goes on to say:
    On the other hand, looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability
    I doubt he has seen the code to the Mars Rovers, Google, or many other applications that he/we consider quality. He's judging it based on the software's function. If we were to judge software purely on how it worked, quite a bit of software could be considered quality. But if you were to look at the same software's code, you'd probably "cry" like Bjarne. Look at Firefox. That is a Quality application, but programmers I've spoken to said the code is a mess.
    --
    Crack - Free with every butt and set of boobs
  5. Ridiculous. by sammy+baby · · Score: 5, Funny
    Stroustrup:
    On the other hand, looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability. Most people don't actually read code; they just see Internet Explorer "freeze."


    Now that is just ridiculous. I'm using IE7 to post this article, and have been using it since its release, and I can say
    1. Re:Ridiculous. by grammar+fascist · · Score: 4, Funny
      Now that is just ridiculous. I'm using IE7 to post this article, and have been using it since its release, and I can say

      You can say that it's magical, because it managed to post for you just before it crashed. Though that's pretty nifty, I've seen Firefox tack on a "NO CARRIER" before. Maybe you should submit a feature request.
      --
      I got my Linux laptop at System76.
  6. Only my second favorite by jgannon · · Score: 4, Funny

    This is only my second favorite Stroustrup interview. The first is here: http://www.chunder.com/text/ididit.html (Yes, I know it's a hoax.)

  7. Re:The biggest problem is choosing the right langu by Eideewt · · Score: 2, Insightful

    FTFA: "My brief definition is, correct, maintainable, and adequately fast. Aesthetics matter, but first and foremost a language must be useful; it must allow real-world programmers to express real-world ideas succinctly and affordably."

    Sounds like Lisp to me.... It's a mystery to me why anyone would voluntarily program in a language that makes the things that should be easy difficult, and makes things like segfaults, which should be pretty darn hard to do, easy enough to accomplish by accident. Yet so many people do it.

  8. "On the other hand, ..." by TransEurope · · Score: 5, Insightful

    "...looking at "average" pieces of code can make me cry. The structure is appalling, and the programmers clearly didn't think deeply about correctness, algorithms, data structures, or maintainability."

    Maybe it's because the average programmer is enslaved in company business. They don't have the
    time to create masterpieces or art in programming. Instead of that they are forced to create
    something adequate in a given time. Happens almost everytime, when science becomes business.
    I don't like that, you don't like that, no one likes that, but that's the way commercial industries
    are working (at the moment).

    1. Re:"On the other hand, ..." by 2short · · Score: 3, Insightful


      I deal every day with programmers who don't think they have time to deal with things like correctness, algorithms, data structures, or maintainability. In their panic to create something adequate in a given time, they invariably run over time and create something inadequate. They'd have been much better off doing it the "right" way, because the whole reason it's called the "right" way is it's the fastest way to get the bloody job done.

      Like it or not, writing code that has to be done on some deadline, and work, is how commercial (and much non-commercial) coding is; at the moment, at all previous moments, and for all future moments. So learn to write good code in that environment or get a different job; don't write bad code and blame it on obvious truisms.

      Sorry, long day :)

    2. Re:"On the other hand, ..." by SageMusings · · Score: 3, Insightful

      So learn to write good code in that environment or get a different job; don't write bad code and blame it on obvious truisms

      Sure....

      And the moment you demonstrate to the organization you can write a quality app in 3 months, they'll decide they can ask for the next one in 2 months. You should come and try my environment some time.

      I wouldn't say we write bad code. We just write adequate code in a survival mode to appease customers who were assured by our sales team that we can change anything they like.

      --
      -- Posted from my parent's basement
    3. Re:"On the other hand, ..." by redblue · · Score: 2

      That's funny... I work completely from home and code for fun as much for profit. For some reason it looks exactly like the code I wrote for the Big Evil Companies I used to work for.

    4. Re:"On the other hand, ..." by misleb · · Score: 2

      Oh please. Look at just about every open source project out there. No management holding them back. No marketing departments making unreasonable demands. No accountants cutting budgets. And yet most projects are full of flaws and crappiness. I'm not knocking Open Source. I love it, but at the same time I have to overlook a lot of shortcomings. When it comes right down to it the Linux kernel, for example, is not significantly better than, say the Solaris kernel. They each have their own strengths and weaknesses. No one could point to he Linux kernel source code and say "now that is awesome code that no corporation could ever produce because of budget constraints, et al."

      Fact is that programming major projects well is the real world is HARD. Really fsckin' hard. It has nothing to do with the demands of business.

      -matthew

      --
      "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
    5. Re:"On the other hand, ..." by 2short · · Score: 3, Insightful

      I generally have a release deadline every 2 weeks or so. I have some code I've been building on for 8 years; and some I've re-invented and re-written so many times I shudder to think what might have been accomplished with the time I'd have saved if I hadn't tried to take a shortcut the first time I wrote it.

      If there is anything that my job has firmly beaten in to me it's that doing it right saves you time over taking the shortcut; and not even down the road, but right there, the first time. The stupefyingly huge savings in maintainability and reusability are just gravy.

      It sounds to me like I would say you write bad code, and I'd recommend trying to write the best code you can because it will get things done faster. Salesmen promising customers unreasonable things won't change, so it's no reason to make things worse. If the things they sell are truly unreasonable, in that they cost more to do than someone pays, and they don't get fired, then your management is incompetent. In that case, you're screwed, but still no reason to make it worse. :)

    6. Re:"On the other hand, ..." by loconet · · Score: 2, Insightful

      "the whole reason it's called the "right" way is it's the fastest way to get the bloody job done"

      Wrong. Why do I keep hearing this argument? It makes no sense whatsoever. I've heard it from many managers, is that what they teach them? I'm obviously missing something. My experience and common sense tells me that it takes longer to sit down and design a solution using a well thought out process (ie: the "right" way) than it takes to throw together a hack to address the problem quickly.

      If the "right" way is the fastest way to get the job done, why wouldn't more people use it? Why would the majority of programmers, always "complain" about having to sacrifice correctness for timeliness. Is the incompetence level _that_ high? I don't think so, I've heard this "complain" from bright programmers.

      Think about it. Wake up at the usual time you wake up during a work day and try to paint your house before you leave for work. Assume that you absolutely need to finish the project before you leave for work. How good of a job are you going to do vs doing it on the weekend with a more thought out plan, taking the time to evenly cover all the walls, taking care of covering the floor, furniture, using the right paint, ventilating the rooms properly, letting it dry before you apply a second hand, etc.

      The "right" way involves different stages of analysis, design and development which usually take time. Hack jobs exist for a reason and not because programmers didn't realize that "the 'right' way is it's the fastest way to get the bloody job done"!

      --
      [alk]
    7. Re:"On the other hand, ..." by qwijibo · · Score: 2, Insightful

      I think the "right" way is the one that takes the least time in the long run. The problem is that business is focused on "good enough right now" and doesn't care if spending a week instead of a month on something now may still cost the same month later, plus another couple of months of converting everything from the wrong way to the right way. From the business perspective, "later" is someone else's problem. Businesses succeed or fail based on how effectively they determine which things can be put off until later and which need to be done correctly now.

  9. Firefox is a fucking mess. by Anonymous Coward · · Score: 5, Informative

    The Firefox codebase is indeed a mess. Don't take my word for it, view it yourself: http://lxr.mozilla.org/seamonkey/source/.

    Part of the problem is the severe over-architecturing. This over-architecturing has added much unnecessary complexity to the overall design of Gecko and Firefox. Much of it is "justified" in the name of portability. But then we find that other frameworks, including wxWidgets and GTK+, do just fine without the overly complex and confusing architecture of Gecko and Firefox.

    It's just not easy for most developers to become up-to-date with the Mozilla codebase because of all this added complexity. Unless a volunteer developer has literally months to spend learning even the small portion of the code they're interested in working on, it's basically inaccessible to most programmers.

    The constraints of the real-world often come into play, and we have developers modifying code they don't necessarily understand fully. And so we get the frequent crashes, glitches, memory leaks and security problems that Firefox 1.5.x and 2.x have become famous for.

    It's likely that Mozilla should ideally rewrite a vast portion of their code, keeping simplicity in mind. That likely won't happen, and thus we will most assuredly still run into problems with Firefox and Gecko, problems caused directly by the overcomplication of the Mozilla architecture.

    1. Re:Firefox is a fucking mess. by Maian · · Score: 3, Interesting

      Actually, they do plan a major revamp of the Mozilla base. So major that they're going to use a tool to help automate the process.

  10. Re:Real Experience by Anonymous Coward · · Score: 3, Informative

    Stroustrup developed much of the cfront C++ compiler, which itself was written in C++. It received widespread use on most UNIX platforms, and was the default C++ compiler on systems like HP-UX and SCO UnixWare. Numerous organizations licensed it, and some even offered ports to systems like DOS.

    He was the head of AT&T Labs' Large-scale Programming Research department for a number of years. I'd imagine you're not familiar with some of the cutting-edge research he was responsible for when it comes to massive software systems. Had you actually been familiar with his achievements, you wouldn't have accused him of coming up "short in the real world department".

  11. He summarizes one of the big issues in SD now... by Bamafan77 · · Score: 5, Interesting
    From the article:

    TR: How can we fix the mess we are in?

    BS: In theory, the answer is simple: educate our software developers better, use more-appropriate design methods, and design for flexibility and for the long haul. Reward correct, solid, and safe systems. Punish sloppiness.

    In reality, that's impossible. People reward developers who deliver software that is cheap, buggy, and first. That's because people want fancy new gadgets now. They don't want inconvenience, don't want to learn new ways of interacting with their computers, don't want delays in delivery, and don't want to pay extra for quality (unless it's obvious up front--and often not even then). And without real changes in user behavior, software suppliers are unlikely to change.

    There ya go! Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers. Ergo, great programming is incompatible with most business models (i.e., most businesses don't have the money to make the software they want at the quality they want). It's sort of like wanting a Ferrari, but only having enough money to buy Gremlin. Sadly, many (most?) programming projects are nothing more than an arms race between getting something out the door that hangs together reasonably well and the bottom of the client's bank accounts.

    The good thing about working in software-centric companies (besides understanding the programmer psyche) is that they often don't balk as much at being told something can't be done in a timeframe. Blizzard doesn't blink an eye when it has to delay a game by a year (probably more like 2 or 3 years when compared to internal, non-public set dates). Microsoft finally decided to nuke WinFS once they finally conceded that you're not going to get it within this decade, no matter how much they throw chairs. Google apparently has almost no schedules.

  12. Its crazy by JustNiz · · Score: 3, Insightful

    To all those people saying C++ is too dangerous/prone to errors and Java/C## is the way ahead:
    Stop blaming the tools and look to yourselves.

    C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
    Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

    Unfortunately it seems that there are a lot of people out there who like to call themselves programmers but have no actual ability. Java/C## does a good job of removing their need to think and hiding their inate lack of skill which is why they prefer it.

    But there's a reason why surgeons don't use plastic scissors. The same applies to good software engineers.

    1. Re:Its crazy by Coryoth · · Score: 2, Interesting
      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

      So where does something like Eiffel fit in? It's all the usual bist to stop you shooting yourself in the foot (a strong static type, garbage collection, etc.) plus added extras to make your code even more maintainable, and even harder to shoot yourself in the foot (design by contract, SCOOP concurrency, etc.) yet when it comes down to it the compiler turns out code on par with C++ for efficiency, and way better then C# or Java. You can say much the same of O'Caml with a very powerful and robust type system (far safer than C++, Java, C#, or Eiffel) and plenty of performance. It's possible to make sharp tools without completely throwing away safety.
    2. Re:Its crazy by EvanED · · Score: 5, Insightful

      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy

      "C++ gives you enough rope to shoot yourself in the foot"

      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.

      I'm not convinced of the "totally inefficient" bit. I think you'd be pressing it to do time-critical systems (indeed, current GC is more or less incompatible with realtime systems), OSs, etc., but I'm not convinced that they're not just fine for applications. This especially applies to C#, because C# GUIs are actually responsive. (Swing and to a lesser extent SWT lag a little.)

      But there's a reason why surgeons don't use plastic scissors.

      There's also a reason carpenters don't use scalpels. It's because different tools are good for different jobs.

    3. Re:Its crazy by QuantumG · · Score: 3, Insightful

      As much as your comment is flamebait, I have to agree with you to a point. The "virtual machine" aspect of the Java programming environment has probably done more to harm the quality of programmers than anything else. I know java programmers who don't understand how a computer works. They ask me questions about "how the processor loads strings into registers" and such. Being able to not think about the nitty gritty of the processor you are writing your code for is great, but that doesn't justify not knowing the basics of how a processor actually works. You might as well be coding in LOGO.

      This, of course, is not true of all Java programmers. It probably isn't true of most Java programmers, but I feel safe to say that it's true of more Java programmers than it is of C or C++ programmers.

      --
      How we know is more important than what we know.
    4. Re:Its crazy by Domstersch · · Score: 2, Insightful
      C++ is like a sharp scalpel. Yes you can hurt yourself if you're unskilled, inexperienced or sloppy.
      Java and C# are like those scissors with rounded ends for kids. Totally inefficent but safe for beginners.
      Your analogy is quite adept, because surgeons do, often, use scissors with rounded ends. Surgical scissors come in a number of varieties, including blunt/blunt (with both points blunted), sharp/blunt (that only expose a point when opened), and sharp/sharp. If you're going to be poking around inside someone, you don't want any sharp points beyond those that are strictly necessary, and that you're using to get the job done. How this applies analogously, to programming languages, is left as an exercise to the reader.
      --
      =w=
    5. Re:Its crazy by arevos · · Score: 2, Insightful
      The "virtual machine" aspect of the Java programming environment has probably done more to harm the quality of programmers than anything else. I know java programmers who don't understand how a computer works. They ask me questions about "how the processor loads strings into registers" and such. Being able to not think about the nitty gritty of the processor you are writing your code for is great, but that doesn't justify not knowing the basics of how a processor actually works.

      You don't explain how knowing the gritty details of a computer helps a person become a better programmer. Sure, it's nice to know, and I once spent several enjoyable months getting to know the instuction set of the 68008 very well indeed, but I'm not altogether sure that experience has been particularly useful. Most of the work I do is either highly abstracted, or efficient enough without giving a thought to the processor's architecture.

      Or, to put it another way, you don't necessarily have to know how to bake clay bricks in order to become a good architect.

  13. Re:Which university is that? by rucs_hack · · Score: 2, Informative

    mine teaches java prediminantly, and I've had to tutor third year students who seem to lack more then rudimentary programming skills.

    The logic they go by seems to be 'Download a class for it, no need to code it yourself'. It drives me crazy.

  14. Re:The biggest problem is choosing the right langu by Nicholas+Bishop · · Score: 2, Informative

    Well, one good reason to accept the possibility of segfaults is speed. C and C++ allow you to get down as close as you want to the underlying hardware, which (if the programmer is sufficiently skilled) can produce much faster code. Obviously this doesn't matter much in your average desktop software, but there are are any number of application types (3D games, simulations, animation/rendering systems, system libraries) where speed is still very much a concern.

  15. Agreed... by Bamafan77 · · Score: 4, Interesting
    Maybe it's because the average programmer is enslaved in company business. They don't have the time to create masterpieces or art in programming. Instead of that they are forced to create something adequate in a given time. Happens almost everytime, when science becomes business. I don't like that, you don't like that, no one likes that, but that's the way commercial industries are working (at the moment).
    Agreed, but the problem is complicated. Sometimes code is bad because the programmer is not very good (vast majority of cases). Other times it's bad because a good programmer wasn't given enough time to do that job. I once inhereted something where a customer wasn't happy with a product and I pulled open the hood expecting a mess. Instead what I got was extremely well documented code explaining the layout, sanely named variables, and some fairly complicated things happening in an understandable manner. The guy who I got this from was a very good programmer (heh, how often does THAT happen?!). Then it occured to me that the customer simply wanted the impossible done.

    Anyway, the typical unsophsticated (software development-wise) customer can't tell the difference between the two. This is made worse when many managers who were supposedly professional programmers themselves can't tell the difference. As far as I can tell, the only way for a programmer to deal with this is to simply BE great and be ready to move on if the customer can't see that greatness. Eventually they'll get somewhere that will appreciate it.

    I also cover some of this in another reply.

    1. Re:Agreed... by squoozer · · Score: 3, Insightful

      Sometimes code is bad because the programmer is not very good (vast majority of cases).

      I hear this quite a bit and I think it's probably a flawed assumption or at least to simple a statement to describe the truth. The vast majority of developers can't be below average or the average would drop. What we can say is that a good portion of developers seem to have a poor grasp of basic software development skills. What we need to ask then is why.

      In my experience there seems to be far more variation in skill level between software developers than I have seen in any other profession. Perhaps this is simply because I am only familiar with software development and there is the same spectrum width in other professions as well but I somehow doubt it. I suspect, however, that software development is actually a very very hard process that only a small number of people truly have the mental discipline for. Since that number is less than the number of developers required we need to do something to make software development easier for the masses of developers. This is similar to the way cabinets were made. The master cabinet maker would produce the top and front and the less skilled (apprentice) would produce the frame (since it's easier).

      --
      I used to have a better sig but it broke.
    2. Re:Agreed... by try_anything · · Score: 2, Insightful

      What separates the good from the bad in the real world is context. Some guys are great at setting up wikis, installing automated testing harnesses, and designing test cases. Others are good at talking to customers and managers. Others are good at debugging and profiling. Others are good at cranking out boilerplate implementations of business logic. Others are good at sitting alone in an office writing diagrams and mathematical equations, designing out redundancy. Others are good at understanding other programmers' minds and produce great APIs and documentation.

      Almost everyone is hopeless at one or two of the above, and some people are brilliant at one or two but hopeless at the rest. A guy who is brilliant at one thing is going to fail in a three-person startup where the other two people are nontechnical. Likewise, a versatile, Perl-scripting sysadmin may be a crackerjack developer for a small company, but hopelessly outclassed when placed in a specialized role in a big development group.

  16. couldn't say "NO" to a feature by r00t · · Score: 4, Insightful

    The KISS principle is totally lost on that guy.

    The moment you have 2 people doing C++ on 1 project, at least 1 person will be faced with code written using features they just don't understand. C++ has features to spare.

    Think you know C++? No, you don't. Heck, the compiler developers are often unsure.

    This is a recipe for disaster, as we often see.

    C was hard enough. Few people truly understood all the dark corners. (sequence points, aliasing rules, etc.)

    C++ is addictive. Everybody wants one cool feature. C code is somewhat easy to convert. Soon you're using enough of C++ that you can't go back, and hey, more is better right? The next thing you know, some programmer on your team got the wise-ass idea to use Boost lambda functions (for no good reason) and you find yourself with 14 different string classes and... you have a mess that no one single developer can fully deal with.

  17. Surgeons don't use scissors, tailors do by coder111 · · Score: 3, Insightful

    Of course surgeons don't use plastic scissors. But how often do you need a surgeon? Most of the time you need a cheap tailor to make you a suit. And that's when scissors come in handy.

    C++ can do wonders when used by highly experienced people. But most of the time, it is more cost effective to get entry level coders and use PHP/Java/C#/whatever. You will get a (somewhat) working product cheaper and possibly faster. And time to market and cost is often more important than maintainability/quality.

    And don't get me started on 3rd party C++ libraries. You'll need tons of them to move a finger, and you'll spend more time finding/eavluating libraries than coding. This problem is getting worse for other languages too...

    --Coder

  18. Stroustrup is the problem by Animats · · Score: 2, Insightful

    The problem with C++ is Stroustrup. Specifically, it's that, as what's now called "C++0x", the next revision, got underway, Strostrup insisted that C++ had no major problems - it just needed some cleanup. This was after a decade of trouble with buffer overflows and related safety issues.

    C++ is unique in that it has hiding without safety. No other major language is in that space. C has neither hiding nor safety; Java has hiding with safety, as do almost all languages which postdate C++. This is not fundamental to a compiled language; Modula 2 and 3, and Ada, had hiding with safety. Nor is it related to garbage collection, inherent problems of an efficient, compiled language, or the needs of systems programming. Providing backwards compatibility with C while bolting objects onto the language led to safety issues that were never overcome.

    Most of the problems with C stem from the "pointer equals array" model, the basic source of buffer overflow bugs. C doesn't even have a way to talk about the size of array arguments (well, C99 does). Dangling pointers are also a problem but a secondary one. C++ tries to paper this problem over with collections, but far too often, collections have to expose a C pointer to get something done. At that point, size information is lost. Right there is the biggest single problem with C and C++.

    The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. There's a whole "generic programming" cult of abusing the template mechanism to do computation at compile time. Millions of users suffer from unnecessary program crashes, and the US is more vulnerable to malware and cyber-terrorism because of this focus. It's as if the IEEE committee on power transmission standards was dominated by people who were into making big sparks.

    Stroustrup could have insisted on actually fixing the safety problems. But he didn't.

    (I'm writing this as someone with over ten years of experience in C++, doing everything from protocol stacks to game physics engines to real-time programming. And after ten years, I'm fed up with the mess. This should have been fixed years ago.)

    1. Re:Stroustrup is the problem by shutdown+-p+now · · Score: 3, Insightful

      Sounds like what you want is simply not what C++ designed to deliver. Blame yourself for not choosing the right tool, not the tool itself.

    2. Re:Stroustrup is the problem by pherthyl · · Score: 2, Interesting

      Fair enough for the most part. (Don't use the ugly parts of boost if you don't want, and please give a concrete example of where collections need to expose a pointer).

      But what is really missing from your rant is an alternative. It would be the most beautiful rant in the world if it ended with "And it doesn't have to be this way, CSuperDuperDoublePlus does everything C++ does without the problems!". Except it didn't, which means that C++ is still the language to use for a lot of tasks. Anything CPU intensive for example. There are still plenty of applications where performance really matters. Aside from the usual (image processing, video editing, etc) even any moderately complex program requires better performance than what Java/C#/Python can provide in some codepaths. So if you know of a language that's completely safe and at the same time as efficient as C/C++, you really should have mentioned it.

    3. Re:Stroustrup is the problem by luzr · · Score: 2, Interesting

      While I do not think "buffers" are the real problem of C++, I have to agree with "boost-cult" part.

      I think the whole think started to sink when Bjarne hastily forced STL to become the part of language standard. STL looks very nice at first, but fails to solve the problem in real world.

      In any case, it is a little but stupid to have container library unable to store objects in object oriented language (I know, C++ is called "multiparadigm", but objects are dominant part of language in many problem domains).

      This in long term causes all these nice troubles and people wanting garbage collection in language, thousands of attempts to provide reference counted smart for various scenarious etc...

      And then of course for some reason many "guru" C++ programmers found a new toy in templates and started all that lambda fun (which can be described as contest of writing better for_each loop).

      What a pity. C++ is excellent (core) language, but it is seriously misused. And "C++ experts" live in sort of self-denial, solving problems nobody is really interested in.

    4. Re:Stroustrup is the problem by ivec · · Score: 2, Informative

      Stroustrup insisted that C++ had no major problems - it just needed some cleanup. Lame FUD. Can you provide a reference that supports this fallacious statement?

      My recollection is that Stroustrup was:

      • encouraging library extensions rather than language extensions, acknowledging that the language was already complex enough as it is
      • encouraging language changes/extensions only where they make C++ easier to learn and understand
      Specifically, you may want to check http://www.artima.com/cppsource/cpp0x.html
      Short of dropping backwards-compatibility with the current code base, what kind of language changes would you like to see?

      C++ is unique in that it has hiding without safety. Noting in the C++ standard requires the language to be "unsafe".

      If you look at standard C++ library implementations, for example, some are currently providing ubiquitous range-checking (within the library). Compliers have started to provide built-in checks for buffer overruns. You can integrate a garbage collectors as add-on (personally I much prefer RAII). And C++ could be compiled to a virtual machine.
      But the standard does not mandate any of the above, because it does not want to preclude the use of C++ for system programming.
      And it also just seems that the community of C++ users still remain more interested in the latest optimizing compilers and auto-vectorization capabilities, than in the safety-enhancing features.

    5. Re:Stroustrup is the problem by Rufty · · Score: 2, Interesting

      Objective C ???

      --
      Red to red, black to black. Switch it on, but stand well back.
    6. Re:Stroustrup is the problem by cortana · · Score: 2, Informative

      CFLAGS += -lgc

    7. Re:Stroustrup is the problem by frantzdb · · Score: 2, Insightful

      Until recently, I thought the STL was just a "container library" too. Then I was introduced to the many useful algorithms it includes. An interesting read is Stepanov's Notes on Programming which describes some of the design decisions behind the STL and how it relates to generic programming. There are imperfections, but overall it is a very powerful library and is certainly not just containers - those are just the obvious part.

    8. Re:Stroustrup is the problem by pbaer · · Score: 3, Informative

      There's actually a language called D that is related to C++ and is supposed to fixe a lot of C++'s problems, and annoying syntax. Features.

      --
      There are 11 types of people, those who know unary and those who don't.
  19. There's only one real problem: lack of talent by CPE1704TKS · · Score: 4, Insightful

    The problem with programming is that too many people that lack the talent are in the programming business. I know because I work with many of them. They are not detail oriented, they don't think strategically, long term, etc and just make a mess of code. They only want to fix the problem they need to fix without worrying about the effect it will have on the system, etc. This is what causes bad programs. Programming is easy enough that any moron can make something work, but to make something continue to work requires an engineering understanding, and this is something most people don't have. It's unfortunate.

  20. Irony by Anonymous Coward · · Score: 2, Insightful

    C++ is unique in that it has hiding without safety.

    The C++ revision committee is dominated by people who want to do l33t things with templates, things nobody will ever do in production code but, they think, are really cool. On the one hand you criticize c++ for "hiding without safety", in the same post you criticize the c++ revision committee for doing "l33t stuff with templates". l33t stuff with template allows efficient containers which largely alleviate the problems with pointers in c++.

    Stroustrup could have insisted on actually fixing the safety problems. But he didn't. How would you "fix" it, without losing its efficiency? I write image compositing software, when I want to write UI code I use python but when I write image processing code I use C++, I want to be able to access raw memory (abstracted trough a "l33t" template interface of course ;) ). Any changes to C++ would have to accommodate this type of valid use.
  21. Re:He summarizes one of the big issues in SD now.. by misleb · · Score: 2, Insightful
    There ya go! Time pressures and price are fundamentally incompatable with code quality, even amongst the best programmers. Ergo, great programming is incompatible with most business models (i.e., most businesses don't have the money to make the software they want at the quality they want). It's sort of like wanting a Ferrari, but only having enough money to buy Gremlin. Sadly, many (most?) programming projects are nothing more than an arms race between getting something out the door that hangs together reasonably well and the bottom of the client's bank accounts.


    Ok, then please explain why Open Source projects are full of flaws just like commercial products. Are all the geniuses exclusively employed by companies that stifle greatness and everyone else is doing Open Source? Please. Programming greatness is rarely achieved... anywhere. The problem developing for profit is that you need a product to profit from. That means you have to ship something that is imperfect just to stay in business and make a living. The problem developing on your own for free is, again, that you need to make a living and really don't have the kind of time to produce greatness (assuming your are capable). Either way, it comes down to resources. One can rarely get enough outside of work and one can rarely get enough AT work. Same problem. Business drives development just as much as it stifles it.

    -matthew
    --
    "THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
  22. Re:The biggest problem is choosing the right langu by Coryoth · · Score: 3, Informative

    No benchmark is ever going to be a definitive measure, the best they can ever do is give you an idea or the general qualitative differences. I think you'll find, however, if you were to actually try Ada, Eiffel, D, or OCaml for an entire application, that they do, in fact, compare very well with C++ - it's not like there aren't any significant large applications written in those languages (well, possibly not D): they get plenty of use in various industries and are well known for their efficiency.

  23. There is no silver bullet. by shess · · Score: 4, Insightful

    Many of the points in the interview implied that software was simply soaking up all the hardware performance, and perhaps we could squeeze more out of the software. I completely agree, except ...

    http://www-inst.eecs.berkeley.edu/~maratb/readings /NoSilverBullet.html

    The problem is that the software is an order of magnitude slower than it needs to be because the hardware has increased in performance by 2 and 3 and 4 orders of magnitude. If we had held the software to the same standards as we used to back when the hardware cost more than the programmers, it would be more efficient - but would only be able to make use of a couple megabyte of RAM and disk. The looseness of current software is part and parcel of harnessing the hardware. The hardware didn't just allow us go loose with the software we wrote - it allowed us to use abstractions which were measurably less efficient, but which had the side effect of allowing us to harness the hardware in the first place.

    As a pair of trivial examples, take arrays and dictionaries. When I ask interview questions like "Design a hashtable" or "Reverse a linked list", many candidates have to actually step back and think about the question! 30 years ago, designing a good hashing function was the mark of true talent, and gains were to be had by selecting the linked-list scheme which best suited the problem at hand. These days, many people don't really know why you'd use a map versus a hash_map, or a vector versus a deque. And, for the most part, they don't really need to.

  24. Re:The biggest problem is choosing the right langu by frank_adrian314159 · · Score: 2
    It has similarities to Common Lisp and Scheme, but it uses a traditional infix notation. Paradigm-wise, it starts out a lot like C + structs, and you can explore out from there.

    Which means you learn nothing other than a new syntax to program your same old style in (i.e, nothing worthwhile). Not to mention that Dylan's macro system will leave you crying because computational macro systems in a syntax heavy environment just suck. If you're really short of time, you're better off using it to learn Erlang, Prolog, or Smalltalk. With the first two, you'll learn new ways to think about programming; with the second, you'll at least get better tools and have more fun. Either is more useful than Dylan.

    --
    That is all.
  25. You want Lisp. by piranha(jpl) · · Score: 4, Insightful

    You want Lisp. Hear me out.

    Of course, the character syntax is superficially different. Operators use infix notation ("(+ 1 2)" is analogous to "1 + 2"), and have identical character syntax as function calls ("+", an operator in Lisp jargon, may be implemented as a function).

    If you can sleep at night after that, your can define own higher-level language syntax that looks exactly like any other Lisp syntax. Lisp is extremely flexible in its naming of functions and variables (symbols). If you'd like, you could define an operator named .= as a function: (.= string new-character-strings ...) would modify the given string object, string , in-place, appending each specified new-character-string to the end.

    Recognizing the downside to modifying random strings in-place, perhaps you'd rather have your .= operator assign a newly-instantiated string to the variable referenced by string . You could, by writing the operator as a macro. The macro would act like a function, taking as input each "raw" argument—symbols and lists, the structure as they appear in your program, before evaluation—and returning as output replacement Lisp code to evaluate in its place. So that your .= operator form of (.= out "lalala") is semantically equivalent to (setf out (concatenate 'string out "lalala")) (like out = out . "lalala"; in other languages).

    It's not just simple textual substitution. You can use any function or macro in your macro definition to transform your input arguments into whatever replacement code you'd like. I'm using macros in Common Lisp to generate recursive-descent parsers based on a grammar production expression: the following form defines a function named obs-text that takes a string as input and returns a list of matches found as output:

    (defproduction obs-text
    (LF :* CR :* (obs-char LF :* CR :*) :*))

    This function is defined in place and evaluated and compiled immediately by the Common Lisp implementation.

    Macros can be abused, but they add a tremendously powerful capability of abstraction not possible with many other languages.

  26. Re:Which university is that? by rucs_hack · · Score: 4, Insightful

    yes, for Rapid Application Development. However that is *not* the point of studying computer programming.

    While a good coder knows when to re-use code. A coder incapable of originating complex code is little more then an automaton.

    I'm sick of the 'don't re-invent the wheel' argument being dragged out and used to justify people not studying properly, or for that matter, not teaching properly. I was lucky, I attended a course where most lecturers believed that students should code their own assignments.

    Examples being recursive functions, sorting functions, Dijkstra's shortest path algorithm, stuff like that. However I have recently had to cope with people being given exactly the same type of assignment, and being allowed to download pre-built classes for them! What, I ask you, is the point of that?

  27. Re:"...a decade of trouble with buffer overflows" by root_42 · · Score: 2, Insightful

    >> C++ defines container classes which cannot overflow.
    >> Try using them next time you write some C++ code.
    >
    > No, the STL defines container classes, and they suck
    > just as badly as the C++ language itself. Performance
    > goes out he window unless you spend inordinate amounts
    > of time ensuring that all the classes you put into the
    > containers are setup to avoid multiple copying. This is
    > a major pain in the arse, as different implementations
    > of the STL have different semantics, and "accepted best
    > practice" is to not to hold a copy rather than a
    > reference to an object in a container

    On the contrary -- the GP is quite correct. First, the STL ist not called the STL anymore for ages. It is part of the C++ standard library. And that's what it is -- a STANDARD. Compilers that do not follow the semantics described IN the standard are plainly broken and should only be used with care, if at all. But this is always a problem with languages that are implemented by a lot of people. Java for example is simple, because there are only vert few implementations in existance, and most probably 95% of the people using Java uses the one done by SUN. I think only very few use gcj for example.

    Also the STL is not that complex as you think and it really is efficient, if used correctly. But that is the case for any library and any tool. Furthermore one can always put pointers to objects in a container, which is the same as using a reference. And if you want to have some safety there, use a smartpointer -- there is nothing complicated about that. The discussion here really shows that C++ is indeed a COMPLEX language and that indeed it is NOT UNDERSTOOD by many of us here. But I think those who have worked with it for some years and REALLY UNDERSTOOD some of the more complex topics of it, will admit that C++ is a powerful, efficient and elegant language. There is no all-purpose language that is ALWAYS simple, efficient and elegant. This just can't happen. But C++ fits a lot of purposes well. For example for many occasions I write small python programs when I need to do some parsing, conversion or small calculations. That's totally great! But I also use C++ for larger programs, because it offers a vast amount of libraries and ideas. Not having to implement my own partition, sort, find or vector every time is really helpful. And those algorithms even run very fast on all my self-created types.

    --
    [--- PGP key and more on http://www.root42.de ---]
  28. Re:Start ASSEMBLY on PAPER, no COMPUTERS by hotdiggitydawg · · Score: 2, Funny

    Paper and pen? Luxury. When I were lad, we had to use papyrus and lump o' charcoal, and compilin' were done by chisellin' machine code int' stone tablet.

  29. Re:"...a decade of trouble with buffer overflows" by LizardKing · · Score: 2, Informative

    Java for example is simple, because there are only vert few implementations in existance

    The reason Java is simple is that it didn't try to be a multi-paradigm language, where the inevitable trade offs left C++ inadequate in every paradigm. Java was also well described in a decent specification rather than being standardised too late in the day as happened with C++. There also exists a canonical Java test suite, whereas the C++ standard is littered with opportunities for implementation specific functionality, especially in the STL.

    Also the STL is not that complex as you think and it really is efficient, if used correctly.

    I can write efficient code for Sun's implementation of the STL that will generate multiple calls to the copy constructor in GNU STL when adding an object to a container. Neither STL version violates semantics as described in Stoustrup's book, it's just one of a vast number of implementation specific features that are allowed in an STL implementation.

    There is no all-purpose language that is ALWAYS simple, efficient and elegant.

    No, but I struggle to think of a single instance where I have encountered C++ code that proved to be simpler, more maintainable or more efficient than the equivalent written in C, Perl or Java. Of the three large C++ based projects that I have become involved with, two were scrapped and replaced with a mix of C and Java. The third is still proving to be a hindrance to those trying to maintain and extend it, so much so that a parallel system is evolving, largely written in Perl.

  30. Re:Which university is that? by Mark_Uplanguage · · Score: 2, Interesting

    A good reason to use some older language like Pascal or FORTRAN would be to avoid the pre-built classes problem.

    --
    "The difference between stupidity and genius is that genius has its limits." -- Albert Einstein
  31. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

    I think that students should start with C, move to pascal, then onto perl/python/lisp, and after that C++, or perhaps java (even though I hate that language, and I've had to teach it, so I'm not blindly critical). A smattering of php wouldn't be bad.

  32. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

    nice.

    I don't object to java being taught, just the use of premade code to replace having to do stuff yourself.

    Do ensure you widen your skillset well beyond java though, single language knowledge is a bad idea. Knowing several and specialising in one is better, since you can move to different languages as the need arises with ease.

  33. Re:Which university is that? by Kamots · · Score: 3, Interesting

    Hmm...

    I'd say pascal first as an introductory programming course, then C, then some assembly, then finally C++ or Java.

    It's a lot easier to learn sequential programming when you're not busy shooting yourself in the foot... let them hit C after they know what a conditional and a loop are :) Not sure where you'd want to throw in a scripting language; or if it's even really neccessary... what skill do you learn from learning a scripting language other than the language itself?

  34. Re:Which university is that? by computational+super · · Score: 3, Interesting
    Isn't that kind of the purpose of Java, one way to do it, don't reinvent the wheel?

    Maybe in usage, but that doesn't lend itself well to learning. Learning, by definition, is the process of reinventing the wheel so that you understand how the wheel works. They don't teach algebra by presenting the quadratic formula and saying, "Here, use this when solving a polynomial of degree 2" - they lead you every step of the way through the development of the quadratic formula so that you know how it works and why it works. Likewise, programmers learning to program should be writing quicksort implementations rather than ignoring the details because "it's already implemented in a library".

    Of course, once you've graduated and are a professional writing a program for somebody else to use, you should reuse what's available as much as possible.

    --
    Proud neuron in the Slashdot hivemind since 2002.
  35. Re:Which university is that? by Mark_Uplanguage · · Score: 2, Informative

    That's interesting. I learned Pascal first and then C. The reason I found this helpful was the Pascal was more controlled (I can't remember all of the correct words anymore). C allows all kinds of memory allocations, redefined pointers and such which are brutal on a beginning programmer. Pascal prevents a lot of those mistakes, therefore giving you a chance to learn some concepts without too much disaster. As for perl/python/lisp. I think lisp is great for showing another way/paradigm of programming. Perl/python/ruby allow you to merge everything together. Of course Smalltalk/Squeak would be great for bringing home object oriented programming. After that PHP, JSP, ASP, whatever is just suited to the environment you're working in. Reality is that you'll probably never get that many programming languages into a B.S.

    --
    "The difference between stupidity and genius is that genius has its limits." -- Albert Einstein
  36. Why should a language force you to think? by cquark · · Score: 2, Insightful
    I've been involved in more threads than I wish to recall slinging mud at C++ and there is always a strong representation from the crowd who aren't willing to invest the time to understand the object they are criticizing. The criticism fundamentally boils down to: why should a language force me to think?

    That's a good question. The purpose of a programming language is much the same of that of mathematical notation, which is to allow you to think at the level of abstraction of your problem while not wasting time with irrelevant details. Modern calculus notation gives university freshmen the ability to solve problems in a few hours that baffled the greatest minds of history for thousands of years.

    Note that this doesn't mean that you don't have to think when learning a mathematical language. The concepts of limit, derivative, and integral are difficult to grasp at first, but once you understand them, they offer powerful mathematical methods that allow you to think about the problem at hand and not the notation you're using.

    Can computer science make similar claims? The jump from assembly to FORTRAN was a tremendous improvement in productivity, but FORTRAN to C or C to C++ produced small to no productivity improvements, perhaps in part because you have to think more and more about the language. We should be looking for a language that may require thinking to learn, but that once when learned offers powerful methods at a high level of abstraction that allow you to think about the problem without being distracted by the language.

    I would suggest that we look at languages like Haskell, Scheme, or Smalltalk, which do require that we learn concepts like currying, higher-order functions, monads, and type classes, but which offer a higher level of abstraction and greater consistency than languages like C++ or Java.

  37. The C++ Hater by Zobeid · · Score: 2, Insightful

    Not enough is made of the sheer obfuscatory nature of C++. C was already somewhat cryptic, but at least it was small. C++ is cryptic and large, and that's really a bad combination. At one point in the interview Stroustrup recounts that half the programmers he polled who said they disliked C++ then admitted they had never programmed an application using C++. He calls that prejudice. I call it perfectly normal human behavior; if you begin to study a language and quickly discover it to be a load of tailings, then you will be disinclined to program applications using it.

    That was my experience anyhow. I began studying C++, and at some point I stopped and asked myself, "Why must I endure this? Surely there must be better options." And I was right.

    I really have to grit my teeth when Stroustrup talks about C++ "winning" against competing languages. C++ is successful for the same reason that COBOL and Microsoft Windows have been successful: because they happened to appear in the right place at the right time, and were promoted by the right people, to become entrenched. Once entrenched, the world was saddled with them for decades to come. It has nothing to do with their inherent qualities or advantages, it's little more than random chance.

  38. Re:Which university is that? by rucs_hack · · Score: 2, Insightful

    "Coding it? Why? Only to prove to yourself that you can do it! I did it when I was younger. "

    No No no no no!

    To learn it in the first place! Weren't you paying attention? You even demonstrated my point by saying 'I did it when I was younger'.

    Yes, you did, so did I, would I re-write something when someone had a better implementation than me? Perhaps, if I wanted to learn how to do it, but not if I needed it soon, or had reasonable assurance that the existing implementation was better then I could do myself. However I have yet to move into a new area of coding without getting my feet wet by implementing some of the code used in that domain myself, just to know what I was talking about.

    What's more use, a programmer who has learned about a thing, then produced on his own an implementation of same, however basic, or one who studied it just to pass an exam and never built it in the real world?

  39. Re:"...a decade of trouble with buffer overflows" by try_anything · · Score: 2, Insightful

    C++ vectors *can* be used safely, but the library designers used traditional, easy-to-read syntax for unsafe access and verbose, hard-to-read syntax for safe access. They clearly meant for unsafe access to be the norm and safe access to be used in special cases. I'm a C++ fan, but in this case they screwed up badly.

  40. not-so-strongly-typed variables by mosel-saar-ruwer · · Score: 3, Insightful

    it's not-so-strongly-typed variables, funny rounding rules and so on

    I know they're like [pagan] Gods to an awful lotta people in the CS community, but The Founders of The Art, guys like Kernighan, and Ritchie, who had the chance to insist that a declaration actually mean something, but hesitated, and hemmed and hawed, and got all wishy-washy, and finally decided [really deferred a decision until it was too late to make a decision] that a declaration could mean any-damned*-thing that the implementor wanted to interpret it to mean, well those guys, those pagan Gods of the Founding Arts, seriously - someone should take them out behind the toolshed and whip their asses** [if not shoot them outright].

    So now, fast forward 30 or 40 years, and we've got:

    "floats" in the ATI GPU world that are only 24 bits in length
    "floats" in the nVidia/Microsoft/IBM/Sony/Cell world that are 32 bits in length
    "floats" in the classical Unix world [e.g. SunOS/Solaris] that are 64 bits in length
    etc etc etc
    And then you go to do something in VB, or in Javascript, and you get shit** like

    2 + 2 = 4.0000000000012459
    or, what's even worse,

    2 + 2 = 22
    and you end up having to write shit**** like

    var i = parseInt(2);
    var j = parseInt(2);
    var k = parseInt(parseInt(i) + parseInt(j));
    window.alert(i + " + " + j + " = " + k);
    and you scream at your computer, "YES, THESE ARE NUMBERS, NOT CHARACTER STRINGS, YOU GOD-DAMNED***** COMPILER/INTERPRETER/SYNTAX/PARADIGM/NIGHTMARE OF A SACK OF SHIT******!!!!!"

    PS: There is a special circle in Hell******* for the sonuva bitch******** who dreamed up the idea of interpreting variable types on the fly...

    *Pardon my French.
    **Pardon my French a second time.
    ***Pardon my French a third time.
    ****Pardon my French a fourth time.
    *****Pardon my French a fifth time.
    ******Pardon my French a sixth time.
    *******Pardon my French a seventh time.
    ********Pardon my French a final time.
    1. Re:not-so-strongly-typed variables by 2short · · Score: 2, Informative

      K&R did not commit Javascript, and aren't responsible for the problems in your examples.

      K&R invented C. In it, and the myriad that follow it's lead, variables will sometimes get converted to closely related types for the purposes of expressions that need them. I for one want to be able to write

      float x = 2.0 + 2;

      without the compiler throwing up it's hands in a panic not knowing what to do.

          But numbers will not be converted to strings, and of course conversions will have no lasting effect on the variable in question. That would obviously be completely insane, and the utter moron who thought it was a good idea should rightly be forced to write javascript all day, and electro-shocked for every bug.

      Finally, if the number of bits in your floats matters, you can specify it precisely. If, with any regularity, you'd rather have a specific number of bits in your floats rather than whatever the processor handles natively (and thus rapidly), you shouldn't be using floats. Floats don't represent things exactly, no matter how many bits they have. (Well, contrary to your example, they tend to represent powers of two exactly, but that's just trivia.)

  41. Bjarne said it best right near the beginning by msobkow · · Score: 2, Insightful

    From the article:

    I think the real problem is that "we" (that is, we software developers) are in a permanent state of emergency, grasping at straws to get our work done.

    How often have you worked on a prototype or demo, only to have the time/expense budget slashed because management decided you must be almost finished when they see a demo GUI?

    How often have you encountered copy-paste-edit code replicated throughout a system because no one had the time to refactor the replicated code into a reusable module?

    When did you last have the time and budget to clean up that rushed prototype via refactoring before the next phase was in crunch mode?

    How often were you told you can't refactor code because it's already been tested and put into production?

    How many "silver bullet" tools have you tried over the decades, only to find that they're marketing hype and often increase the total workload instead of saving time? (e.g. Now you have to maintain UML models as well as the code and database schemas.)

    As long as the "push" is to get it done faster regardless of long-term costs, crap code will continue to churn.

    --
    I do not fail; I succeed at finding out what does not work.
  42. Re:Start ASSEMBLY on PAPER, no COMPUTERS by swamp+boy · · Score: 2, Funny

    And we were thankful! Also, we had to walk through 6 feet of snow to the programming "chisel lab" and it was uphill both ways.

  43. Re:Which university is that? by hobo+sapiens · · Score: 2, Insightful

    Me too, though this was purely coincidental because where I went Pascal was not a pre-req for C. But when I finally got to my C course, which by the end of the year had a dropout rate of 50%, it was relatively smooth sailing. I already knew how to program from my Pascal course, and heck, even the syntax was close enough. This is from someone who took CS courses just as a curiosity, I actually wanted to be an electrical engineer. I say that to make the point that I had no prior programming experience, and yet after just one semester of Pascal, I was ready for C. Pascal is the perfect primer for C; I dare anyone to name a better language for that purpose.

    --
    blah blah blah
  44. Re:Which university is that? by Doctor+Memory · · Score: 3, Insightful

    I think they should learn computer languages in the order that they evolved: assembler first, then FORTRAN, then Pascal (as the ALGOL representative), then C, then Smalltalk. Maybe throw Lisp in there between FORTRAN and Pascal (even though I believe it's older than FORTRAN). Actually, C is kind of a step backwards from Pascal (limited scoping and no built-in I/O), maybe just tack that on to the last couple of weeks of assembler.

    And let's not forget that students should really be studying computer science, not programming. They shouldn't learn how to do a binary search, they should learn why it's such a powerful technique. The implementation falls out naturally from the description. Likewise for trees of various flavors. Teach them how to identify the language features that best support the algorithms they need, and let them figure out which language is most appropriate for themselves. After all, any language they learn in college will be out of favor by midpoint in their career anyway (or earlier, for those of us that learned Pascal...), so better to teach them how to learn a new one from the start.

    --
    Just junk food for thought...
  45. Re:Which university is that? by jcgf · · Score: 4, Funny

    Why have pascal in there at all? Let it die just let it die.

  46. Re:Which university is that? by mccoma · · Score: 2, Insightful

    Lisp should definitely be in there. Heck, start all the students on Common Lisp and we won't have everyone thinking all languages need to look like Algol.

  47. Re:Which university is that? by Pollardito · · Score: 4, Funny

    starting them out at assembler is jumping the gun. surely they should learn to use an abacus and a slide rule before moving on to Babbage's mechanical computer and then assembler programming on punch cards

  48. Re:Which university is that? by Dr+Avatar · · Score: 2, Interesting

    I hold the exact opposite opinion.

    I believe effective learning should be done in a top-down manner, whereby students start from putting building block together, gradually drill down to understanding how the blocks themselves work. This view is echoed in the classic C++ textbook "Accelerated C++".

    Real-world programming requires good exposure to design patterns and programming idioms, and effective use of canned routines. As such, colleges should focus on this skillset in order to equip people for the industry. This is exactly the same reason why nowadays colleges no longer teach hardcore assembly techniques like those used in Knuth. It is absurd that colleges these days still make linked list writing mandatory, and design pattern course an elective.

    I myself am a real-time system engineer and back a couple years I taught operating system and computer architecture at Hong Kong Univ of Sci and Tech, I have always been of the opinion that the industry does not need a lot of OS gurus. These hardcore stuff is best be left to the graduated and professionals, who choose to develop in these niche areas.

  49. It's the programmer, and partially the tool by Mock · · Score: 3, Insightful

    While you can bash the tools as much as you want, the point remains that the majority of the fault for bad programs lies with the programmer.

    Just as an adept sculptor can build a beautiful (though somewhat rough) art piece using a chainsaw, so can a good programmer make do in situations where he is forced to use the wrong tool for the job.

    Namespaces can be simulated with a good naming convention.
    OO can be accomplished in a procedural language.
    Technologies can be married together, and even replaced in part with other technologies at a later date (it's called refactoring, folks!)

    I currently program exclusively in Java. I learned from the ground up (Analog electronics -> Digital logic -> Machine code & Assembly -> C -> C++ -> other OO languages & scripting languages, AOP etc)

    I'd love to have multiple inheritance in Java, but I hate the fact that you can't rebind a reference in C++.
    I'd love to have real properties and closures supported by the Java language proper, but I make do with standardized boilerplate code in the meantime.
    I love the quick UI building you can do in VB, but I certainly wouldn't want to write business logic with it!
    Access is great for building quick and simple systems, and does its job well, but I'm not going to store 10 million records in it!
    Nothing beats the speed of a library written in assembler, but I'm certainly not going to write database access code in it!
    Perl is a great tool in the right hands. In the wrong hands, it is the worst disaster ever, and the first thing I get rid of when I take over support of a project (except for 10% of the time when the previous programmer was competent).

    I've seen horrendous code in every language I've ever encountered, and it's always a result of the programmer not understanding what he's working with. My personal opinion is that you shouldn't be programming unless you understand at least one layer below where you're working.

    Do you know how to examine a core dump? How about interpreting a Java HotSpot dump?
    Do you understand how the technology you're working with interacts with the operating system?
    Do you know how the auto-code generator deep within the script overlay you're using actually works? Have you even once looked at the intermediate output?
    How about the .S files created by your compiler? Do you even know what they are? Could you load an object file into a disassembler?
    What will you do when something goes wrong with it? Give up?

    Do you follow the generally accepted practices used in your domain? Do you even know what they are?
    Do you know what domain driven design is?
    Do you understand when it's a bad idea to use inheritance? (Answer: most of the time)

    I could go on forever. The point is that good programmers find the right tool for the job because they understand how it all works. Hackers do it fast, but forget to make it readable or maintainable. Bad programmers just plain do a bad job and make things shitty for everyone.

  50. My point of view by DimGeo · · Score: 2, Interesting

    It's not about languages, it's about people. Sure, C will make you track bits and bytes and jiggle with pointers. Everyone should try that and deal with mysterious crashes, etc. And one day switch to Java and track indices in arrays and null pointers and hash codes. But at the end of the day, it's all about people, not languages. If the people are smart, and if they love the field, they will advance no matter what they're taught at school. Very few are those go that far as to learn every new language, and one day reach the level when they just don't care about the tools they use, and cat get any job done with any language at hand.

    So, it's about people. We all make errors, we all over-enginner or under-engineer, we all write too complex code because of design errors. We all learn and advance. And not all of us make the best of choices.

    So what? This is not just with programming though. Just programming is the most complex task humans do.

  51. Good for gutters then by dazedNconfuzed · · Score: 2, Insightful

    For those of us working in the "gutters" - embedded systems stuffed into the sometimes gludgy real world - only a language like C++ will do. A polished user-level GUI app running atop layer after layer of abstraction can be written in something slick and aloof like Java, Lisp, or some nifty obscure language. ...but for those of us writing specialized critical apps running on minimal hardware and dealing directly with the real world, we need something that has only the thinnest layer of abstraction, is comprehensible and predictable, and will reliably affect reality.

    Sneer at "gutter"s as you like. Your house/apartment has them, your business/school has them, you don't notice them when they work, but they are quietly everpresent and designed by someone who had to think about them and use specialized tools to make them - and life would be less pleasant without them. Ditto for lots of C++ apps. You don't really expect a Java VM running on your toaster, do you?

    --
    Can we get a "-1 Wrong" moderation option?