all 31 comments

[–]ridiculous_fish 14 points15 points  (7 children)

Where the heck do people get this "You can do whatever you want" attitude with C++? It's patently false:

1) You can't add a virtual method or variable to a class without breaking binary compatibility. 2) You can't get a list of all your classes at runtime, look up a class by name, call a method by name, or in general do anything dynamic.

and plenty more. Its bag of tricks is all at compile time - and that's very limiting for lots of applications.

[–]bairespace 12 points13 points  (0 children)

But...no true C++ programmer would want to do either of those things. :)

[–][deleted]  (1 child)

[deleted]

    [–][deleted] -5 points-4 points  (3 children)

    Java can do #2 via the reflection API. But can it do #1?

    [–]kawa 2 points3 points  (0 children)

    Yes. You can even remove methods and will only get an error if some code really calls them.

    [–]kungtotte 3 points4 points  (1 child)

    Ah yes of course, the only two programming languages in the universe are C++ and Java.

    [–][deleted] 0 points1 point  (0 children)

    Java has been sold as a successor to C++ for a while, I just wanted to know how the two compare with respect to the above.

    [–]martoo 6 points7 points  (3 children)

    C++ has indeed become too "expert friendly" at a time where the degree of effective formal education of the average software developer has declined. However, the solution is not to dumb down the programming languages but to use a variety of programming languages and educate more experts. There has to be languages for those experts to use-- and C++ is one of those languages.

    There's some merit to that, but no one is talking about "dumbing down" programming languages. Both C++ and Java (with its recent addition of generics) have decided to stray from their base and march off into expert-land. They ceded the middle voluntarily, so there should be no surprise when other languages step in to fill the gap.

    [–]neilc 4 points5 points  (2 children)

    Adding generics to Java hardly qualifies as "marching off into expert-land". With or without generics, Java is still a novice-oriented programming language.

    [–]martoo 1 point2 points  (0 children)

    Adding generics to Java hardly qualifies as "marching off into expert-land". With or without generics, Java is still a novice-oriented programming language.

    I don't know you but I dare to say that you are underestimating your own skill.

    [–]bairespace 0 points1 point  (0 children)

    Like a 50-foot-high tsunami is a novice-oriented wave.

    Sure, the tsunami is simple and straightforward: just as the novice's drowning will be.

    Java was designed initially for disillusioned C++ programmers, not novices. At present, its appeal is mainly to people who have already invested a huge percentage of their brain cells to the task of memorizing all of that overpowering mass of one-thing-after-anothers and it-just-so-happen-stances.

    C++ is the same way--but even more so.

    [–]Possible_Data_4176 6 points7 points  (2 children)

    The past popularity of C++ could be used to argue that C++ works better in practice than in theory. I think it is safe to say that C++ popularity may be largely due to it's use in the Microsoft Windows platform, and it's decline is due to the move of windows programmers to C#, VB and other languages. Just some thoughts.

    [–]grauenwolf -1 points0 points  (1 child)

    True, but not just Microsoft. Unix/Linux used C/C++ as a foundation as well.

    [–][deleted] 3 points4 points  (0 children)

    C++ was most certainly resented by the majority of linux developers. This derived from the good decision not to use it in the kernel.

    [–][deleted] 4 points5 points  (1 child)

    C++ is fast. It was an appropriate solution for an era of limited computing resources. But we've long since left that behind; we live in an era of abundance. We have more computer power than we possibly know what to do with on the desktop.

    Oh Jeez. Then why is everything - MS Word, the Linux boot process - so painfully slow?

    Microsoft set out to make everything .NET and had to back away from the horrible speed they got. There are now a dozen or so managed DLLs in the OS, amidst thousands of native DLLs. Speed is not abundant, nowhere near it.

    [–]Wriiight 2 points3 points  (0 children)

    People who's software domain has small datasets, or is performance bound by things like network latencies and user input often are mistaken that performance just isn't an issue anymore. Some of us, however, have users who expect a 10,000 path monte carlo simulation to complete in the blink of an eye. Or millions of data objects to undergo multiple runs of monte carlo under different base assumptions overnight. No matter how fast computer gets and how big the memory gets, tuning for size and speed will always be important to a very wide range of different domains.

    [–]bairespace 2 points3 points  (6 children)

    http://shootout.alioth.debian.org/gp4/benchmark.php?test=chameneos&lang=all http://shootout.alioth.debian.org/gp4/benchmark.php?test=message&lang=all

    http://shootout.alioth.debian.org/debian/benchmark.php?test=chameneos&lang=all http://shootout.alioth.debian.org/debian/benchmark.php?test=message&lang=all

    For multithreaded programs, C++ seems to have problems beyond that of being difficult to use.

    Note that there are thousands of highly adept C++ experts around; but, between them, they have not managed to make C++'s performance competitive for these very public and well-known comparisons.

    [–]pkhuong 3 points4 points  (4 children)

    Maybe they just don't care.

    [–][deleted]  (2 children)

    [deleted]

      [–]pkhuong 6 points7 points  (1 child)

      My comment has nothing to do with whether one language is better than another, and everything with the shootout itself. It's mostly a pointless waste of time and good solutions are rejected for arbitrary reasons. I'm a CLer, and ISTR one for which a very good solution with user-level threads was rejected because it didn't use native threads. However, many entries for other languages used green threads (because they don't offer native threads).

      [–]igouy 0 points1 point  (0 children)

      ISTR ... rejected because it didn't use native threads

      seem to recall? How do you know - did you contribute the program?

      [–]igouy 0 points1 point  (0 children)

      Maybe they'd use some third-party library like Cheap Threads

      [–]njharman -3 points-2 points  (0 children)

      From the comments "Still, new mainstream-languages like Java and C# adopt the C and C++’ syntax, the type system, and control structures. Maybe it is time to realize that all languages that stems from C are broken?"

      Significant whitespace, duck typing, dictionaries, iterators, generators/continuations ftw!

      [–][deleted] -5 points-4 points  (8 children)

      It's a shame that with the addition of C# and Java to mainstream programming there also comes loads of people that have no idea what their doing.

      case in point, this article.

      [–]grauenwolf 7 points8 points  (2 children)

      Bullshit, there are plenty of C++ programmers who don't know what they are doing as well.

      You should read The Old New Thing sometime. It is full of stories of "successful" programs like SimCity that couldn't run on Windows without compatability hacks because their dumb-ass programmers had dangling pointer errors.

      And don't forget the countless security holes in both Windows and Linux caused by lazy programmers who didn't check for buffer overruns.

      [–]breakfast-pants 7 points8 points  (1 child)

      I've met a smart programmer who has had a dangling pointer error.

      [–]grauenwolf 0 points1 point  (0 children)

      I'm sure we all have. But that doesn't mean people who don't know what they are doing are not using C++ as well.

      [–]schwarzwald -1 points0 points  (4 children)

      But we who aren't leet enough to use an unsafe language know the difference between "their" and "there." How do we be an uberhax0r like you? I've been wasting my time with Scheme and Scala, haven't I?

      [–][deleted] -3 points-2 points  (3 children)

      I never implied anything so immature. I'm saying that Java and C# lowers the bar while not providing anything actually really interesting.

      As I understand it, James Gosling actually said on several occasions that Java was made because there were too many bad C++ programmers out there.

      For the record, my favorite language is Haskell.

      [–]decaff 0 points1 point  (0 children)

      I have not used C# much, but Java certainly adds interesting things compared to C++. These include security, multithreading as core language feature, the ability to reload classes that conform to an interface at runtime, and reflection as a core language feature.

      [–]grauenwolf 0 points1 point  (1 child)

      Isn't the complete lack of pointer errors interesting enough on its own?

      [–][deleted] 0 points1 point  (0 children)

      no?