Live data from Hacker News

Java 21 makes me like Java again

wscp.dev

701–710 of 777 posts

Re: Java 21 makes me like Java again

#701
post #148
post #121

Earlier quoted context omitted.

I have not used Go generics, but it's viability as a business logic language would depend on that.

Wait, what? Generic programming is a perfectly valid style, but are you saying it's essential to implement business logic? Because, like, the last 3 languages that got adopted as the default business logic language didn't have them (Java pre 1.5, C, and Cobol).

It is absolutely necessary nowadays, yes. Our applications are often more complex than what people did in Java 1.5, Cobol, or C, and definitely need to be developed at a faster pace.

Re: Java 21 makes me like Java again

#702

Earlier quoted context omitted.

It would be good for my job if learned go, but I've been having a hard time because it's just so boring.

You're doing it wrong if you think programming for work is about the code being a means of expressing your inner soul. The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world. If you want to express your soul in your code, do that on the weekend using whatever language you want. Trying to mix these motivations i…

[deleted]

Re: Java 21 makes me like Java again

#703

Earlier quoted context omitted.

It would be good for my job if learned go, but I've been having a hard time because it's just so boring.

You're doing it wrong if you think programming for work is about the code being a means of expressing your inner soul. The most successful professional programmers derive their enjoyment from achieving business objectives, like making products that users love and improve the world. If you want to express your soul in your code, do that on the weekend using whatever language you want. Trying to mix these motivations i…

I have too much skepticism of "businesses objectives" to be especially interested in success. I want something that'll bend my mind.

Re: Java 21 makes me like Java again

#704
post #690

Earlier quoted context omitted.

> I've worked with the kind of engineers who are still doing Java + Spring like it's still the 90s, and they're not the ones you want on your projects And I've worked with programmers who use the latest fad of the day (golang, etc) and they're not the ones you want to have on your projects. > The best talent don't even want to consider working with Java if they can help it. Not in my experience.

Every single person who's arguing against Kotlin in this thread is resorting to the argument that it's the latest fad of the day. It's not.

I was mainly arguing against golang. As for Kotlin, given the incredible work that has been done in Java recently, the argument is that there isn't much reason to switch over anymore, due the introduction of more moving parts into the project (another dependency, compiler, room for issues, etc.) and the fact that Java ended up with the superior approach (better/fully fledged pattern matching, virtual threads, programmable string templates, etc.).

Re: Java 21 makes me like Java again

#705
post #693

Earlier quoted context omitted.

Nothing to do with the nature of the language, but with the nature of the program. If you're writing a few line script, you don't need a DI container. Once your program gets large, it becomes extremely messy without one. It's no surprise projects like [1] exist. [1] https://github.com/ets-labs/python-dependency-injector

That DI library is not pythonic at all. There's nothing wrong with this at all, say: class MyClass: def __init__(self, my_dep1=None): if my_dep1 is None: self.my_dep1 = get_my_dep1() # Or potentially raise else: self.my_dep1 = my_dep1 [...] Then to test: def test_my_class(): mocked_dep1 = MagicMock() my_class = MyClass(my_dep1=mocked_dep1) [...]

And if you want to configure the scope of `my_dep1` (singleton, transient, etc.)? What about nested dependencies? etc.

Re: Java 21 makes me like Java again

#706

The biggest problem with Java is... the walled garden, the snob society, the elitist, exclusive culture. Go isn't like that, or at least wasn't when G+ was still around. Nowadays I don't get in touch much with people, but when I create issues Go people are usually not as unfriendly as Java/JVM people.

Imo problem with Java is... JVM because it's quite a resource intensive application itself, memory usage is orders of time magnitude worse than most of the language I've used.

That's almost always a consequence of poor engineering. You need to consider the runtime when developing any program. With Java, that runtime is more than just your CPU and OS, it's the JVM too.

Re: Java 21 makes me like Java again

#707

Earlier quoted context omitted.

as soon as you copy your struct by value around, it is easy task for escape analysis to decide to put struct on stack. also, golang has arena API now, and it also makes heap allocations super cheap if you manage to integrate it into app life cycle.

Golang doesn't have copy elison unlike C++ so in principle you need to leverage the heap escape anyways. Golang's arenas were an experiment that has already been ditched by the maintainer as un-feasible.

> Golang doesn't have copy elison unlike C++ so in principle you need to leverage the heap escape anyways.

I mean you can pass structs by ref or value around, which makes direct impact will they be on stack or heap.

> Golang's arenas were an experiment that has already been ditched by the maintainer as un-feasible.

Thank you, good to know, looks like big pros in favor of rust as lang for my next project.

Re: Java 21 makes me like Java again

#708
post #693

Earlier quoted context omitted.

That DI library is not pythonic at all. There's nothing wrong with this at all, say: class MyClass: def __init__(self, my_dep1=None): if my_dep1 is None: self.my_dep1 = get_my_dep1() # Or potentially raise else: self.my_dep1 = my_dep1 [...] Then to test: def test_my_class(): mocked_dep1 = MagicMock() my_class = MyClass(my_dep1=mocked_dep1) [...]

And if you want to configure the scope of `my_dep1` (singleton, transient, etc.)? What about nested dependencies? etc.

Why do I care about any of that while writing python? Those seem like artifacts of a Java based DI system.

Re: Java 21 makes me like Java again

#709
post #195

Earlier quoted context omitted.

I don't think any existing Go developer is going back to Java. I worked with Java for 10 years and switched to Go and I will never go back. This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. Go is simple. It's easy to understand, read, and maintain. The packaging is like how you would package files on your co…

> This is mostly because applications and libraries are so hard to reason about and understand due to inheritance, packaging, OOP, build tools ect compared to Go. You are just at the early phase of the project. > Go is simple. It's easy to understand, read, and maintain My opinion is that Go is too simple, to the point that it hinders understanding and readability. 4 nested loops with random mutability is much worse…

>>You are just at the early phase of the project.

Nah.

99% of the code written out there doesn't need layers of indirection, responsibility tossing around, Code splitting across classes, design patterns, inheritance and the class jungle that is common in Java.

Rise of languages like Go is simply majority of the people realising when they want X, they are better of writing just X. You don't have to write a generic version of X that needs to work in a dozen situations. This is for a simple reason. Most of the times, there are no dozen situations. Most, not all the times.

Most of the code I write, doesn't change all that much. If you are writing code that needs to run for decades in an industry where grifting and job hunting is a daily affair you are doing it wrong.

Re: Java 21 makes me like Java again

#710
post #132

Earlier quoted context omitted.

> This is not a fun situation to deal with and inheritance makes it a lot harder because the "is a" relationship is driving a ton of your logic. Judicious OOP design allows others to change behavior based upon needs that perhaps the original coder never thought of. I would not call most Java OOP design judicious. The control in Java is owned by the library writers and the language devs -- not the people using it.

What is a language with judicious oop design? Asking to know

I tend to be fond of Python OOP styles.
Post reply on HN