Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
Programming IT Technology

Bjarne Stroustrups and More Problems With Programming 313

Phoe6 writes "As a follow up to the first part of his interview, Technology Review Magazine has another article running titled 'More Trouble with Programming'. Bjarne Stroustrup shares his point of view on good software, bad software design and aspect oriented programming." From the article: "Technology Review: Name the coolest and lamest programs ever written in C++, and say what worked and didn't work. Bjarne Stroustrup: Google! Can you even remember the world before Google? (It was only five years ago, after all.) What I like about Google is its performance under severe resource constraints. It possesses some really neat parallel and distributed algorithms. Also, the first Web browsers. Can you imagine the world without the Web? (It was only about 10 years ago.) Other programs that I find cool are examples of embedded-systems code: the scene-analysis and autonomous driving systems of the Mars Rovers, a fuel-injection control for a huge marine engine. There is also some really cool code in Photoshop's image processing and user interfaces."
This discussion has been archived. No new comments can be posted.

Bjarne Stroustrup and More Problems With Programming

Comments Filter:
  • by Anonymous Coward on Saturday December 09, 2006 @07:45PM (#17179176)
    It is,

    int main()
          cout "Hello World" eol;
          return 0;

    Very cool at first, then it just goes down from there.
    • Java (Score:5, Funny)

      by goombah99 ( 560566 ) on Saturday December 09, 2006 @08:15PM (#17179418)
      Javac is the coolest program written in C++ :-)
      • Re:Java (Score:4, Informative)

        by vocaro ( 569257 ) * <> on Sunday December 10, 2006 @05:29AM (#17182856)
        Uh, Javac is not written in C++. It's written in Java. Download [] the source code and see for yourself. It's in the package.
    • by Anonymous Coward
      Where in "Plain Old Text" you have to escape < as &lt;

    • > Very cool at first, then it just goes down from there.

      Psh, infix languages are lame. Try:

      you forth love if honk then


      (cond ((love 'you 'lisp) honk))

  • Stroustrups (Score:5, Informative)

    by abshnasko ( 981657 ) on Saturday December 09, 2006 @07:46PM (#17179188)
    Please... he's one of the most influential people in the field of computer science today, at least spell his name right.
    • Re: (Score:2, Flamebait)

      This site is about new spam, not accuracy, so keep your hopes down. Gems like this hidden in the muck of Microsoft bug articles (which are needed to pay the bills) still make Slashdot useful.
    • spell his name right.
      Yeah, but... Couldn't he have choosen a coller alias? Like Commander Taco or something, anything but Smurf Stirrups.
    • Why don't we just dereference him and call him 'B'?
  • Google's in C++? (Score:3, Informative)

    by feijai ( 898706 ) on Saturday December 09, 2006 @07:47PM (#17179202)
    My understanding was that much of Google was in python.
    • Re:Google's in C++? (Score:5, Informative)

      by say ( 191220 ) <.on.hadiarflow. .ta. .evgis.> on Saturday December 09, 2006 @07:53PM (#17179240) Homepage
      Googlebot is mainly written in Python. Google is mainly written in C/C++.
      • Re:Google's in C++? (Score:4, Informative)

        by Anonymous Coward on Saturday December 09, 2006 @09:50PM (#17180210)
        No Google bot is written in C++ html []

        When you need high performance, C++ is better choice than any other language. Google(or Yahoo) wont have a single language framework to run its platform. Always it will be combination of languages. Whatever have I read so far Google's core search engine is in C++ and several C++ libraries are available as python modules. Standalone products may be written in specific languages. Gmail and Google Calender are written in Java.
        • When you need high performance, C++ is better choice than any other language.

          Bullshit, C is. Assembler (just for the pedants) is too labour intensive and platform specific to be a good choice. With C++, lots of the features that on the face of them seem to be improvements over C, are in fact far less performant than C. Consider the "one size fits all" and implicit copying of the STL, or the brainfuck that is the iostream library once you actually want to format something.

    • Re: (Score:3, Interesting)

      No, not the data-crunching engine, not the indexer, not the ranker.... Python (and java, and ruby) is cool, but, frankly... sometimes you need the most of your hardware.
    • Re: (Score:2, Insightful)

      by abshnasko ( 981657 )
      How could something that large and efficiency-dependent be written in non-native code?
      • Continous/adaptive compilation. Like Java Hotspot.
        • by AuMatar ( 183847 )
          While those techniques are better than pure interpretation, they're still a good 40% slower or more than native code.
          • Re: (Score:3, Informative)

            That's benchmark-dependent. For some benchmarks, under some circumstances, you can generate faster native code during execution than a traditional compiler would generate beforehand.

        • There are at least two reasons why GoogleBot isn't written in Python. Firstly it's a very large and complex piece of code. Anecdotally, for very large codebases a statically typed language like C++ seems to work better with respect to allowing many developers to work together, because it requires and allows you to specify interfaces in a checkable way. Secondly it's performance sensitive. Your suggestion of continuous/adaptive compilation doesn't work because the resources that are used to redundantly compi
    • Re:Google's in C++? (Score:5, Informative)

      by LauraW ( 662560 ) on Saturday December 09, 2006 @08:52PM (#17179706)

      What I usually say when interview candidates ask about this is that back-end and data crunching code tends to be C++, web GUI front-end stuff tends to be Java and Javascript, and scripts tend to be Python. Whatever tool works best for the job. It's not much different from what I've seen at other jobs, except for using Python instead of something like Perl. But there are no hard and fast rules. For example, there was a slashdot article [] last week about an internal web app written in Python. Here's an older article [] that talks a bit about Google's philosophy for choosing tools. There are various articles [] on Google technologies floating around on the web site too. Before anyone asks, I have no idea what the relative size of the code base in each language is.

      Disclaimer: I work for Google.

    • Yes, I think so too. In addition, I don't think, the Mars rovers certainly aren't programmed in C++ either... Would be pretty lame for the author of the language to claim credit like this...

  • by Larry Lightbulb ( 781175 ) on Saturday December 09, 2006 @07:52PM (#17179236)
    Why try to imagine it, can't we just remember it?
  • by Anonymous Coward on Saturday December 09, 2006 @08:07PM (#17179348)
    WorldWideWeb, being on a NeXT box, was written in Objective-C, not C++.
  • by suv4x4 ( 956391 ) on Saturday December 09, 2006 @08:14PM (#17179414)
    FTFA: I hope you didn't put too much money on it! I don't see aspect-oriented programming escaping the "academic ghetto" any day soon, and if it does, it will be less pervasive than OO. When it works, aspect-oriented programming is elegant, but it's not clear how many applications significantly benefit from its use.

    Totally agreed. AOP is a strange form of "dynamic" insertion of code at special "cut points" of execution within the code and represent a very very lazy way to avoid good OOP structure of your applications.

    In a bigger framework AOP can be totally unpredictable and wreck otherwise locked and working code.

    When AOP started to pick some speed in the beginning I was naturally both interested and slightly annoyed that so short after OOP here's yet another concept for programming I have to learn and implement in my software.

    Not so fast though, since as much as OOP provides useful abstractions that makes your code more readable and predictable, AOP does exactly the opposite except in few very limited cases.

    The cons outweigh the pros.
    • Re: (Score:3, Insightful)

      by Elias Ross ( 1260 )

      AOP solves the N times problem nicely. For instance, if you wanted to take an object with N methods and add a call x() to each of them, if you used ordinary OOP, you'd have to override every method, then call x() from each method. What's the elegance of that? I don't see how "proper" OOP can solve this sort of problem better than AOP.

      AOP is largely mysterious and confusing because it's not something (yet) integrated with any standard languages. If it were integrated, then there would be proper tool support,
      • def wrapper(to_wrap):
        def blah():
        return foo()
        return blah

        for name, val in some_obj.__dict__.iteritems:
        if type(val) == instancemethod:
        some_obj.__dict__[name] = wrapper(val)

        You'd need some other stuff to handle arguments but it is definitely possible, I just didn't feel like remembering. (also I don't know where the instancemethod type is.. in its place yo
      • Re: (Score:3, Insightful)

        by bit01 ( 644603 )

        AOP is object oriented come from []. It can trash maintainability. In any program using AOP you can't look at any call in the entire program without assuming there's an arbitrarily large block of code somewhere else messing things up.

        While it's true that AOP can help the classes of problems it solves are fairly small compared to the cost it brings. Instead, adding calls to the first/last line of method implementations is no big deal. Less consistency checking but more debugability. If all you've got is binar

    • AOP is not a hack, is just one indirection level ahead of usual programming, I like to think about this kind of concepts as something that has full sense somewhere between the system and the programs.
      It's not about what a program must do, it's about what should be done when a program do something.

  • Google (Score:5, Interesting)

    by Anonymous Coward on Saturday December 09, 2006 @08:23PM (#17179504)
    Claiming Google as a cool C++ program is about 1/3 true. Most Google code is written in C++, Java, and Python: C++ for performance-critical stuff, Python for scripting, and Java for everything in between. The trend is definitely toward Java at the expense of the other two.

    Also, for what it's worth, Google's use of Aspect-oriented programming is ramping up pretty fast.
    • The trend is definitely toward Java at the expense of the other two.

      I prefer programming in Java, but have been doing a lot of programming in C++ recently. From my experience, while Java produce larger code and slightly less performant code than C/C++ there are many advantages: shorter development cycle (assisted by a large and complete API and you avoid many issue with pointers vs references), works without recompilation no matter the OS/architecture you are using.
  • by melted ( 227442 ) on Saturday December 09, 2006 @08:38PM (#17179618) Homepage
    "Severe resource constraints"? Since when a datacenter with half a million servers in it is called "resource constraints"?
  • by SEE ( 7681 ) on Saturday December 09, 2006 @09:25PM (#17179998) Homepage
  • .Net is a huge integrated system backed by Microsoft. That's its major advantage and disadvantage. Personally, I'm a great fan of portability. I want my software to run everywhere it makes sense to run it. I also want to be able to change suppliers of parts of my system if the suppliers are not the best. Obviously, suppliers of huge integrated systems, such as .Net and Java, see things differently. Their claim is that what they provide is worth more to users than independence. Sometimes they are right, and

    • Re: (Score:3, Interesting)

      by oldhack ( 1037484 )
      Large part of the many (most?) business applications is glue to the system ("integration"), especially nowadays where much of the basic algorithms (supplied lib), data access (SQL), and UI are handled by underlying systems.
    • by hey! ( 33014 )
      This is very true. My pet peeve is the way java frameworks other than Spring infect application code.
  • by Chacham ( 981 ) *
    Can you imagine the world without the Web? (It was only about 10 years ago.)

    The web was created by Al Gore in 1996?

    My word ignorance has passed on even to our elders. /me cries.

    Just a quick look at AltaVista []'s about [] pages shows they *indexed* the web in 95. Of course, the Internet wasn't there before Google, so it must be bogus.

    RFC 1580/FYI23 [] which was published in March 1994, contains a definition of the web.

    In actuality, the World Wide Web came about in 1992 about 15 years ago.

    Now, had Bjorn meant that sl
  • Long Memory... (Score:3, Insightful)

    by evilviper ( 135110 ) on Sunday December 10, 2006 @01:43AM (#17181798) Journal
    Can you even remember the world before Google? (It was only five years ago, after all.)

    Vividly... Searches for Hippopotamuses turned up porn. Searches for C++ turned up porn. Searches for Slashdot turned up porn...

    Other than the porn, there were dozens upon dozens of pointless hits for sites that only in-passing included the search term you wanted, and perhaps not even that, as search engine databases were often years old, and sites completely changed in that time. What's more, there was never any spell-checker, so with a trivial mistake, you could be wasting all that time with the wrong term, and never find what you want.

    Finding anything was laborious and extremely time consuming. Now with Google, almost ALL search engines have raised their standards near the Google level (alltheweb seems to be somewhat of an exception) and now only a tiny fraction of searches turn up page after page of pointless crap.

    However, Google doesn't seem to be improving much these days, while there are obviously other ideas to be explored. On vague or expansive subjects (or just if you aren't particularly good at searching) Clusty tends to be a better bet, as it automatically categorizes your results for you, allowing you to trivially easily narrow them down... much moreso than if you just included additional categorizing terms in the search.

    Can you imagine the world without the Web? (It was only about 10 years ago.)

    Yes... fondly. Links neatly grouped together in the same spot on every page, not in colors that blend in with the background, in tiny font sizes, or hidden in buggy, inconsistent javascript sub-sub-sub menus.

    No god awful color schemes, or Flash-only sites. No sites that have huge columns on the left and right sides (with almost nothing useful in them) that squish the center column (content) down to one-word-per-line (I'm looking at you, Slashdot).

    Never a single site that depended on your screen resolution (now all but 0.01% of websites are utterly unusable in 640x480 or below).

    No cookies, no javascript, no background images, no BLINK element, no pop-up windows, etc. To make a site, you actually needed CONTENT, not overindulgent designers.

    • Searches for Hippopotamuses turned up porn. Searches for C++ turned up porn. Searches for Slashdot turned up porn...

      As opposed to Google, where searching for almost anything turns up an ad for buying it on eBay, an ad for downloading ringtones for your phone, a dozen price comparison/review sites (with a dozen links each) none of which has any human-written reviews of the search item, a sponsored ad for someone selling a related item, and a reference to the Wikipedia article?

  • You might think twice about using C++ after reading this interview [] with Mr. Stroustrup.

All Finagle Laws may be bypassed by learning the simple art of doing without thinking.