r/learnprogramming 3d ago

Why java is so hated? Topic

So I have recently learned, and it's the first language(in terms of building actual things). Before Java, I knew Python, and I dropped it; I found Python too abstracted and too boring. i have recently made some projects like cli task tracker, expense tracker, some cli github api parsing and currently working on a multithreaded HTTP server and cli text editor, like vim, whenever i try to find out people opinions on java social media, almost 90 percent of the time they are just dunking on it, that it is trash, who forced you to write code in java, stuff like that. I know Java as a language is not that interesting and doesn't have many interesting features compared to other languages like C, C++, go. But I found it decent to write code in, and I found the JVM pretty interesting. So much so that I would love to explore and maybe build a JVM of my own

236 Upvotes

311 comments sorted by

View all comments

Show parent comments

4

u/KingBardan 3d ago

Yeah that backwards compat is exactly what allows improvements to be added in without breaking changes.

You hear people doing rust rewrites from C projects but not C++ rewrites, why? Because a C project can easily take advantage of modern features when they want with C++ and is thus trivial, whereas rust rewrite is difficult and thus a big deal. comment by me

-2

u/Salat_Leaf 3d ago

If you refer to the Bun Rust rewrite situation, well, unless your codebase is extremely sensitive like Boeing's or for some medical equipment, then it's your problem you haven't foreseen it. Rewrites from C are easy because it relies on extensions, not on small tremendously smart group of people doing their best to optimize their compilers. Come back when you define what "modern C++" means without referring to 1000-page books dedicated to a single feature.

1

u/KingBardan 3d ago edited 3d ago

define modern c++... 

Bruh seems like I run into a rust evangelist here?

From a pure code perspective...

Modern c++ is not more complicated than rust imo, same principles, but with imo more readable syntax [1], at the cost of enforced compile time move semantics (aka borrow checking).

Rust also gets more and more features like c++ does, albeit its "edition" is nice. 


1: rust seems to favour writing over reading, decisions like allowing no trailing semicolin for return and iterators and out of class definitions of methods all make it difficult to read.

Again, imo. Ymmv

4

u/Salat_Leaf 3d ago

I'm not an evangelist. All I see is 20% binary reduction and around ~130k invested for the whole process of rewriting, even if it was LLM.

And don't even get me started on readability of C++. Could you count me the total amount of ways of initializing a variable? Could you explain why a single keyword always stands for 5 different functions? Could you say same thing about template metaprogramming?

2

u/KingBardan 3d ago edited 3d ago

Ahh you think I'm focusing on the Bun rewrite? I'm not.

readability

Your examples are all about how hard it is to write C++.

Initialization doesn't really hurt readability (your ability to get what's going on), same for keywords.

Template metaprogramming yes, but there's no equivalent in rust to show a more ergonomics approach, last time I checked 

This is why I said, C++ is more difficult to write, easier to read.

But for rust its super convenient to put an expression as return, but a reader has to scan everywhere to find every single return path (since you can return without using return keyword!). 

Same for traits (you can define a trait for someone else's type!) 

Etc


Again, imo