I also think Java is shit, but if you manage to get a NullPointerException while writing a hello world program, maybe anon is just not cut out for computers?
Anon tries programming in Java
Submitted 1 day ago by LiamTheBox@lemmy.world to greentext@sh.itjust.works
https://lemmy.world/pictrs/image/6f226985-82ad-43ea-80ac-a5ae8c97cc13.jpeg
Comments
svcg@lemmy.blahaj.zone 1 day ago
navi@lemmy.tespia.org 1 day ago
I always loved that Java has a NullPointerException but doesn’t have the concept of pointers in the language (only references).
dukatos@lemm.ee 1 day ago
That is because they planed to add pointers and then gave up.
starman@programming.dev 20 hours ago
C# has
NullReferenceException
and it actually makes sense.
unexposedhazard@discuss.tchncs.de 1 day ago
Java
Thats your first mistake bucko
Batman@lemmy.world 10 hours ago
My inner mathematician respects Java. The first step in any problem is defining your universe
JackbyDev@programming.dev 8 hours ago
You may find JML interesting. www.openjml.org
lurklurk@lemmy.world 12 hours ago
Hello World
30 minutes of boilerplate
writing imports
$ cat <<EOF > Hello.java public class Hello { public static void main(String args[]) { System.out.println("Hello world!"); } } EOF $ java Hello.java Hello world!
ok
MooseTheDog@lemmy.world 12 hours ago
Welcome to java, we have a couple unconventional ways of doing things, but overall I’m like every other mainstream oo language.
People: AHH! Scary!
Welcome to python. your knowledge of me wont help you elsewhere as my syntax is purposefully obtuse and unique. Forget about semicolons, one missed space and your code is as worthless as you after learning this language.
People: Hello based department
Classy@sh.itjust.works 10 hours ago
Oh my god I got fucked by a python script once because of a single space. It took forever to figure out what went wrong
JackbyDev@programming.dev 8 hours ago
``**kwargs`
“No, I don’t use type annotations because they don’t actually do anything. In fact I purposefully give this parameter different types for different behaviors. How is that confusing?”
lurklurk@lemmy.world 12 hours ago
Python has its drawbacks but it also has a pretty useful standard library so as a language for small scripts, one can do much worse
PanArab@lemm.ee 12 hours ago
It is possible to dislike both. For me SmallTalk-like languages are peak.
sugar_in_your_tea@sh.itjust.works 9 hours ago
Python:
print("Hello world")
dch82@lemmy.zip 9 hours ago
C:
#include <stdio.h> int main() { printf("Hello World!"); return(0); }
JackbyDev@programming.dev 8 hours ago
This is getting a little better nowadays.
> cat Hello.java void main() { System.out.println("Hello, World!"); } > java --enable-preview Hello.java Hello, World!
Things to notice:
- No compilation step.
- No class declaration.
- Main method is not
public static
- No
String[] args
.
This still uses preview features though. However, like you demonstrated already, compilation is no longer a required step for simplistic programs like this.
PanArab@lemm.ee 9 minutes ago
Main method is not public static
It must be somewhere under the hood. Otherwise, it wont be callable and it would require an instance of an object to call. Unless the object here is the Java environment?
No String[] args
They are just optional I’m sure, like C and C++. You still need them to read command line arguments.
cashew@lemmy.world 5 hours ago
Microsoft Java is a one-liner these days.
$ cat program.cs Console.WriteLine("Hello, World!"); $ dotnet run Hello, World!
yarr@feddit.nl 11 hours ago
He types REALLY slow.
meowMix2525@lemm.ee 10 hours ago
I got the impression they skipped the hello world cause it was too easy and they wanted to get right to writing their app so they moved on to more advanced stuff without having a real grasp of the basics
babybus@sh.itjust.works 20 hours ago
If it took anon 30 minutes to write hello world in java, programming is not for anon.
pinkystew@reddthat.com 15 hours ago
We bow to your wisdom, wise gatekeeper
babybus@sh.itjust.works 12 hours ago
Thank you. If you bothered to read a 5 minutes tutorial instead of posting to 4chan, you could also reach this level of knowledge.
AusatKeyboardPremi@lemmy.world 20 hours ago
I might have agreed a decade or two ago, when I knew no better. But today, I find the tribalism surrounding programming languages comical.
I don’t particularly like Java, but I use it because it pays the bills. Similarly, I use C++ (which I prefer) when my work requires it.
SorteKanin@feddit.dk 17 hours ago
I don’t particularly like Java, but I use it because it pays the bills. Similarly, I use C++ (which I prefer) when my work requires it.
I mean, anon is not arguing against that. They’re saying the language is shit regardless of how much it is used in business. I don’t think they are entirely wrong.
frayedpickles@lemmy.cafe 12 hours ago
Tell us more ancient one, your heroic tale of “giving up against the endless weight of capitalism” is fascinating.
lurklurk@lemmy.world 12 hours ago
“giving up against the endless weight of capitalism”
We just call it “having a job” nowadays
AusatKeyboardPremi@lemmy.world 11 hours ago
Love the dramatics.
This ancient one has learned the art of pragmatism. A little time in the trenches of enterprise development can do that – turn passionate ideals into practical choices.
Some days it’s C++, some days it’s Java, Python and so on. In the end, the code compiles, and the ancient one get paid.
Ilovethebomb@lemm.ee 1 day ago
Can anyone who’s actually dealt with Java tell me how much Anon is exaggerating?
scottmeme@sh.itjust.works 1 day ago
I’ve worked on a corporate project with multiple Java services, anon isn’t really exaggerating. Java can be a hell scape at times
taladar@sh.itjust.works 1 day ago
They forgot to mention that production Java applications apparently need to log a certain minimum number of completely meaningless stacktraces per hour to work properly. Or at least I assume that is the case from the fact that all of them do that.
RogueBanana@lemmy.zip 22 hours ago
But none of this is relevant for a hello world programming, right?
kitnaht@lemmy.world 1 day ago
I’m pretty sure Java doesn’t have pointers, so writing a hello world application isn’t gonna fuck up nearly that hard.
The one thing he forgot though is that your source file is probably in
com/companyname/net/classes/factory/factoryfactory/worker/lib/bin/refresh/jdk/model/ui/closebutton/press.java
And spread out among a million other directories, and the java file is like…3 lines. But there are 10k files spread all around directories like this that are all 3 lines a piece with a class definition.
SpaceNoodle@lemmy.world 1 day ago
Everything in Java is a hidden pointer
perviouslyiner@lemmy.world 1 day ago
wait, so when .io gets deregistered, are a load of companies going to have to rename their root directories and rewrite all of their include statements?
Valmond@lemmy.world 1 day ago
They have sort of pointers, like references, that can be null…
You just “new” stuff to it and let the “garbage” collector deal with freeing stuff up. When it feels like it.
bluelion@sh.itjust.works 1 day ago
- a hello world doesn’t need libraries in Java
- installing JDK takes at most 5 steps, depending on the OS
- a nullpointerexception is more likely the developper’s fault (unassigned value, calling a function on a null object)
- IntelliJ is easy to install and modern (granted, other IDEs are very ancient)
- developping GUI apps is a PITA, no matter the ecosystem (generally)
The rest is more or less spot on (no idea about concurrency issues though)
Blue_Morpho@lemmy.world 1 day ago
nullpointerexception is more likely the developper’s fault
Of course it was the developer’s fault. But it’s absurd a language without pointers throws an error about pointers.
tyler@programming.dev 23 hours ago
The date of the post is from this week so it’s not accurate at all. Java does support main outside of a class now, and it doesn’t need to be static, or take args. You wouldn’t use JavaFX in this day and age either. Installing the jdk is absolutely nothing especially if you’re using IntelliJ as it will install it for you and manage everything. No library is even close to 3gb.
This entire post sounds like it was written by someone that last touched Java in 2010.
Source: am a Kotlin dev. Java sucks. None of these are the reasons why.
chunkystyles@sopuli.xyz 1 day ago
I’ve been programming in Java professionally for 11 years. It’s not just embellishment, it’s outright lying.
Threads giving you race conditions? All concurrent programming will do that if you’re shit at it.
Java has come a long way. I will admit that UI in Java is terrible. I would never do that.
extremeboredom@lemmy.world 1 day ago
It’s not accurate to accuse Anon of “lying,” when both their story and yours would point to the race conditions from threads being a symptom of someone who’s just learning the language.
It’s not that seruous though; because it’s a greentext, it is both artificial AND homosexual.
crusa187@lemmy.ml 1 day ago
Been coding Java for about 15 years now. Pretty much agree - anon’s primary mistake was using javaFX. From a junior dev perspective I can see why they’d do that, but Java isn’t really meant for building desktop applications, it’s meant to power web apps.
What they should have done instead is create a backend restful web service and wire up a frontend rest client with something suited to web app ui dev such as angular or react. Java has some awesome frameworks built for it over the years, something like spring boot would make building that backend service trivial if you know how to use it. JAX-RS/Jersey or even servlets could be utilized for this instead, if you wanted to.
Spring boot has some nice tooling for thread management, but Java also has pretty good options for this built in as well. As chunky mentioned, if you aren’t already versed in concurrency patterns, don’t try to perform concurrent operations or you’re gonna have a bad time. But do learn how to do this, because exploiting concurrency is one of the golden rules of good computing.
SorteKanin@feddit.dk 19 hours ago
Threads giving you race conditions? All concurrent programming will do that if you’re shit at it.
Well, if you write Rust then there won’t be race conditions.
Lysergid@lemmy.ml 1 day ago
95% exaggeration. Here is reality:
- yeah you need class coz it’s OO-language. Though, not required anymore, which should’ve been done once Java got scrip language capabilities (jshell) back in JDK 9. But as of today not required anymore
- imports exist in most if not all languages. Gotta be insane writing them manually in 2010 let alone 2024
- installing Java runtime (JRE) is as simple as installing any app. Though for installing JDK you need 5 mins for setting PATH. Think about JDK as like TSC or Webpack and JRE as a Browser. I’d argue installing and configuring JDK is simpler than TSC or Webpack
- Unless you doing some non-trivial multi-threading your stack trace will tell you exactly where is your NPE. You gutta be as blind as my teammates to spend more then 1 minutes to find where it is coz it literally tells you file and line numer where Exception occurred
- I mean, yeah if you use IDE from 2000 it will look like it. IntelliJ looks modern, though I don’t like the fact latest versions look like VSCode
- I hardly reach 3G of decencies from all 10 projects I have on my workstation.
- IDK what author means by ecosystem here, Java ecosystem is quite standard across the board. JDK(std lib), Maven/Gradle(deps, build, publishing), Spring Framework (all sorts of blueprints and solutions to standard app level problems), Hibernate/JPA (ORM), JUnit+Mockito (testing). These are tools and libs used in 90% of projects I worked on. Of course there will be more depending on project needs. Layers? It’s not like language imposes any layers whatsoever. It’s just common practice to have 3-4 layers and some glue in-between.
- don’t do GUI in Java it sucks and will suck until Java gets string interpolation. Hopefully soon
- concurrency is actually the only thing which is really bloated in Java. Which will change with next LTS version if I remember correctly. And it’s not that hard if you actually read the f manual and not just “try and hope”. Again it will become much more efficient and easier to follow soon. As of now - yeah, not trivial. But people mostly prematurely optimize, so karma
- Java is kinda have 20 ways to do same thing but actually no. Java built with idea of providing simple building blocks. Then it provides more specific API built on top of those building blocks. It allows to have API which solves typical problems and provides capability to solve custom problems with those building blocks. People often confuse this as many ways to do one thing but it’s like saying “I can have byte array why I need string data type”. Those are different levels of abstraction
rumba@lemmy.zip 1 day ago
95% exaggeration if he is a real programmer.
If he just tried to walk into Java knowing nothing or maybe PHP, and refused to RTFA, he might experience about 30% to 40% of that I just trying to do everything wrong.
pastel_de_airfryer@lemmy.eco.br 1 day ago
It’s possible to get the old InteliJ UI back. Search for the Classic UI plugin.
Pencilnoob@lemmy.world 1 day ago
It’s much better today, but in 2010 that was 100% accurate.
That being said, using Java as a first time programming language is like a 15 year old trying to fly an airliner to get a few blocks away to pick up some after school snacks. Obviously it’s way overkill. Sure you could get across town with it, but it’s probably 1000x more complicated than just a simple bicycle or even walking.
Java is industrial strength for professionals. There’s absolutely no consideration made for educational usage.
taladar@sh.itjust.works 1 day ago
There is also absolutely no consideration in Java for production usage.
SorteKanin@feddit.dk 19 hours ago
Java is industrial strength for professionals.
Disagree. It’s an outdated tool today. Professionals would not choose it for new projects.
schteph@lemmy.world 1 day ago
Java is religiously backwards compatible. Modern java projects are not as enterprisey and boilerplatey, but, as jdk21 is backwards compatible with jdk1.3, you can still happily write code as if it’s 2003.
Additionally, the java space is huge, so just wildly googling will probably not help you that much.
taladar@sh.itjust.works 1 day ago
On the other hand back in Java 1.2, 1.3 and 1.4 days you frequently had companies install a specific patch level version because their applications worked only with that patch level. That was back when Java was actually popular for some reason.
Hawke@lemmy.world 1 day ago
Is that why every single application will only work with some ancient version of Java?(usually 8, sometimes 1.6 or 11)
I can’t think of many cases where Java 21 is a drop in replacement, and I don’t think I anyone actually used 17.
darthelmet@lemmy.world 1 day ago
Only have a beginner perspective, but in school I did really well in intro CS class that used Python. 2nd class was in Java and it almost broke me I was so confused.
naeap@sopuli.xyz 1 day ago
Hated Java in school
But before Java I learned a bit of Pascal and C/C++, and I’m so fucking happy that I’m currently working with C++ in my job and not with fucking Java
I still hate it with everything I’ve got …
Valmond@lemmy.world 1 day ago
I have developed in java and C/C++ (many years) and Anon is maybe exaggerating a bit but not lying, we all have been there more or less.
Personally I hate how java forces you into bad architectural choices. Where is the unsigned int? Why isn’t an int a class BTW? Why the pass by copy for some, by reference for others? Where is multi inheritance? Lots of things are dumbed down or you have no choice in the matter.
Sure didn’t help it was a power hungry beast moving at snail speed back in the day too.
tyler@programming.dev 23 hours ago
I mean they are lying because Java does support main as a top level function now. If this was written last year, sure. Also IntelliJ will literally install the jdk and manage it for you. Using asdf I haven’t had to touch the PATH for Java in probably over a decade (used sdkman before that).
This entire post sounds like someone that last touched Java in 2010 and wanted to complain about it again. Java is shit, but for none of the reasons in the post.
Aganim@lemmy.world 1 day ago
Anon pretty much sums up my experience with Java when I had to learn it in college 20-ish years ago. I’ll never get rid of my distaste for the language I’m afraid.
Imacat@lemmy.dbzer0.com 1 day ago
It certainly can be that bad.
zod000@lemmy.ml 1 day ago
Anon is absolutely exaggerating for comic effect. That doesn’t mean Java doesn’t have all of those problems though, it just isn’t as ridiculous as they made it out unless you get dragged into enterprise bullshit (then you’re in for it).
dohpaz42@lemmy.world 1 day ago
For the “simple” apps anon is talking about, they are exaggerating a lot. Though, when you get beyond the obligatory “Hello World” and “a window with a button”, the complexity does start to increase exponentially.
Throwing in frameworks like Spring or JavaFX does make things more complicated. But it’s still relatively manageable once you get used to it and know what goes where and when.
Now the whole configuration thing, that’s an art form best left to those hooded “seniors”. It’s good to learn eventually, but not when you first start out; lest you have a fetish for pain.
Java has come a long way. It’s not the languages fault that people create monstrosities like
AbstractJavaFinalSerializedFactory
or whatever. But if you do want to be “good” at Java, you will want to learn about design patterns. It also doesn’t hurt to have a thick skin too, because you’ll be both criticized and made fun of for your choices. 😊theneverfox@pawb.social 19 hours ago
Concurrency isn’t bad, and package management (while maven is absolutely terrible to work generally), the dependency chains aren’t exceptionally bad. Getting it installed is easier than python on platforms it’s not already there on, not because it’s more portable, but because the installers do more for you. Portability is hard, they haven’t done it well but they’ve paved the default use case pretty well (although that works against you when you get to harder cases)
But the rest is pretty close.
The worst is the scaffolding, it’s literally superstition for years to gain the understanding as to why you’re doing it. I took two years of Java in high school before getting a degree - it was 4 years and halfway through a degree before I understood why I was making a class with a method main(string[] args). It works like that because your entry class calls the main method with a list of string arguments… I didn’t understand at all, because even though it’s simple it’s a special case, and I’d never seen anyone name the string array anything different, so I just copied and pasted it, never understanding it because I’d been told “you just have to have that” for do long
Builds are arcane too - there’s still companies that only use netbeans in their build pipeline, Android still requires a specific an old Java version in conjunction with the IDE or a gradle build, at best a project uses maven (the package manager), which is xml based and full of arcane details that are best treated as a magic incantation to be copied exactly from elsewhere
SpaceNoodle@lemmy.world 1 day ago
Yes. Not an exaggeration.
Zaphod@discuss.tchncs.de 16 hours ago
After working with somewhat modern Java using IntelliJ for 4 years, it’s alright. Null is the most annoying thing imo; just use Optionals instead
KoalaUnknown@lemmy.world 1 day ago
Am I weird for liking Java? I feel like it just makes so much more sense than other languages.
Serinus@lemmy.world 1 day ago
C# is nearly the same, but much, much better.
- It doesn’t (usually) come with the Java culture 8 layers of abstraction. This isn’t in the Java language. This isn’t in OO. Yet nearly every Java programmer makes things way more complicated than it needs to be.
- It’s a prettier language. Similar syntax with less bullshit.
- It’s open source
- It’s still multiplatform. Modern dotnet / C# works on anything.
- Both Visual Studio and Visual Studio code are great IDEs that blow Eclipse out of the water
- It’s one of the most common business languages.
- It’s going to be supported forever.
If I could restrict the world of programming to two languages, it’d be C# and Rust. C# for most things and Rust for a lower level language.
sentient_loom@sh.itjust.works 1 day ago
I like how straight-forward the syntax is. And it also seems orderly to have everything be a class. There’s a system to it.
I’m using C++ for a project now and I like it in a similar way, but there’s more freedom (everything doesn’t HAVE to be a class). So with C++ I’ll never go back to Java (unless it’s for a job).
chunkystyles@sopuli.xyz 1 day ago
No. Every language has its haters. There’s a reason Java is so widely used. If you like it, keep at it.
dev_null@lemmy.ml 20 hours ago
I thought I like Java until I tried Kotlin. It’s everything I liked about Java, but with everything wring with it fixed.
SorteKanin@feddit.dk 17 hours ago
Honestly I would consider that a bit weird. At the very least, old-fashioned. If you like Java, it makes me think you haven’t tried a better more modern language to compare it with.
mlg@lemmy.world 9 hours ago
Forgot the JVM eating the entire machine’s RAM for breakfast
_____@lemm.ee 22 hours ago
C# masterrace and I’m tired of pretending it’s not
Zementid@feddit.nl 12 hours ago
I really enjoyed the text.
From the perspective of a python programmer it all seems valid.
A Java-Dev would probably write the same about an embedded engineer.
arc@lemm.ee 9 hours ago
Could be worse, could be programming Javascript (or Typescript).
Orbituary@lemmy.world 1 day ago
My old boss is one of the 3 initial creators of Java. He ran our department the same way this greentext reads.
He was also a paedo. You can figure out the rest if you dig.
kerrigan778@lemmy.world 8 hours ago
Java is terrible and I hated it but I feel like this stuff is not why, this mostly just seems like stuff that most powerful object oriented languages do.
yamanii@lemmy.world 10 hours ago
I still think Java is good for teaching newbies precisely because it will throw an error quickly if they are doing it wrong.
jrgn@lemmy.world 22 hours ago
Not using Eclipse helps. Using Scala helps even more
Malfeasant@lemm.ee 11 hours ago
Must be several years old - otherwise, javafx deserves quite a bit more ire.
WormFood@lemmy.world 1 day ago
object orientated programming is the wrong idiom for almost all problems, and even in the few cases where it makes sense, you have to be very careful or it’ll hurt you
lennivelkant@discuss.tchncs.de 14 hours ago
Aside from the general stupidity, Java is a heavily front-loaded language in my experience. I’m not going to engage in any tribalism about it or claim that it’s better or worse than others. As a matter of personal taste, I have come to like it, but I had to learn a lot until I reached a level of proficiency where I started considering it usable.
Likewise, there is a level of preparation on the target machines: “Platform-independent” just means you don’t have to compile the program itself for different platforms and architectures like you would with C and its kin, as long as the target machines have an appropriate runtime installed.
Libraries and library management is a whole thing in every general-purpose language I’ve dealt with so far. DSLs get away with including everything domain-specific, but non-specific languages can’t possibly cover everything. Again, Java has a steep learning curve for things like Maven - I find it to be powerful for the things I’ve used it in, but it’s a lot to wrap your head around.
It definitely isn’t beginner-friendly and I still think my university was wrong to start right into it with the first programming classes. Part of it was the teacher (Technically excellent, didactically atrocious), but it also wasn’t a great entry point into programming in general.
Ab_intra@lemmy.world 1 day ago
Just imagine how it must have been to code Minecraft 🤣
sentient_loom@sh.itjust.works 1 day ago
You’re not stuck with it Anon. You can use something different!
MooseTheDog@lemmy.world 12 hours ago
I’ll never get the hate for java and love for python. It’s like learning mandarin because you think it’s easier than Spanish. When you know java you also kinda know javascript, C, Php, and others. When you know python, it’s probably a government sponsored course, or a programming class talked your school district into buying their “intro to programming python course”. Plus you only get to know python. I’ll die on this hill
yokonzo@lemmy.world 1 day ago
I started with java for school. The day I tried C for the first time I was flabbergasted, “what do you mean it doesn’t matter which order I put things in?”
LodeMike@lemmy.today 1 day ago
I don’t think Lemmy would’ve let you post a smaller image.
coffee_with_cream@sh.itjust.works 1 day ago
I learned programming with Java and then thankfully never had to use it since CS102. HATRED
Pieisawesome@lemmy.world 1 day ago
Just use c#
MrJameGumb@lemmy.world 1 day ago
Threads will literally punch you in the face
Like…through the monitor? How does that work? Is it an actual fist or some kind of mobile computer component?
Drz@feddit.uk 1 hour ago
bash-org-archive.com/?338364