Steven T. Hatton wrote:
....
[smip]
What you wrote pretty much describes Java as well. I believe this
discussion from the link above is misrepresenting the history of OOP:
"Look at how template was introduced into C++, one will naturally wonder
about C++?s object model. In my opinion, the lack of a unified, monolithic
object model, where everything else is derived from object, is perhaps one
of the biggest reasons why template was introduced to write container
classes. It?s worthy to notice that once the top level object was
envisioned, languages, including both Java and C#, no longer bother to deal
with templates."
Following your lead Steve ...
Actually, there are several reasons templates were introduced - but I
personally don't believe the monolithic object model is a very important
one.
One of the most important reasons templates came into being were to
enforce type safety. Folks were creating containers of void* and then
dangerously down-casting them as they used them. C++ is all about type
safety.
Alexandrescu does things with templates just short of teaching monkeys
to fly ... really unrelated to issues solved (or introduced) with a
monolithic object model like Java or C#.
And any developer is free to create and adhere to his own monolithic
object model in his own application. Standardizing such an ideology
would have weighted the language done with minimal advantages.
"But given the fact that object oriented software development as a paradigm
only became dominant with the introduction of JAVA, it?s understandable
that Stroutrup did not envision a unified object model when designing C++."
http://www.research.att.com/~bs/bs_faq.html#Java
<quote>
Is Java the language you would have designed if you didn't have to be
compatible with C?
No. Java isn't even close. If people insist on comparing C++ and Java -
as they seem to do - I suggest they read The Design and Evolution of C++
(D&E) to see why C++ is the way it is, and consider both languages in
the light of the design criteria I set for C++. Those criteria will
obviously differ from the criteria of Sun's Java team. Despite the
syntactic similarities, C++ and Java are very different languages. In
many ways, Java seems closer to Smalltalk than to C++.
</quote>
And keep this in mind. It is not an "object oriented paradigm" that begs
for a monolithic object model. Java in no way is more object oriented
then C++. C++ actually has much more modeling versatility in this
regard. Virtual inheritance, multiple inheritance, etc. Java OO
functionality is mostly a subset of C++ in this regard.
No, instead, Java uses a monolithic object model largely due to its
reflection api. Every Java object carries around meta information. Java
casts are always safe casts because an object knows what type it is. You
can't effectively do that unless you have a common base class.
C# has the same *feature*. Both languages compile programs that run in
virtual machines - a common base object helps ensure that information is
present.
Dynamically loading classes and instantiating methods at runtime
requires reflection which requires a common base class. Java and C# are
Virtual Machine languages and the monolithic object model provides a
larger features set for the virtual machines to depend on.
The relation of OO and monolithic object model is an afterthought at best.
It just so happens that as OO came into vogue, so also did Java and now
C# - but to imply that something that happened out of circumstance
(monolithic object model) is actually a core part of a movement (OO) is
a bit overzealous I think ... or just mistaken
Ah - back to templates ... now, templates are *hard* to implement in a
language - and not always necessary. That is probably "closer" to the
reason why Java and C# don't have templates _YET_.
-Luther