Hacker News new | ask | show | jobs
by jcelerier 2740 days ago
they focused on C++ as an object-oriented programming language (as did, to be fair, mostly everyone in the 1990s since it was The Big Thing then) without seeing where C++'s real value is, which is :

- value types

- RAII idiom with exceptions

it's a big, coherent package, which means that you can write code so that e.g.

    my_type foo{whatever};

    file f{"/foo/bar", "w"};

    foo.do_stuff();
    f.write(foo);
and you can be assured that you won't have null pointers croppying left and right, much less "new" to write, your objects are always in a valid state, etc etc.

Java is the opposite: the whole object model revolves around the identity of objects, and thus any function that looks like `public string whatever()` can return null, you have to do manual cleanup of your resources most of the time everytime you use a type (closing files, streams, soundcards, etc etc), versus every time you define a type in C++.