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.'"

24 of 605 comments (clear)

  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: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.

  3. 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.

  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: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.

  6. 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.

  7. 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.
  8. 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.

  9. 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.

  10. 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.

  11. 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.

  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:Stroustrup is the problem by Rufty · · Score: 2, Interesting

    Objective C ???

    --
    Red to red, black to black. Switch it on, but stand well back.
  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:Problems with Programming by Anonymous Coward · · Score: 1, Interesting

    So you've been coding in C++ since 1981? That's impressive.

    I only have 10 years of C++, but my experience in polymorphism goes back further than that, done in C, pascal, assembly language both inside programs and in operating system extensions. My understanding of re-use goes back to before I started programming and had to amuse myself with 4000-series and 74-series logic ICs and a few LEDs. This sort of experience helps one to consider techniques on their own merit rather than as part of a programming language or fashion trend.

    There's a big lack of engineering in software development operations these days: so-called "programmers" or "developers" are really just clerks, accountants and librarians who chose CS for their degree. They know a language and can write it all day but dislike thinking about how the program will actually work.

    XP and modern "flat" management techniques don't help either. Everyone has to be a "coder" who can write code but is scum in every way, or a manager with a "wider management view" which is like being smart but doesn't require any actual knowledge or abilities. Such organisations literally force out the engineers, and failed projects result.

  17. 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
  18. 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?

  19. 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.
  20. 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"

  21. 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.

  22. 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.
  23. 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.

  24. 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.