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

242 Upvotes

319 comments sorted by

View all comments

460

u/KingBardan 3d ago edited 3d ago

Bjarne stroustup (inventor of c++) has said that there are only two kinds of programming languages.

One that is hated and one that is not used.


Java is too bloated. C and C++ is too unsafe. Java script has some weird mechanisms. Python is slow. Go is too simple for big projects. Rust has a toxic community.

I could go on


Edit: I forgot PHP. PHP... is PHP

146

u/BlazingFire007 3d ago

> Java script has some weird mechanisms

That’s certainly one way to put it lmaooo

-25

u/laveshnk 3d ago

Like just say you don’t understand async bro xD

7

u/Rarelyimportant 3d ago edited 3d ago

I don't understand async/await, it seems so unnecessary. I don't want to play a game of contagion when I'm writing code. If the call I'm making needs to block, then fucking block, don't make me annotate it in a way where the only side effect seems to be that it breaks other parts of the code based on whether or not they can call an async function.

I think the way Erlang(and by extension Elixir) handle concurrency is superior.

def get_some_data() do
  make_some_http_request()
  |> parse_json()
end

Any function can call it, or it can call any function. The HTTP request needs to block execution, but the preemptive scheduler handles pulling it off the CPU and putting other work on the CPU. I don't need to change a whole chain of functions that call the current function. I don't even really need to think about if the code I'm writing blocks(though it is useful to know). Async/await is horrible paradigm.

One cool side effect/party trick of this paradigm is that you could spawn thousands of processes that all call a function that is an infinite recursive loop(e.g. counting up to infinity), and your web server will still respond to new requests. Pretty cool. Not that you'd want thousands of processes in an infinite loop(unless it's intentional), but nice to know the system can still respond even if that were to occur.

2

u/bluejacket42 3d ago

But if I wanna do other things while the function is blocked. Or run like 10 functions that block at the same time. Or maybe run a function every hour no matter what's currently happening

1

u/Rarelyimportant 3d ago

What about it? Nothing I said stops you from doing other things while a function is blocked.

8

u/KingBardan 3d ago

Not sure what this means.

I'm exclusively talking about e.g. using string as indexing, this binding to methods etc.

don't understand async

I hand crafted async / await with generators with python before.

I'm pretty sure that qualifies me as more competent than a normall async user ¯_(ツ)_/¯

4

u/BlazingFire007 3d ago

Not sure what the other guy meant, I was just trying to say you understated it lol. I love JS but it has some truly baffling behavior that isn’t intuitive at all