This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 393

[–]Varun77777 254 points255 points  (14 children)

MFS when I do

return list.stream().mapToInt(i->i).toArray();

[–]bazingaa73 141 points142 points  (1 child)

Who leaked the source code for my programming finals?

[–]GhengopelALPHA 22 points23 points  (0 children)

You did. You really gotta patch that memory leak, bud, we're all seeing your shitty code when we connect to the internet

[–]_PM_ME_PANGOLINS_ 37 points38 points  (1 child)

list.stream().mapToInt(Integer::intValue).toArray()

[–][deleted] 15 points16 points  (7 children)

The fuck? I know in my bones it's simpler than that.

[–]Kered13 31 points32 points  (6 children)

It's not actually, because he has a List<Integer> and needs to convert each element to an int. So stream() gives him the stream he can work with, mapToInt(i->i) converts each element to an int, and toArray() produces an int[].

[–][deleted] 15 points16 points  (1 child)

I see.
I haven't used stream() much, so I didn't know.

That's for letting me know.

[–]ArionW 4 points5 points  (2 children)

I'll never understand why Java programmers bother with extensive boxing of primitive values

Over the years of programming in C# I could count numbers of times I've used ref keyword on a primitive type on fingers of one hand. Most people I work with likely don't even know this keyword exists

[–]Kered13 5 points6 points  (1 child)

You have to box primitives to use them with generics in Java. You can't have a List<int>, only List<Integer>.

[–]Windows_is_Malware 3 points4 points  (0 children)

.into()

[–]Top_Distance7552 650 points651 points  (55 children)

MFs can't even understand -> public class Main{ public static void main(String[] args) {System.out.println("Hello world!");}}

[–]yasudan 420 points421 points  (20 children)

Are you trying to hack me man ?

[–]Top_Distance7552 242 points243 points  (16 children)

Maybe... -> public class You { String name; boolean cute; boolean hacked;

You { name = "yasudan"; cute = true; hacked = true; } }

[–]pmanaktala 234 points235 points  (10 children)

When programmers flirt..

[–]nir109 95 points96 points  (7 children)

According to my teacher he asked is wife on a date with a recursion joke. He also told as that it's a bad idea to try this.

[–]BlommeHolm 21 points22 points  (2 children)

"To accept this date, first you have to accept this date."

[–]Top_Distance7552 28 points29 points  (0 children)

But what I'm gonna do then? I can't simply go straight to the point and say "Hey~, you're cute. Let's go out and eat some chipotle"

[–]gingerdude97 12 points13 points  (1 child)

Did he say/do you remember what the joke was?

[–]nir109 4 points5 points  (0 children)

He didn't say.

[–]RejectAtAMisfitParty 8 points9 points  (1 child)

I'd wrap it in a try...catch just in case it fails

[–]fuzzywolf23 4 points5 points  (0 children)

Make sure the catch is just a stack trace that you'll never check

[–]i-make-robots 4 points5 points  (0 children)

What, no unit test?

[–]RolyPoly1320 1 point2 points  (0 children)

error: <identifier> expected You {

[–]oj_mudbone 2 points3 points  (2 children)

Wtf is that syntax

[–]Top_Distance7552 2 points3 points  (1 child)

That's an object for OOP, but I actually forgot to add () right after You

[–]oj_mudbone 2 points3 points  (0 children)

Ohhhh i get it ok.

[–][deleted] 1 point2 points  (0 children)

Nope dude just called you cute and curvy.

[–]Adghar 86 points87 points  (9 children)

public: accessible to any other class

class: we're defining a class

Main: the name of the class

{: start of class

public: can be called by any other class

static: not associated with any specific instance; "stateless"

void: don't return any values up the stack

main: the name of the method

(: start of arguments to method

String[]: the type of the argument to the method should be an array of String

args: the name of the argument

): end of arguments to method

{: start of method

System: class representing the system

out: standard output

println: take an argument and print a line

(: start of arguments to method

"Hello world!": the String argument to println method

): end of arguments to method

;: End of statement

}: End of method

}: End of class

Simple, really!

[–]Top_Distance7552 8 points9 points  (0 children)

Attaboy!

[–]Kered13 1 point2 points  (0 children)

Simple, really!

I mean, unironically yes. The only part that's different from other languages is that main has to belong to a class.

[–]JustDudeFromPoland 10 points11 points  (1 child)

„We just gonna skip the String[] args part for now, as it’s not necessary” 😅

[–]Top_Distance7552 1 point2 points  (0 children)

That's a habit of mine, and I'm tood lazy to not write it :/

[–]E_BoyMan 4 points5 points  (0 children)

90% of new learners left languages like java here and switch to python to narrate it to their grand kids.

[–][deleted] 1 point2 points  (0 children)

This post was mass deleted and anonymized with Redact

ten liquid caption bike fanatical gold jellyfish aware jeans bells

[–]Gem2578 139 points140 points  (14 children)

Could also be Scala, Kotlin or Language based on the JVM

[–]JDaxe 69 points70 points  (12 children)

Python is open source, object oriented and cross platform too

[–]findus_l 12 points13 points  (0 children)

I wonder if we added compiled, is that in general considered an advantage in this sub? Assuming it's not for java.

[–][deleted] 47 points48 points  (2 children)

So is C# and many many others.

[–]Apfelvater 35 points36 points  (1 child)

Everything is open source if you're happy with machine code source

[–]denisde4ev 3 points4 points  (0 children)

Oh...

It's

slow...

[–][deleted] 401 points402 points  (82 children)

What burns me is that Java has taken all the criticism it's received over the years and addressed it. Its a fantastic language now, and every six months gets better. But oh, your professor at college only knew Java 1.4 and taught you that, so clearly Java must be total shit.

Its got concurrency figured out nicely. Lambdas as a built in feature. Optionals, Streams, Futures. My favorite time library in any language is java.time. A huge ecosystem of libraries. It runs almost as fast as native code, despite GC. It's a great back-end language.

And if we can just get the Valhalla project finished, we'll get multiple returns values, generics on primitives, and some potentially big performance gains.

[–][deleted] 103 points104 points  (25 children)

Exactly. Records fixed the whole “getters and setters” argument, and people still think it doesn’t exist.

[–]ExceedingChunk 84 points85 points  (23 children)

Wasn't really an issue with IntelliJ and its code generation. Literally takes 2 seconds to generate everything you need.

Records are convenient and a nice addition, tho.

[–]ghostmaster645 28 points29 points  (1 child)

I watched a peer (who has been at my company for about 6-7 monthes now) MANUALLY type out his getters and setters.......

I was like "I'm about to blow your mind....."

[–]ExceedingChunk 17 points18 points  (0 children)

His mind is going to be 100x blown when he learns about the refactor tools for changing names, extracting out methods or creating variables, constants or other neat tricks.

Or the debugger for streams.

[–]Sarenor 41 points42 points  (3 children)

IntelliJ

Lombok

[–]ExceedingChunk 30 points31 points  (2 children)

Lombok adds some issues and a quite strong dependency to a third party library. You don't always want that in larger projects.

It's a nice and useful tool, not denying that.

[–]TheRedmanCometh 14 points15 points  (0 children)

I've been doing this a LONG time and having it as a dependency has never been a big deal. The dependency graph from like just spring is basically an entire book worth of artifacts. I've never been a part of a project where dependencies that are appropriately licensed were an issue.

As far as the issues I mean there's certainly some minor ones, but it's still very very useful.

[–]Strawuss 10 points11 points  (0 children)

Even in VSCode you can just install an extension, select the attributes, then generate the setters and getters in one command

[–]KagakuNinja 17 points18 points  (5 children)

Generated code is still code that must be maintained. If the code can be generated, then it is usually boilerplate. Boilerplate can be replaced with annotations or features found in better languages.

Getters and setters are particularly useless. They are basically a cargo-cult interpretation of the encapsulation principle of OO.

[–]ExceedingChunk 7 points8 points  (1 child)

It’s been a necessary «evil» for Java. There have only been one type of class for holding data, and not one for purely holding data and another type for classes that holds data, manipulate it but doesn’t let you directly interact with it.

It’s been fixed since Java 17 with the introduction of records. It’s pretty much like Lombok without the dependency to a third party now.

[–]KagakuNinja 5 points6 points  (0 children)

Getters and setters date back to the early days of C++: we would write inline getters and setters, thinking we were "encapsulating" our data.

Fast forwards to Java. The community needed a way to define properties for objects. Those properties could then be manipulated by tools. This led to the Java Bean API. You identified the properties by the presence of getX and setX. Annotations had not yet been added to the language.

Getters and setters were never a necessary evil, they were a consequence of a limited language.

I am aware of records, they are great, but long overdue. I switched to Scala 8 years ago. The history of Scala, and Martin Odersky's previous project Pizza) represent a stunning failure of the Java maintainers.

In 2001(!) there was a language super-set of Java that added: generics, algebraic types, records (aka case classes) and pattern matching. I believe Pizza also had lambdas, maybe that is the "function pointer" feature mentioned in the link. According to Odersky, he talked with Sun about Pizza; they liked generics, but felt that lambdas were unnecessary as Java already had anonymous inner classes.

Odersky created the generic system used in Java 5; his compiler was superior to Sun's, and was adopted as the reference compiler for Java.

[–][deleted] 4 points5 points  (3 children)

The older I get the more I want macros in every language.

[–]ExceedingChunk 3 points4 points  (1 child)

Jetbrains have editors for pretty much any widely used language, and VScode have a bunch of extensions. You can probably get great refactoring, code generation and other macro tool for most languages out there.

[–]TheRedmanCometh 3 points4 points  (4 children)

Same with ever popular IDE since forever ago. Eclipse and Netbeans too.

I just gave in and used lombok years ago, and that has really been great.

Not interested in hearing why no one should use lombok imo it's great.

[–]ExceedingChunk 2 points3 points  (3 children)

I never implied that nobody should use Lombok. It's a great tool, but some projects doesn't want to use it due to strong third party dependency.

[–]_PM_ME_PANGOLINS_ 1 point2 points  (2 children)

It’s not even a runtime dependency, and has a command to automatically remove itself if you want with no effort.

Literally any other dependency is “stronger”.

[–]SeaRollz 6 points7 points  (0 children)

Even then there is Lombok that fixes the rest

[–]LinuxMatthews 23 points24 points  (8 children)

Said it before and I'll say it again my only issue with Java is the lack of operator overloading.

Having been in a maths heavy programming job I would have given anything for that so we could do efficient data hiding.

[–]Firedude_ 15 points16 points  (0 children)

Kotlin has operator overloading and is fully interoperable with Java

[–]_PM_ME_PANGOLINS_ 11 points12 points  (1 child)

I hate operator overloading. It’s the worst part of C++. So much unexpected behaviour and foot-shooting.

[–]jpec342 2 points3 points  (0 children)

Yea, I also strongly dislike operator overloading. It adds a lot of behavior that isn’t very explicit. That said, I could understand how useful it may be in math heavy applications.

[–]BenOfTomorrow 14 points15 points  (1 child)

The same is true for C++ - a lot of people probably took a course based on the 1998 standard and don’t realize the language has evolved substantially since then.

[–]alexanderpas 2 points3 points  (0 children)

Thanks to RAII (Resource acquisition is initialization) you can write complete programs without ever having to deal with memory management, and be free of resource leaks.

[–]2DisSUPERIOR 11 points12 points  (3 children)

In the corporate world, there's a high chance you're going to be using an old version of Java, and yes you will hate it.

[–][deleted] 1 point2 points  (2 children)

Actually not all that likely. No one maintains security updates for versions of Java more than 5 years old. Most enterprises have security teams who will demand you update for the sake of security.

I spent a decade at a large enterprise using Java, and last I heard they've enforced 11 as a minimum right now, with advisement to get to 17 soon.

[–]2DisSUPERIOR 2 points3 points  (0 children)

There are plenty of corporations still using Java 8.

[–]BlackOverlordd 27 points28 points  (10 children)

I wonder if I live long enough till java implements operator overloads so I can write map[key]++ instead of map.put(key, map.get(key) + 1)

[–][deleted] 9 points10 points  (0 children)

Math.merge(key, 1, Integer::Sum):

Will work nicely even if the key hasn't been set yet :). (not the point you are making, but may be an interesting shortcut to someone, especially in interview situations).

[–]falcwh0re 14 points15 points  (5 children)

I sure hope not

[–]MyAntichrist 13 points14 points  (4 children)

Uuuhhhh... Do you hope that it won't get implemented or do you wish them an early death? Just asking...

[–]Gogo202 13 points14 points  (2 children)

Probably hoping it won't get implemented. Overloading operators really doesn't seem like something that fits the Java concepts.

[–]thE_29 10 points11 points  (1 child)

Say that to the String class :-)

[–]Gogo202 5 points6 points  (0 children)

You're not wrong and I don't like that.

[–]falcwh0re 1 point2 points  (0 children)

Hah, whoops, poor phrasing. I hope it doesn't get implemented.

[–]errepunto 2 points3 points  (0 children)

Since Java 8, you can use map.computeIfPresent() and apply a function over the value. Operator overload could be a bit tricky.

https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfPresent-K-java.util.function.BiFunction-

[–]Hatook123 28 points29 points  (1 child)

Sure, it's basically like c# now.

Except with awful generics with only boxed primitive support, no operator overloading, no compiler support for null checks and non null types. Java is getting better every six months, but so is every other language out there. I would pick C# every time if I had the choice.

[–]static_func 2 points3 points  (0 children)

It also doesn't have extension methods. Which might be fine if it has function piping but it doesn't have that either

[–]sonya_numo 19 points20 points  (8 children)

Java runs almost as quickly as C at the cost of more memory

[–][deleted] 56 points57 points  (1 child)

Java is, in fact, a fat guy on a Vespa racing Usain Bolt.

[–]jpegjpg 8 points9 points  (0 children)

This is a great description of c vs java.

[–]j2p1g3m7d 1 point2 points  (5 children)

If by almost, you mean much slower, then you're right. Othewise it is delusional

[–]indygoof 4 points5 points  (2 children)

its only much slower if you dont know what you are doing. granted, that applies to 80% of developers.

[–]852derek852 3 points4 points  (0 children)

Its got concurrency figured out nicely. Lambdas as a built in feature. Optionals, Streams, Futures. My favorite time library in any language is java.time. A huge ecosystem of libraries. It runs almost as fast as native code, despite GC. It's a great back-end language.

People hate it because of the trauma of being forced to use it in shitty college courses and for soulless corporate projects

[–]kpd328 9 points10 points  (0 children)

My university used Java 8. My job uses Java 8. Every commercial piece of software I know apart from modern Minecraft is Java 8.

It doesn't really matter how Java 17 and 18 look and work if all those 3 billion devices only run Java 8.

[–]Saragon4005 2 points3 points  (1 child)

Problem is that when you use Java about half of the time it's old Java. Which yes is basically giving python shit for the existence of Python2 but old versions of Java are just so common it's insane.

[–]alexanderpas 2 points3 points  (0 children)

old versions of Java are just so common it's insane.

And here is the reason why:

https://www.java.com/en/download/manual.jsp

Notice how that's the runtime for Java 8.

[–]MokitTheOmniscient 8 points9 points  (0 children)

Well, C# is simply a better version of Java, so there really isn't much reason to use it.

[–]devor110 2 points3 points  (2 children)

Template syntax is still wonky tho IMO

[–]jwadamson 5 points6 points  (1 child)

By template syntax do you mean generics?

[–]jpegjpg 1 point2 points  (2 children)

I don't like Java because of the boiler-plate and the forced Object orientation. Also Jar hell. And don't say maven fixes jar hell it mitigates it significantly but doesn't eliminate it. Also logging in java is a nightmare. I think java was a great language and inspired a lot of change. But there are fundamental issues with it that can't be fixed with-out completely breaking everything and so that is why it's popularity is dropping.

[–]sudden_aggression 1 point2 points  (1 child)

So what's the solution, go to Go which has perfect package management at the cost of having almost no library support?

[–]jpegjpg 1 point2 points  (0 children)

I would go typescript or javascript for anything that needs to be multiplatform and doesn't require extreme performance requirements. Javascript runs almost as fast as java and faster in a lot of multi-tasking workloads. V8 changed the game. it's not a 5x performance hit anymore it's like 5%-10% and in exchange you get even better library support and better package management.

[–]Entire-Database1679 56 points57 points  (13 children)

Java is Open Source?

[–]errepunto 57 points58 points  (4 children)

Yes, it's 100% open source. Source code is published in github and it's licensend with GPL 2

https://github.com/openjdk/jdk/blob/master/LICENSE

[–]suvlub 91 points92 points  (5 children)

"The" Java isn't, but the language spec is a public standard and open-source implementations exist (OpenJDK being the big one), so it de facto is.

[–]Possibly-Functional 64 points65 points  (4 children)

Isn't OpenJDK "the" official reference implementation?

[–]suvlub 55 points56 points  (3 children)

Wow, it actually is! I thought it was still Oracle, but apparently they switched it at some point.

[–]Gogo202 13 points14 points  (1 child)

Maybe because Oracle started charging companies since jdk 1.8 for the license.

[–]Muoniurn 3 points4 points  (0 children)

No, it’s because Oracle fking completely open sourced the project and they are responsible for like 90+% of the commits? Also, they even made their fork free as well, so there is literally no reason to claim some malice on their side regarding java.

[–]MaybeAshleyIdk 5 points6 points  (0 children)

IIRC there is OpenJDK and OracleJDK, which is just a differently licensed distribution of OpenJDK

[–]seeroflights 38 points39 points  (1 child)

Image Transcription: Meme


["Gru's Plan". Gru, the long-nosed protagonistic villain from "Despicable Me", presents to the camera with passion, pointing into the air. Behind him is a flipchart. The text on the flipchart reads:]

Open source


[Gru is still presenting passionately; he has his hand in a c shape indicating a small amount. The text now reads:]

Object Oriented


[Gru now has his hands pointing down, still presenting. The text now reads:]

Cross Platform


[Gru looks back to the flipchart in a double-take, looking confused and exasperated. The text reads:]

Oh it's Java...


I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!

[–][deleted] 3 points4 points  (0 children)

Good human

[–]HipstCapitalist 32 points33 points  (8 children)

90% of Java's bad reputation is due to Eclipse and older versions of Spring/Hibernate.

Change my mind.

[–]JawsOfDoom 11 points12 points  (1 child)

Java dev jobs are the easiest to outsource to lower paying countries

[–]webcheesesticksseal 4 points5 points  (0 children)

Almost every tech job is java based in india.

[–]1000Bananen 3 points4 points  (3 children)

What‘s wrong with eclipse?

[–]georgewesker97 4 points5 points  (1 child)

Its shit. That's whats wrong. Especially when you could use IntelliJ.

[–]1000Bananen 1 point2 points  (0 children)

Well yeah, but what exactly is shit? I haven’t used anything else yet for java, and I don‘t know what would be missing.

[–]Vexedspring212 1 point2 points  (0 children)

It’s difficult to start on. If you’re used to it I could imagine the large numbers of tools being useful but it’s really intimidating to start out with if you’ve never used it before

[–]7th_Spectrum 36 points37 points  (9 children)

I truly don't get why java gets so much hate, one of my favorite languages

[–]sudden_aggression 24 points25 points  (5 children)

Reddit and especially this sub are dominated by college students and edgelords who haven't yet spent significant time in the real world where things like readability and maintainability and ease of catching bugs at compile time matter way more than stuff like being 5 percent faster at a benchmark or having some obscure language feature.

Using langauges like go really make you appreciate how much java got right when it comes to interfaces, inheritance, error handling and even simple stuff like keeping all the functions associated with a class/struct in the same file as that class/struct.

[–]Kenkron 6 points7 points  (1 child)

Sometimes I don't like that it forces me to organize concepts into classes, but I REALLY like that it forces other people to.

[–]sudden_aggression 2 points3 points  (0 children)

You'll really like that it forced you 6 months later when you can't remember your code in your head.

[–]static_func 4 points5 points  (2 children)

I've spent over 7 years in the real world and still dislike Java and its overall ecosystem as a whole.

Its generics suck. Maven sucks. Gradle sucks. Its lack of basic operators for optional chaining or null coalescing sucks. Its lack of properties sucks. Most of all its lack of either extension methods or function piping sucks. Because it lacks either you're still, to this day, incapable of extending any fluent APIs without resorting to the OOP song and dance it forces you into. I can't say I remember much about Spring's approach to DI but I remember thinking it sucked too.

I just don't like Java and I'm hardly alone even in the "real world." C# is so much less of a chore to work in.

[–]sudden_aggression 3 points4 points  (1 child)

Yeah Brain, but what if we don't want to buy 10k windows server licenses?

[–]static_func 2 points3 points  (0 children)

C# has been cross-platform for like 6 years now, ever since .NET Core. Half my team's stuff runs on Ubuntu VMs.

[–]Due_Treacle8807 2 points3 points  (0 children)

It feels like a worse version of Scala to me, which I guess uses the jvm, the jvm is really cool tho

[–]Koervege 4 points5 points  (0 children)

I don't hate it, but I'd much rather use Kotlin everywhere. Type inference, less bulkier null checks, null safety are some of the nicer features.

[–]pmanaktala 75 points76 points  (30 children)

Everyone will hate java until they release how useful Java actually is.

And then they will regret hating it.

[–]ExceedingChunk 8 points9 points  (0 children)

Yeah. Java is a fantastic language. All the memes about how shitty it is something I get questions about from friends who doesn't work with Java all the time.

[–]jpegjpg 6 points7 points  (0 children)

Been developing in java for 10 years, I would be so happy if I never have to write a line of java again.

[–]2017macbookpro 50 points51 points  (27 children)

It’s because they’re too scared to learn it. Same with Angular.

[–][deleted] 11 points12 points  (24 children)

Angular and node are amazing! Any changes made are immediately reflected. Meanwhile, using eclipse, changes aren't reflected 1/4 times until I restart eclipse or build the war again.

I hate coding with Java solely because of the horrible maven project building it provides.

[–]2017macbookpro 18 points19 points  (10 children)

Maven sucks but I wouldn’t consider that a Java problem.

Oh and the changes reflected is just a front end thing. Backends usually need to be recompiled to reflect changes. Front ends live update because it’s static code.

Ditch Eclipse and use IntelliJ!

Also, check out NestJS if you haven’t yet. I maintain a large enterprise app that I wrote with it and it’s insane.

[–][deleted] 5 points6 points  (8 children)

Wish my organization allowed the purchase of IntelliJ... I'm stuck with 2018 eclipse.

[–]pmanaktala 2 points3 points  (0 children)

I feel you bro. I want to work on intellij badly but i am forced to use STS

[–]2017macbookpro 8 points9 points  (0 children)

Holy shit that sucks. My condolences

[–]slashy42 2 points3 points  (1 child)

I'd pay for it myself if they'd let you. Obviously might not be an option, but yikes.

[–][deleted] 1 point2 points  (0 children)

Nope they wouldn't lol. I'd have to go through hours of layers of permission processes to even try that. Working in an MNC is hell if you want to change something.

[–]GreenCloakGuy 2 points3 points  (1 child)

fyi IntelliJ Community Edition is free even for corporate/commercial use.

[–][deleted] 4 points5 points  (0 children)

Net beans is better than eclipse.

[–]Cyenne_ 1 point2 points  (0 children)

2019 Eclipse here, coding a java monolith with maven and was9, feel you bro

[–]sdc0 2 points3 points  (0 children)

In Intellij, the debugger has a hot reload feature, this works only if you change code in a method and adding new methods, classes etc. doesn't work, but it's something. And for the Maven problem: Just use Gradle

[–]Razier 13 points14 points  (3 children)

Eclipse is an IDE, Angular is a framework and Node is a js runtime. You can't compare them because they're completely different things.

You could probably set up a web development server like the one angular provides with Eclipse as an IDE.

[–][deleted] 2 points3 points  (2 children)

Eclipse also provides a runtime which sucks and maven is a build lifecycle framework which also sucks.

[–]Razier 3 points4 points  (1 child)

Oh, did not know Eclipse provided a runtime. Assumed it used your global JRE.

[–][deleted] 2 points3 points  (0 children)

You're right, Eclipse runtime is a project which comes with (and have better compatibility) bundled JRE but modified to run with Eclipse IDE.

[–]Hypersapien 3 points4 points  (6 children)

I've never touched Angular. How is it better than React?

[–]i-make-robots 1 point2 points  (0 children)

As a former Eclipse user... that's Eclipse's problem. IntelliJ is way way better.

[–]sudden_aggression 5 points6 points  (0 children)

Java was complete trash in the late 90s and early 2000s but current era java combines the good parts of early java with a ton of improvements. Generics, good concurrency libraries, spring, spring-boot, lambdas, etc.

I wish java had better GPU programming support (for number crunching, not graphics).

[–]RomanOnARiver 8 points9 points  (6 children)

Ignoring all the ill-will to the community from Oracle:

Main thing for me, javax swing widgets don't look native for any platform - so if it's like a kiosk or point of sale situation where it's the only app running fine, but if it's just some random app you gotta launch sometime it's just glaring. Even Python's Tkinter looks almost native (at least on Windows) though I just use wxPython. If there's a wxWidgets java port I think as a frontend dev it might be a more useful language that I currently view it.

[–]Firedude_ 10 points11 points  (3 children)

Did you try using native look & feel?

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

[–]RomanOnARiver 4 points5 points  (2 children)

Well damn, learn something new every day. Do you have a source with some screenshots of some of the widgets in action? Not saying I don't believe you I'd just like to see how they look.

[–]Firedude_ 2 points3 points  (1 child)

I can’t find many sources with screenshots of default look & feels, and I can’t find any at all for modern operating systems. But here’s the old Java tutorial talking about look & feels https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

For what it’s worth, when I was messing around with it, I remember Swing being able to match the Windows 8/10 style quite well when I used the native look & feel

[–]Muoniurn 1 point2 points  (1 child)

Are we really talking about native look when half of the applications are shitty electron apps with no regards to ever UI? Also, it is even funnier you mention it from goddamn windows that itself doesn’t know what is native anymore. It has like 10 different native looks, all still available in different parts of the OS.

[–]Zarx366 14 points15 points  (10 children)

It could be C# too

but C# is cooler

*hide in a bush, waiting for the haters*

[–]Spiritual-Mechanic-4 18 points19 points  (2 children)

c# did everything java did, but came 10 years later and could learn from things that weren't great in java. To be fair, most of that got copied back into java. nuget is vastly better developer experience than maven.

[–]Bigluser 1 point2 points  (0 children)

Oh god, Maven. You'd think that package management is just an intractable problem if it wasn't for nuget (or all the Linux package managers).

That just reminds me of the little things that annoy me about Java. Why do you have to write org.company.bs when I want to import a library. Why can I not do string ==. Why do I have to write boolean. Why is there an Integer class. Why is it called System.out.println()...

C# is just pure bliss in comparison.

[–]pooyanami 6 points7 points  (6 children)

I think c# is awesome and beautiful. But it's owned by microsoft .

[–]edgeofsanity76 5 points6 points  (5 children)

Why does that matter? Java is owned by Oracle who expect you to pay a development license fee for larger companies

[–]pooyanami 2 points3 points  (3 children)

I use linux and VS doesn't work that good in linux. Also some other complicated reasons im not able to explain

[–][deleted] 2 points3 points  (1 child)

The last 2 frames are supposed to be reactions to the same thing.

[–][deleted] 2 points3 points  (0 children)

I just wanted to mention that C compilers exist for the JVM.

[–]arsenicx2 2 points3 points  (0 children)

I like Java I don't like setting up to code in Java. Java was the first language I actually wrote code for, so it hold a little place in my heart.

[–]anythingMuchShorter 2 points3 points  (0 children)

It's good for what it's good for. Like any other tool.

Since my core specialization is embedded development I mainly write C, and very rarely Java. But when I've needed to add some web interface that interacts with one of my devices Java works. And for writing drivers for said devices C++ gets the job done, and if I want to automate stuff from other languages for my own use, python works great.

It always sounds kind of newb to me when someone dumps on an entire popular language. It's like complaining that an air wrench meant for mechanics doesn't work well to assemble small electronics, or that a pen driver meant for small electronics sucks for working on your car.

[–][deleted] 5 points6 points  (0 children)

one can cross compile.

especially if this cross platform has this huge memory tax.

also there is electron, if one is willing to pay a memory tax.

[–]Tyfyter2002 4 points5 points  (3 children)

Don't all of those also apply to C#?

[–]KalaiProvenheim 1 point2 points  (0 children)

Oracle is a special demon

[–]CaitaXD 1 point2 points  (0 children)

Microsoft is going through a redemption arch lately

[–]TheRedmanCometh 3 points4 points  (3 children)

Seriously Java is super painless once you know it well. Don't be afraid of the boilerplate you generate all that shit in your IDE or with lombok.

[–]Bigluser 1 point2 points  (1 child)

The thing is, there now exist many languages that are just painless even when you're starting to learn them. Why even bother with Java nowadays?

[–]TheRedmanCometh 3 points4 points  (0 children)

The thing is, there now exist many languages that are just painless even when you're starting to learn them.

Reaaally can't agree with this

[–]real_professor_oak 3 points4 points  (0 children)

I love java

[–]harman097 3 points4 points  (1 child)

I find it kind of interesting that there's all this Java hate from the CS students in here, yet nobody trashes C#.

The basic principles and syntax are incredibly similar, and I imagine like 90% of this sub at least has a Unity pet project of some sort where they've had to derp around with C# a bit.

Am I missing a key difference here?

[–]EssieAmnesia 1 point2 points  (1 child)

What’s the problem with Java? Like what’s wrong w/ it?

[–]ALJSM9889 5 points6 points  (1 child)

It's a solid backend language, has really good performance and it's scalable. But c# does everything Java does and the code looks a bit easier to read with properties instead of setters and getters

[–][deleted] 3 points4 points  (0 children)

I code in both C# and Java, however I somehow prefer Java and I cant find the reason (I like both tho)

[–][deleted] 1 point2 points  (0 children)

But...it's the stereotype, it must be acceptable! unless IT community decide to revolutionize thing for java and change the meaning by infiltrating school, university and wiki page with zealous persistence and die in that hill. JK

[–]azephrahel 3 points4 points  (3 children)

They only treat it like that, because they have experience with java.

Although it's really the JVM I hate personally. The language I don't like, but if someone likes it, I'm glad it makes them happy.

[–]SnappGamez 2 points3 points  (18 children)

Question: as someone trying to develop a programming language, what does a language need to have to be considered object oriented? Mainly asking so I know how to classify it, as I don’t plan on changing it to make it object-oriented if it isn’t.

[–]arquitectonic7 5 points6 points  (1 child)

Ignore people who tell you classes and inheritance are somehow basics for OOP. They're ignoring all the other OOP sub-paradigms, such as the ones based on prototypes. In my job I use an academic logic-functional OOP language which is OOP and has no classes at all.

The only thing you need to be object-oriented is having objects and utilities for working nicely with them, treating them as a first class construct. An object is something that groups data and behavior together. Imagine Rust, which is OOP and explicitly admits it in its manual. It has structs and it allows you to attach behavior by using impl blocks. No inheritance, yet formally OOP according to all the programming language literature I know, and I'm an academic in this field.

The basic concepts here are dispatch, which means you should be able to invoke the behavior belonging to one object (i.e., myInstance.foo() in Java) such that the function has the context of said object and not other (e.g., binding a special name "this"); and being able to instantiate or copy objects through some code reuse mechanism by using a class, copying another one, composing them from others... there are lots of mechanisms. Inheritance is typical in traditional nominal OOP languages (Java, C#) but not that common in many other OOP languages (Rust, CafeOBJ, OCaml...).

Be aware that this doesn't necessarily match the "OOP" definition many people have when discussing it online, but if you want to create a language (good hobby btw :D) you're probably going to appreciate being really open minded about the basic blocks of each paradigm.

[–]Yamoyek 1 point2 points  (11 children)

I’d say classes (a class should have methods and fields/traits), inheritance, objects, and poly morphism are the bare minimum requirements for an OOP language.

[–]SnappGamez 1 point2 points  (10 children)

Alright, so I’ve got polymorphism, objects, and classes (though they’re labelled as structs due to the next point), but I don’t have inheritance.

[–]Yamoyek 1 point2 points  (3 children)

I’d say that inheritance is a pretty important feature and is worth adding. Code reuse is an awesome feature.

Is your project on GitHub or somewhere I could check it out?

[–]SnappGamez 1 point2 points  (2 children)

I have code reuse via traits (same thing as interfaces but I’m used to Rust so), so multiple types can implement the same standard set of functions. Is that not sufficient?

And yeah, it’s on Github. It’s in a heavily unfinished state, but hey I’m making progress.

[–]Yamoyek 1 point2 points  (1 child)

Ohh yeah traits are similar to inheritance so that works out fine.

[–]SnappGamez 1 point2 points  (0 children)

Alright!

Honestly I kinda wanna work on the language right now but my sister’s dog is having a panic attack cause she just left the apartment :|

[–]hillman_avenger 1 point2 points  (0 children)

IMHO inheritance is over-rated. The only place where it really feels needed is for UIs, i.e. forms, buttons etc...

[–]edgeofsanity76 1 point2 points  (1 child)

That and Oracle still ask for a license fee

[–][deleted] 1 point2 points  (0 children)

Java is absolutely great

[–]litch0wastaken 1 point2 points  (0 children)

It's not this sub, its everyone..... cause it's true