Java was just enough like the C++ of 1990 to compete, but with garbage collection and a big library, and without confusing pointers, so lower-skilled programmers could use it. That is all. Computers were literally thousands of times slower than today. Java was considered just barely fast enough.
But without freeing programmers from the Microsoft frameworks treadmill, it would have sunk without a trace.
No, that was much of the point. Memory leaks, pointer overruns, use after free bugs were a huge time sink. In addition to portability, industry wanted a language without these problems.
Enterprise development is always about delivering features first. Performance, security, reliability, etc. come after that.
I was tasked with porting to SunOS 4, where if you deref NULL you crash with SEGV. Therefore I had to get real good at GDB real fast and chase every instance of NULL usage, where I'd put in an initial check first. I did my job alright and before long, our server code was running smoothly cross-platform, and I'm fairly sure that my patches had far-reaching effects beyond the SunOS platform I'd developed on.
My colleagues and I were at the forefront of a wave of new Internet users in the early-to-mid 90s, and the embedded programming language environment of a simple text "adventure game" was conducive to many people learning how to program in a simple and forgiving environment. Those of us who hacked clients and servers were a somewhat elite vanguard; I decided to specialize in systems administration and had an interesting career soon afterwards.
And it all started because some VAX programmer had thought it was no big deal to dereference NULL pointers in a pervasive way throughout the ANSI C codebase of a game server.
Huge time sink.
Maybe he is saying bull now to look more cool, but he sounded rather convincing in the interview. I'd recommend to listen to it
Can you send some examples? Curios to read those.
No memory leaks and portability were the main benefits we were sold on at the time
At least you get an error message. Silently continuing when things go wrong is worse.
Right. We had Purify for that.
> ... but with no unsafe memory accesses.
Mostly true. But you could still get a null pointer exception in Java - which is especially weird because Java doesn't have pointers.
For the primitive types, like long, you can't get a null pointer exception, because there really is no pointer, but for any object type it's actually a pointer, the object itself lives on the heap and you're given a pointer to it, if the object is null, that's a null pointer. They don't feel much like pointers from a language like C because you're not provided with pointer arithmetic - you can't try to add my_object + 16 as you could in C - and because Java was a modern language which knows what you mean when you write foo.bar, unlike C and C++ which expect you to remember whether foo is a pointer and write foo->bar so that the poor compiler needn't figure it out.
For modern Java the compiler does escape analysis and may conclude an object cannot "escape" in which case it may be created as part of the stack frame of the code which uses it instead of on the heap, but it's still basically a pointer.
This is all rather awkward, for example Java's 64-bit double precision floating point number is a primitive, always 8 bytes on your stack no need for a pointer to anything - but if you want your custom four 16-bit integers type (maybe representing RGBA) that's an Object so it is treated differently even though it's also just 8 bytes. C gets this part right, your custom types (struct, and to a lesser extent enum and union) aren't treated so much worse than the language built-in types.
Anyway, it's Memory Safe because the null pointer exception is essentially the same behaviour as if you try to unwrap() a None in Rust, the JVM isn't going to let you just "press on" as you might in C, you've got a programming error and must either recover from that or your program aborts.
the most time I've ever spent dealing with invalid addresses and memory leaks, in production /enterprise code, has been in Java, not C or C++
my personal theory is because despite how much safer Java was by design, culturally, beginning in the early 2000s, it also opened the floodgates to a big wave of lower caliber programmers "just doing it for steady jobs" and so a "99% right? ship it! someone will file a ticket next week if needed" mentality was more common
not the fault or credit of the langs, just the type of people they attracted, at large scale
Java: "I'm super friendly! Just click here!"
C: "Here's a razor blade. Here's a razor blade. Another. Another. Now assemble to build a maze. Also the maze is invisible. Oh and our manual is 50 pages."
(I appreciate both in diff ways.)
But seriously, is there any modern language other than Perl where regular expressions feel so… natural? I reach out for Perl less and less, but always sigh when I need to handle any regex in Python.
Example: /.*a.*/.test("this is a string") // returns true
The contempt Java's designers held for its users fairly drips, in what they write about it.