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

11 of 313 comments (clear)

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

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

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

  5. Re:Bug in C++ by EvanED · · Score: 3, Informative

    The problem is that two different translation units define two different versions of struct A.

    Relevant parts from Section 3.2 of the cpp standard:
    "There can be more than one definition of a class type ... in a program provided that each definition appears in a different translation unit, and ... each definition of [the name defined more than once] shall consist of the same sequence of tokens ..."

    In the example provided, two translation units have definitions for struct A. However, they are not identical; in particular, one has members that are ints, the other, shorts.

    However:
    "If the definitions of the [name defined more than once] do not satisfy these requirements, then the behavior is undefined."

    In other words, the compiler is not required to diagnose violations of the ODR (One Definition Rule).

    In this particular example, the compiler compiled bar as if doprint had a four-byte argument* (two shorts) but then threw out one of the definitions of doprint, leaving the other to treat shorts as if they were ints.

    *or maybe an eight-byte argument with misc padding that wasn't cleared

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

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

  8. Re:CFG by BitchKapoor · · Score: 3, Informative
    What is a language anyways but a context free grammar?

    Semantics.

  9. Re:Coolest and lamest! by Z34107 · · Score: 3, Informative

    Actually, the "hello world" program using the native Win32 API is:

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) {
    MessageBox(NULL, "Hello, World!", "HelloWorldApp", MB_OK);
    return 0;
    }

    You don't need 100 lines of code, obviously. The WinMain function can be a little intimidating, unless you consider that the parameters actually make ince. hInstance is a handle to your program in memory - you only need this if you want to dig icons or other resources out of your EXE while it's running. hPrevInstance is no longer used. szCmdLine is - you guessed it - the command line (rarely used) and iCmdShow is whether your program should be starting maximized, minimized, etc (but can be ignored.)

    Granted, the 100 lines of code comes in when you want to make a "real" Windows app - have a real window that responds to events. But, all this entails is filling out a struct that describes your window, creating the window from that struct, and setting up your message queue. About 1 page of code, but it's the same for every program and you can copy/paste.

    MFC makes this easier, of course, but that's C++.

    --
    DATABASE WOW WOW
  10. Re:Java by vocaro · · Score: 3, Informative

    Uh, Javac is not written in C++. It's written in Java. Download the source code and see for yourself. It's in the com.sun.tools.javac package.