by sagartewari01 · 7y ago · 0 comments
Are you sure about that? Was java really like C++ during it's earlier years?
What about the language design makes you think it _is not_ influenced heavily by C++?
The class reflection, dynamic loading, JIT come from Smalltalk.
Checked exceptions from CLU, Modula-3.
Packages from Modula-2, Mesa, Ada,...
GC from Lisp, Mesa/Cedar, Similar, Smalltalk,...
However the similarities are only superficial, given the semantic differences.
Here are some nice links regarding it.
Java was (and still is) a C-like language with objects and fully automatic memory management. Its standard library was a lot less efficient than that of C++ but generally more pleasant to use. Another plus was the inclusion of a (bizarrely stunted pre-Swing, but still) GUI API in the standard library. The price to be paid was program startup time rivalling C++ compile times.
In the early days, Java didn't have generics or containers comparable to what you see in Boost or the STL. Hash maps were there, though, and very versatile if a bit slow.
* Syntax is fine, keep it
* Mixed C heritage creates confusion, lets double down on OO and make everything an object
* Mistakes in managing heap memory (allocating, freeing, ownership changes) are the cause of lots of bugs, so we'll do that automatically (GC)
* Overrunning arrays is bad so we'll prevent that
* Exceptions are great, but sometimes it's unexpected that a function is going to throw one - put it in the type signature
* Having to compile for lots of different targets is a pain, so lets provide one common abstraction layer so that our code will run anywhere (multiple desktop OS's, Web, embedded)