r/java • • Jun 10 '24

[deleted by user]

[removed]

616 Upvotes

594 comments sorted by

View all comments

1

u/RedPill115 Jun 10 '24

There were a few genuinely large advancements in productivity/security/maintenance.

1

u/RedPill115 Jun 10 '24 edited Jun 10 '24

Assembly to C

Assembly  

CMP Input, WaterLevel  
MOV word[MC], 1  
MOV word[MC], 2  

.

C  

if ( input < WaterLevel) {  
  MC = 1;  
} else if ( input == WaterLevel) {  
  MC = 0;  
}  

You can see how much dramatically more readable C is vs the assembly version.

1

u/RedPill115 Jun 10 '24

C to object oriented C++

In C you'd have a struct of data but then have to go searching for the methods that operate on that struct. Making it object oriented improved the ability to find those methods by putting them on the object.

There were debates that with discipline you could simply write C in an object oriented fashion, using a struct for the data and carefully putting all the methods in the same file so they were easy to find, and get the same result.

But either way, looking at things as objects dramatically improved programmers ability to write large programs.

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.

1

u/RedPill115 Jun 10 '24 edited Jun 13 '24

So let's say your language was genuinely 2x faster to write than Java.

The point where languages changed in the past, you got 100x faster out of the new language.

So next you have the issue of long term maintenance - the ability of your employees to work on existing programs. If everything is written in Java it's much easier to find a java developer to work on it vs when one is written in GoLang, another PHP, another C#, another Java, another C++...

I personally would love to have a language with cleaner syntax than Java, but everyone would have to agree on 1 new language, and gooooood luck with that.

The bottom line is this wailing about "java is dead!" has been going on for 20 years and it just the new guy claiming they're better than the old guy.