Slashdot Mirror


Bjarne Stroustrups and More Problems With Programming

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

17 of 313 comments (clear)

  1. Coolest and lamest! by Anonymous Coward · · Score: 4, Funny

    It is,

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

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

  2. Stroustrups by abshnasko · · Score: 5, Informative

    Please... he's one of the most influential people in the field of computer science today, at least spell his name right.

    1. Re:Stroustrups by EvanED · · Score: 4, Insightful

      Programming, yes, but computer science doesn't use C++.

      Bull. At least sort of.

      First, it depends in part on what your definition of computer science is. Most CS courses are taught in a C-like languages. At my undergrad institution, most of my programming assignments were done with C++. Sure, there was exposure to ML, but my impression is that most places that's mostly confined to the PL classes. (There are some notible exceptions that use ML or Scheme for intro courses.) Even at those institutions, I expect that later classes have assignments in a C-like language.

      Second, there's a lot of CS that relates to C++. Compiler theory of how you implement things about it, and language design. It's not about C++ specifically, but it certainly relates.

      Third, there is a fair bit of work in PL that directly relates. Not all PL is people in ivory towers coding in ML and Lisp. CCured is a very nice bit of work, though it's only C because it's built on top of the C Intermediate Language (CIL). There's early work now to create a CIL++, and I'm sure that it hasn't escaped anyone there about the potential to extend CCured to C++ once that's done. The parser for CIL++ will be something called Elsa, which was a major part of the research of one of the people there. My own research is indirectly related even. I'm looking at static analysis of binary code. Earlier work done in my group was explicitly directed to being able to find vtable pointers that C++ compilers produce.

      You're right to the extent that the core of CS is really in some sense applied math, and is entirely language-neutral. However, to say that C++ has no relation to CS because it's just programming (which CS isn't about) is just wrong.

    2. Re:Stroustrups by macshit · · Score: 4, Interesting

      Actually the vast majority of recently written (last 5 years) code I've seen from CS departments (at very good schools) has been in Java, with C++ a somewhat distant second. This seems to apply across the board, from hard-core long term research projects to undergrad frameworks to quick experimental coding.

      I don't particularly like java (and it's particularly painful watching the hoops people jump through to make it perform well), but while it doesn't seem to really be the best at anything, I guess on average it turns out pretty well -- it's pretty safe, pretty fast, pretty readable, pretty well supported, pretty widespread, ... One important point that many people seem to ignore is that java seems to have huge number of freely available libraries, often for somewhat specialized subjects.

      The languages you mention are all great languages, and have carved out productive niches, but they seem to remain niche languages, even in academia...

      [Disclaimer: I have never written a java program (!), though I have read many...]

      --
      We live, as we dream -- alone....
  3. Can you imagine the world without the Web? by Larry+Lightbulb · · Score: 4, Insightful

    Why try to imagine it, can't we just remember it?

    1. Re:Can you imagine the world without the Web? by Skim123 · · Score: 5, Funny

      I remember back when I was a young lad, and the only access to pornography we had was through a friend's dad's discovered "collection", or, in some less proud moments, the Victoria Secret's catalog. Kids today don't know how good they have it.

      --

      I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.

  4. Re:Google's in C++? by say · · Score: 4, Informative

    Googlebot is mainly written in Python. Google is mainly written in C/C++.

    --
    Roses are #FF0000, violets are #0000FF, all my base are belong to you
  5. First web browser not written in C++ by Anonymous Coward · · Score: 5, Informative

    WorldWideWeb, being on a NeXT box, was written in Objective-C, not C++.

  6. Aspect Oriented Programming is a Hack. by suv4x4 · · Score: 5, Interesting

    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.

  7. Java by goombah99 · · Score: 5, Funny

    Javac is the coolest program written in C++ :-)

    --
    Some drink at the fountain of knowledge. Others just gargle.
  8. Google by Anonymous Coward · · Score: 5, Interesting

    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.

  9. Re:This line explains a thing or two by MoralHazard · · Score: 5, Interesting

    Ooh, but your analogy can extend! Sure, I can go down to Home Depot and buy some interior paint to spruce up my living room, or some 2x4s to build a new deck, or something like that. But have you ever heard of building inspections? Anytime you do serious work, like an addition or a new building or even heavy electrical, you're probably going to have to get permits, submit plans, and then have a licensed building inspector come out and check your work. And it if ain't done to code, you're going to have to rip it all out and hire somebody who know what they're doing.

    The reason behind all this bureacratic, intrusive government oversight is that building codes are written in blood. Code specs have emerged over time because people died when buildings collapsed, or bad electrical wiring caused fires. The lesson is that if you're not doing something that could cause injury or death, go ahead and do it yourself. If not, you'd either better learn the right way to do it or hire somebody.

    Code divides into similar categories, although I the decision point is different: Is the failure of this application tolerable? It may be a question of lives at risk (avionics, air traffic control, miliary systems, automotives braking/control, medical) or it might just be economic (my business stops and I lose money when our servers bug out). It's only prudent to analyze your situation and come to a rational decision about whether you want to tolerate the risks of hiring professionals (or learning professional methods and implementing them yourself), versus playing pickup ball.

    Having lived through a couple of start-ups, both successful and unsuccessful, I can tell you that the different approaches do make a difference. I think that's what Bjarne is getting at: if the application matters, you'd better do it right.

  10. Re:Google's in C++? by LauraW · · Score: 5, Informative

    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.

  11. Re:"Severe resource constraints" by halftrack · · Score: 4, Insightful

    Since always ... Getting a 10% performance gain in a 500,000 servers data center could mean a cost saving of 50,000 servers. On 5 servers you wouldn't bother because you wouldn't save anything. The resources we are talking about here are in essence entirely economical and pragmatical. Adding 50,000 servers is not easily done nor particularly cheap.

    --
    Look a monkey!
  12. "Also, the first Web browsers." by SEE · · Score: 4, Informative
    1. Re:"Also, the first Web browsers." by iabervon · · Score: 4, Informative

      Even Mosaic wasn't written in C++. I'm looking at the 2.7b4 source now, and it's definitely C.

  13. Re:Google's in C++? by Anonymous Coward · · Score: 4, Informative

    No Google bot is written in C++
    http://www.robotstxt.org/wc/active/html/googlebot. 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.