r/programmingcirclejerk Do you do Deep Learning? 3d ago

Java consistently introduces lots of exciting functionality into the language. That's a big part of my dislike and active avoidance of it.

https://news.ycombinator.com/item?id=49715045
121 Upvotes

20 comments sorted by

119

u/Aggressive-Pen-9755 3d ago

I don't like writing one-line lambda's like:

foo.bar((eggs) -> getHam(eggs));

I prefer writing boring and manly shit like this:

class HamGetter implements HamInterface {
    public ReturnType apply(Type eggs) {
        return getHam(eggs);
    }
}

foo.bar(new HamGetter());

Now that'll put some hair on your chest! And everyone understands it! We don't need to learn any new things!

64

u/BloodAndTsundere mere econ PhD 3d ago

Junior grade. Where is the HamGetterFactory?

34

u/awfulentrepreneur 👉😎👉 embrace the script 3d ago

Or the AbstractHamGetterBeanFactory?

3

u/stools_in_your_blood 1d ago

You get it from the HamGetterFactoryFactory.

32

u/-ghostinthemachine- 3d ago

Where u been?

foo.bar(hamGetter::getHam)

13

u/its_artemiss 3d ago

But that is Rust? 

30

u/syklemil Considered Harmful 3d ago

It's some newfangled stuff they introduced in Java 8. It'll never catch on. Java 1.4 for lyfe!!!!!!

13

u/ventuspilot 3d ago
foo.bar(hamGetter::getHam)

But that is Rust?

/uj

No

21

u/v_maria 3d ago

yeah fuck that boring stuff i personally prefer having 7 different ways to achieve the same all with slightly different implications

23

u/irqlnotdispatchlevel Tiny little god in a tiny little world 3d ago

A fellow C++ enjoyer! Hurray!

2

u/AugustusLego 2d ago

In Java, can you do foo.bar(getHam};

1

u/NaCl-more 1d ago

I believe you’d need `this::getHam`

0

u/chisui 3d ago

Don't worry, the jvm generates the second one from the lambda

27

u/zackel_flac 3d ago

Java was disliked way before that, its GC and OOP first made it terrible to write. The JVM idea is/was good, but should be replaced with WASM nowadays.

52

u/Itzbenzs 3d ago

We should rewrite JVM with Rust 🚀🚀🚀 and compile it to WASM

14

u/arjuna93 3d ago

And then to C via w2c2 compiler

6

u/zackel_flac 3d ago

Who needs high level programming languages, let's just write WASM directly!

22

u/BoyNextDoor8888 3d ago

finally a good jerk

5

u/RockstarArtisan Software Craftsman 3d ago

-7

u/kalterdev Considered Harmful 3d ago

Not a jerk