November 10th, 2011, 7:38 pm
Linus is a kernel guru. Maybe he doesn't need C++ to get things done, but most people can't write kernels. It makes no sense to ask them to code everything in C.Now, since somebody already mentioned Java...I think Java is less OO than C++ by any measurable standard. And here is why.1) C++ supports all OO abstraction available in Java and much more.2) In Java object lifetime isn't well defined. RAII isn't possible. This requires lot's try-catches in anything but toy projects. On the contrary, very often you can write exception safe code in C++ without a single try-catch statement, because cleanup routines can be encapsulated into destructors. C++ objects know how to die gracefully. Java objects don't. 3) Java objects are handled by reference. This messes up copy constructor and assignment - arguably the most important concepts in OOP. C++ compiler will generate suitable copy constructor and assignment for you under most of the circumstances. In Java it the opposite - you need to implement copy control most of the time, because anything but primitive types don't know how clone themselves.4) Objects should own their internal variables. Internal variables should be destroyed before their owner is destroyed. In Java everything is owned by garbage collector. You never know who else owns your object, because everything is accessed by reference.