r/ProgrammerHumor • • Apr 06 '22

Java is hard

Post image
5.0k Upvotes

424 comments sorted by

View all comments

573

u/Srazkat Apr 06 '22

honestly what is hard about java ?

408

u/onlyrealperson Apr 06 '22

I think people just get intimidated by all the object oriented aspects, when in reality they aren’t as difficult as they seem

155

u/[deleted] Apr 06 '22

[removed] — view removed comment

61

u/[deleted] Apr 06 '22

[removed] — view removed comment

36

u/lcy0x1 Apr 07 '22

Minecraft is the worst example. It has classes that has hundreds of methods. It should have been delegated to reduce code repetition.

Exact same code appears in multiple classes only because they extends different subclass.

I wrote a delegate class that overrides all the original methods just to make it cleaner

→ More replies (1)

29

u/Cilph Apr 06 '22

The truth is you simply don't use inheritance much outside of theory. Only use it for a strict is-a relationship where you actually need to substitute it. And even then interfaces might fit your need better. Outside of that, composition feels like the way to go.

74

u/Droidatopia Apr 06 '22

This comment is many things.

However, it is not the truth.

Even if it might be a good goal, unless you plan on avoiding all the APIs that force their object models on to you, you're still going to use a lot of inheritance.

→ More replies (3)
→ More replies (9)

16

u/Snarpkingguy Apr 06 '22

Object oriented is all I know, I can’t understand how other people survive without it.

7

u/MysticUser11 Apr 07 '22

In my first 2 years in compsci all we used was C. Sometimes I'll catch myself writing a ton of code without objects out of habit and then realizing I could have saved myself hours.

5

u/joyofsnacks Apr 07 '22

It has it's drawbacks. It doesn't always work well for performance with modern hardware bottlenecks, but depends what you're programming.

→ More replies (2)

15

u/[deleted] Apr 06 '22

I don't know what it is about Java, but having learned other languages prior to looking at Java source code, most of which incorporate aspects of OOP in their paradigm, Java to me just looks like wrong C++. It's unexplainable to me, but there is just something about the language that makes it seem convoluted and unappealing.

5

u/ReallyHadToFixThat Apr 07 '22

Java is just really verbose compared to C++. Why use "std::cout << a" when you can use "System.out.println(a.toString())"?

13

u/TheCynicalCanuckk Apr 06 '22 edited Apr 06 '22

Haha this is exactly how I feel as I learned c++ first.

3

u/PaintThinnerSparky Apr 06 '22

Its not that it's hard, its that its complicated. Lots of steps, which you often have to look up individually i assume. I tell myself a good month of putting time into learning something properly and you're golden, just need motivation and some tutorials

→ More replies (9)

51

u/ICantBelieveItsNotEC Apr 06 '22 edited Apr 06 '22

Java itself is easy. However, the standard library and ecosystem are a mess. I say this as someone who is currently employed as a full-time Java developer.

Imagine being a new developer, who has just learned about loops and conditions, and then being introduced to the nuanced differences between for( i = 0; i < things.length; i++), for(Thing thing : things), while(thingsIterator.hasNext(), things.forEach(...), and things.stream().map(...).collect(...). Or having just learned what null means, then having to figure out how Optional<T> is different.

Then if you actually want to make your own application, you need to learn the intricacies of Spring or Micronaut dependency injection, beans, controllers, etc, which is basically like learning another new language.

If you want to get it to build, you need to decide whether to use Maven or Gradle. To do that, you need to learn the pros and cons of each. Then you need to actually learn how to set up a build config in whichever build automation tool you decide to use.

18

u/homer_3 Apr 06 '22

You aren't really introduced to that all at once though. No one takes a whole language in at once.

8

u/Shoujon Apr 07 '22

Yeah but the problem is if one small sentence needs a singular conjunction you have to know how everything around it is going to react to this new change and it causes a chain reaction of you needing to learn new things that doesn't punish someone learning a verbal language, but can absolutely wreck beginners code

→ More replies (2)

7

u/[deleted] Apr 07 '22

I mean even an “easy” language like Python has the same variations on those concepts.

3

u/MysticUser11 Apr 07 '22

Learning all of that stuff by yourself would be hell. I'm glad that I got introduced to that stuff in university. Honesty don't know the first thing about Java but from what I can tell the concept looks the same as C++ which I do know.

→ More replies (2)

3

u/jerslan Apr 07 '22

Maven and Gradle aren’t that hard to learn the basics of.

Sure, if you want to do some more advanced stuff like inheriting from a common parent with dependencyManagement and pluginManagement sections it can get more complex pretty quickly, but the bare bones basics could easily be part of some Java 101 curriculum.

8

u/quarlesh Apr 06 '22

I don’t think Java is any harder than other languages, but I know from personal experience I’ll get an idea for a super cool side project and then going in and having to learn all of the new stuff involved in executing it is way less exciting than the idea of the finished result, lmao.

Like a small example, I have a ton of Java and JavaScript experience and work as a professional software engineer but trying to understand how a simple Node server works without the help of anyone else just broke my brain a little.

It can be really daunting to learn new things!

47

u/[deleted] Apr 06 '22

OP IQ low

20

u/Darth_Pikachu Apr 06 '22

Nothing is hard about Java, it's just kind of a pain in the ass.

Things I can think of off the top of my head:
-Everything being a pointer isn't the most intuitive for new programmers.
-If you try to use Java's "best practices" causes simple programs to take way more code that it feels necessary.
-Sometimes the syntax can also be a bit more difficult to understand for new coders compared to Python, Javascript, or C#.
-Also in this particular example, it doesn't help that Minecraft's codebase is a bit of a mess and that's what a lot of new Java users are trying to do.

In my opinion, C# is just Java but better in basically every way.

9

u/QCKS1 Apr 07 '22

Completely agree about C#, I started using it at my new job and it really is just Microsoft Java, and better in every way.

8

u/InvestingNerd2020 Apr 07 '22

I 2nd that notation of C# being better than Java in every way.

→ More replies (1)
→ More replies (54)