Linked by R_T_F_M on Thu 13th Sep 2012 21:19 UTC
FreeBSD "For the past several years we've been working towards migrating from GCC to Clang/LLVM as our default compiler. We intend to ship FreeBSD 10.0 with Clang as the default compiler on i386 and amd64 platforms. To this end, we will make WITH_CLANG_IS_CC the default on i386 and amd64 platforms on November 4th."
Thread beginning with comment 535115
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[12]: C++
by boldingd on Fri 14th Sep 2012 21:45 UTC in reply to "RE[11]: C++"
Member since:

As for inheritance abuse in Java, it is true that a lot of people do it, but you can also have quite nice arquitectures using interfaces instead.

Java was initially designed around inheritance abuse. Inheritance is all over Java's oldest APIs; note for example that Java's original Vector class holds Objects (and not a specific type), which means that you can shove any java Object into them, and that you can't shove a bare scalar type into them (yes, I know that Integer is an object that just thinly wraps around an int). This makes these things extremely type-unsafe; if you want to constrain the types you put in a Java vector, you have to enforce those constraints yourself explicitly, in your code, and you always have to explicitly type-cast the things you get out before you use them. Essentially, Sun was trying to use polymorphism to provide a flexible, generic container without actually including generics in the language, and the result was a mess.

And while Java has proper generics now, that heritage is definitely still in the language. Java by design puts a lot of weight classes, objects and polymorphism.

I might also point out that, at least at my school, we actually teach in some of our courses that "inheritance is a functionality extension and code-reuse mechanism, and you should use the hell out of it." And while I think that's insane, I think that view is one of the fundamental assumptions that went into Java.

Sadly, many developers don't know any better, and you tend to be forced to abuse inheritance as soon as you start incorporating a lot of 3rd party libraries.

In C++ you can find such examples in ATL, MFC, OWL and TurboVision and most game engines.

OOP and inheritance is sometimes the right metaphor, but not always. It's great in game engines, because you often find yourself building large trees of heterogenious but semantically-related types (i.e. large trees of objects that are renderable, but have different render methods). Ditto for UI frameworks, where you find yourself adding lots of different types that are all widgets. But, "look, this technique is used a lot in C++, too!" is not the same as "look, C++ over-uses this technique!" OOP is Java's central organizing metaphor, whereas C++ is a multi-paradigm language that also supports imperative-style code and template meta-programming where those make more sense.

Reply Parent Score: 3

RE[13]: C++
by moondevil on Sat 15th Sep 2012 07:10 in reply to "RE[12]: C++"
moondevil Member since:

Everything you said about Java I can say about C++.

I started using C++ in 1992, on those days C++ was still "C with classes", and everything you complain about Java is how C++ was used on those days.

Everyone was blindly trying to do Smalltalk in C++.

My first compiler with basic support for templates, which were still being standardized, was Turbo C++ 3.1 for Windows 3.x, bought in 1994.

Templates were only working properly across major C++ compilers around 2004. Still some edge cases of the C++98 were not fully implemented across all major compilers. And even afterwards there were many companies that disallowed the use of templates in their production code.

Which means in many enterprises out there, C++ developers have been writing C++ code the same way, you Java forces people to do so.

Actually, what happened is that many early adopters of Java, were C++ developers that were never able to use templates, and carried on coding in Java as they always did before in C++.

You say yourself that there are better ways to code in Java, but you teach your students otherwise. How can the tool be blamed?

Reply Parent Score: 3

RE[14]: C++
by boldingd on Sat 15th Sep 2012 08:51 in reply to "RE[13]: C++"
boldingd Member since:

Not exactly. Yes, C++ developed slowly. Yes, early compilers supported different sub-sets of it, so yes, different developers make wildly different uses of the language even today. And yes, C++ as a language has its own set of flaws, some of them quite severe. But the generic containers in the C++ standard library have been (comparatively-)type-safe templates for forever, and C++ has been multi-paradigm for most of its history. Java as a platform needed to suffer a dramatic loss of developer mind-share before its developers finally relented, compromised the language's elegant OO design and grudgingly started to add support for a lot of features that C++ (and Python and Ada and C#) have had forever. We had to wait way to long for generics, and absurdly long for RAII.

Reply Parent Score: 2