r/java • • Jun 10 '24

[deleted by user]

[removed]

615 Upvotes

594 comments sorted by

View all comments

Show parent comment

1

u/RedPill115 Jun 10 '24

C++ to Java

It was a HUGE increase in productivity and security in many different areas.

Memory Management - hard to describe the horrors that creating an object on the heap then not deleting it would create a memory leak that would eventually crash your entire program. Just a single place this happened. Java fixed this with garbage collection.

Memory Security - in C++ if you have array[3] and you access array[5] it returns data like it's genuine data. You can set array[5] to and override stuff you're not supposed to be overwriting. Java removed direct access to memory and the need to dereference pointers and got rid of this issue entirely.

Libraries - Again you really can't describe the horrors of development where there was never a library for almost anything without paying for it. JSON? Write code to manipulate strings and manually output it yourself. Tons of bugs, errors, inconsitencies.

Exceptions - when your C++ program ran into a problem is just crashed. No idea what line it was on. No ability to capture the exception and move on - functions would try to return error codes which people often forgot to check. It's hard to describe how much of an improvement just knowing the line # it crashed on is.

There's probably more I'm forgetting, but the point is java was a HUGE improvement across many areas.