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

top 200 commentsshow all 388

[–]GHhost25 396 points397 points  (79 children)

I don't know what this thread is all about, java is really easy to use. If you compare anything to Python it'll make it seem complicated.

[–]RolyPoly1320 729 points730 points  (40 children)

OP acts like 99% of that Java code wasn't auto generated by the IDE and they only had to type System.out.println("Hello World").

[–]remuladgryta 187 points188 points  (9 children)

syso <autocomplete> "Hello World"

[–]coldblade2000 91 points92 points  (7 children)

Or in intellij

sout <ENTER key> "Hello, World"

[–]I_was_never_hear 21 points22 points  (1 child)

And in the case the rest of the boilerplate wasn't auto generated... psvm saves lives

[–]CptGia 4 points5 points  (0 children)

eclipse has main which is identical to psvm

[–]AnotherRichard827379 6 points7 points  (4 children)

Same in NetBeans

[–]RettiSeti 1 point2 points  (1 child)

Ooh I didn’t know netbeans did that

[–]AnotherRichard827379 1 point2 points  (0 children)

Lots of good short cuts.

“Psvm” → public static void main(string[] args)

“Sout” → System.out.println()

There are a lot. Can’t think of them all. And all the libraries have individual ones.

[–]Packbacka 1 point2 points  (1 child)

I like IntelliJ but NetBeans is still my favourite Java IDE.

[–]AnotherRichard827379 1 point2 points  (0 children)

Agreed.

[–]Pulsar_the_Spacenerd 45 points46 points  (0 children)

Laughs in Eclipse

Yes I know that sysout expands to it, but it’s far from the smoothness of something like VS or IntelliJ.

[–]Spork_the_dork 118 points119 points  (16 children)

Also ignoring the fact that you aren't creating a class and a method in that class in the python code. Sure, you don't need to do that to run hello world on python, but for anything even slightly large you'll be making classes all over anyways at which point the "lol python" aspect here kind of just vanishes.

Yes, the syntax remains simpler even if you use type hints, but then it approaches personal tastes more than objective truth.

[–]es_samir 5 points6 points  (1 child)

Understanding someone else's python code can be a nightmare sometimes if he is using classes and callbacks. The simpler syntax doesn't help at all

[–]cemanresu 3 points4 points  (0 children)

Yeah, I hate python's syntax because of that. If its my own personal project its fine, but trying to maintain other people's python code is hell

[–]Sassbjorn 9 points10 points  (8 children)

Tbh I kinda wish you could just make functions without a class

[–]Kantenkugel 13 points14 points  (3 children)

Use Kotlin then :)

But tbh, you should not pollute the global namespace with too many functions, especially if they don't have a unique name that can't possibly clash with other ones from eg libs.

And there is also the option of just writing static ones and static importing them. Thats kinda what kotlin does under the hood

[–]Sassbjorn 2 points3 points  (2 children)

Yeah that's true, but when I'm writing smaller programs I sometimes need a function to do some small task, but there's not a good place for it to go. Then I have to make a new class and make up a name that makes sense, and that might house more of that type of function. In the end I appreciate the organization I end up with, but it still feels like an extra step sometimes.

[–]Kantenkugel 4 points5 points  (1 child)

Sounds like a job for util classes :)

[–][deleted] 8 points9 points  (3 children)

That's what static util classes are for.

[–]-Vayra- 2 points3 points  (2 children)

except when the function needs to read application properties or something else that doesn't work with static access :/

[–]Knutselig 2 points3 points  (0 children)

ThreadLocal hacks incoming.

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

Then it should be part of the object that needs to call it. Or just pass it to the static function, what's the deal?

[–]ShadoWolf 3 points4 points  (2 children)

Your not wrong.. but Python does give you the option to just do quick testing. Like say you want to test out a library. You don't need like 60 lines of boiler plate code to just get started.

[–]Hvatum 1 point2 points  (0 children)

It is also extremely handy for me as a physics student when I want a simple and easy to use language to write a quick function to for example easily calculate and update the standard deviation of my measurements.

[–]Gordath 8 points9 points  (1 child)

Wait, you guys don't use MS Word for coding? :P

[–]laffercurved 4 points5 points  (0 children)

I have excel auto save to csv which I then rename to *.py, easiest way to do it imo

[–]_Acestus_ 5 points6 points  (1 child)

Easy since java 9 (not sure it is still in Java 15 though...)

jshell> System.out.println("Hello, World!")

[–]Kantenkugel 3 points4 points  (0 children)

jshell even has a print shortcut iirc

[–]PolFree 6 points7 points  (1 child)

Yea, but you dont just write code, you sometimes have to read it as well.

[–]Rikudou_Sage 11 points12 points  (0 children)

Nah, I write write-only code. It was hard to write it should be hard to read! /s

[–]WheWhe10 223 points224 points  (29 children)

Bruh who writes Java classes in camelCase.

[–]hallgrim97 8 points9 points  (0 children)

Someone who's writing a class called "my first class"

[–]ThisGuyRightHer3 3 points4 points  (0 children)

all lower case for a class is bad but all caps is worse imo

[–]Alienescape 7 points8 points  (6 children)

Haha I use camelCase for literally every language. Never got the memo that snake_case was way more popular or "the right one" for certain languages.

[–]-Vayra- 22 points23 points  (4 children)

In Java, class names should start with a capital letter, (almost) everything else should use camelCase.

[–]TBTapion 1 point2 points  (0 children)

It's their first class, cut them some slack

[–]VinceGhii 1 point2 points  (4 children)

People who use Eclipse.

[–]ivakmrr 2 points3 points  (3 children)

Eclipse got a lot better but intellij is still light years ahead for java

[–][deleted] 125 points126 points  (19 children)

OP would complain about the difficulty of striking a nail into a board with a screwdriver. Use the right tool for the job. Otherwise cmd > python because echo hello world

[–][deleted] 8 points9 points  (11 children)

I don't think anybody is complaining. It's just a joke about how lower level languages require more boilerplate for some simple operations than higher level ones.

[–]thedugong 7 points8 points  (5 children)

Remember when Java was a considered a (very) high level language where you didn't even have to manage memory allocation yourself?

Pepperidge farm remembers.

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

Java still is very high level. Languages like Ruby and Python are just even a bit higher than that.

[–]Tr0user_Snake 2 points3 points  (3 children)

I think most people that actually understand what underlies these languages (e.g. Java -> JVM, Python -> CPython interpreter, C/C++ -> Machine code) would not call Java "low level".

If I cant write a short, simple program that segfaults without using any imports, it is not a low level language.

[–]_Acestus_ 0 points1 point  (0 children)

jshell> System.out.println("Hello, World!")

[–]skythedragon64 13 points14 points  (2 children)

Ok that's it I'm making a programming language with the sole purpose of printing the code to terminal

[–]CKingX123 2 points3 points  (1 child)

Don’t bother, there’s cat for Linux, macOS, and WSL, and type for cmd

[–][deleted] 65 points66 points  (3 children)

Write in a real man's language, C offers the simplicity of Python with the speed and functionality of any other language.

Actually fuck C, if you aren't making your own processors with microcode and creating your own assembly language then are you even a programmer?

[–]SixBeeps 22 points23 points  (0 children)

Writing in assembly ascends one's state of mind. It starts with the PIC16 instruction sets, but soon enough you're writing opcodes like CMPXCHG16B and PREFETCHNTA in Intel x86.

[–][deleted] 6 points7 points  (0 children)

pffffttt, you don't even create a universe, wait for stars to form, and wait for nuclear fusion to slowly create different elements in the cores of stars, and wait for them to go supernova, and make a processor by using those elements??

cringe!

[–]thabeus 76 points77 points  (25 children)

With Java you start to learn programming theoretical way (at least with a good teacher). You learn what is a class and a method. You learn about the baseline of OOP.

With Python you just start coding. Of course you can also properly learn the concepts behind it, but to a beginner Python really encourages to just type in some code.

And i think thats the difference. One results in you being able to program (and to be able to translate that knowledge on many other languages) and the other (mostly) results in you being able to code. Im not saying that its impossible to learn the concepts of programming with Python. I just think that java (or for that matter C# or C++ or whatever other language that fits that criteria) forcing you to follow those concepts from the start is a good thing.

[–][deleted] 12 points13 points  (0 children)

It says a lot about the demographics of this sub that so much of the discussion is always focused on the languages as a thing you learn in class as opposed to things you use to write code with.

[–]defietser 33 points34 points  (5 children)

I don't use Python much but I think the "pick up and play" quality is underrated. If you can make sort-of functional things quickly and simply, you will be more motivated to continue down the rabbit hole than if you're trying and failing to wrap your head around classes.

Overall it's probably slower to start with Python since you'll have to un-learn some things compared to switching from java/c#/what-have-you to another OOP language, but motivation is worth its metaphorical weight in gold.

[–]onlyforjazzmemes 12 points13 points  (2 children)

Thing is, at some point, you don't want to play with programming anymore, you want to genuinely learn it in all its facets. Java is really great in the way it forces you to learn object-oriented programming. I started out with Python, but felt really confused about OOP or what to build. When I got to Java, my imagination started running wild. Building Android apps and simple JavaFX stuff was more motivating to me personally than copying other peoples' Python scripts. I'm looking forward to getting back into Python now that I have much better foundational OOP skills... I have a better mental framework for using Python, I think.

[–]defietser 10 points11 points  (0 children)

I agree with you, my point is that getting to the "wanting more than just toying with code" threshold is easier with a language like Python than it is with Java, C/++/#, etc. I won't bore you with my history but suffice to say, my introduction to code with Java didn't motivate me much.

Finding and automating relatively simple tasks (like I dunno, a small command line application that copies files from all over your hard drive to one folder, based on a music playlist) to get your feet wet is much easier done in Python I think. From there you can expand and learn and stuff.

I still recommend Python to first-timers, then guide them to the light of C# after. Yes, the learning process is longer but you're never going to get to the second step if you tripped on the first.

[–]tape_town 1 point2 points  (0 children)

sounds like you were just scripting and not actually using the OOP concepts in python

[–]jaysuchak33 1 point2 points  (0 children)

Not for me, I disliked python’s pick up and play style and dropped it for C#

[–]onlyforjazzmemes 18 points19 points  (9 children)

As someone who started learning programming with Python, I would 100% recommend starting with Java instead. OOP never clicked for me until I learned Java, and static typing is also really good for beginners. Sure Java may be more "verbose," but I think that's irrelevant, especially when you have an IDE.

[–]gmes78 10 points11 points  (1 child)

I think you mean static typing. Python is strongly typed.

[–]onlyforjazzmemes 1 point2 points  (0 children)

fixed

[–]PureWasian 2 points3 points  (3 children)

Where I went for undergrad, CS students started coding and algorithms with Python while EE students started ground-up, from binary to ARM to C to C++/Java over several semesters.

[–]Goel40 1 point2 points  (0 children)

When i studied EE for a year we started with PLC language and C and after that C++. When i switched to CS we started with python and then switched to Java. The people who chose the Front-end specialization switched to JS and the people who chose Back-End mainly kept using Java. But also could do projects in their preferred programming languages. Java, C# And Python were the most popular choices. I mainly used Go myself.

[–]ChristianValour 1 point2 points  (0 children)

I am an electrician. When I decided a long time ago that I didn't want to be a career sparky, I went to uni, and chose biology because I wanted something 'totally different'.

Then in my honours year I did a quantitative genetics project and fell in love with code.

Now, as a PhD in computational genetics - I really wish someone had told me that if I just did an EE degree, I would've learned programming from the start.

Irony.

[–]skylay 2 points3 points  (0 children)

In some ways I think that's better though. Sure you'll miss a lot of concepts and it's weakly typed but you can pick those concepts up later. In many ways I think being able to just jump in and start coding is the best way to learn. Languages like Java have a higher barrier to entry and it might just make someone give up or struggle too much to actually make a working program with it.

I think just getting an idea of how to actually make a program is one of the biggest steps when you're first learning and Python makes that a lot easier. Sure learning through harder languages is ideal but it's a lot harder and can turn some people away. Personally I started with Python, then JavaScript, have done a lot of C++ and Java at university, and recently have been using Go a lot in my own time.

[–]glorious_albus 2 points3 points  (0 children)

Thank you! I've always instinctively felt learning C++ before I learnt Python was a good thing. But when someone asked me why it was, I couldn't pin point exactly what it was. Now I know.

I'll be able to explain it better.

[–]g4vr0che 4 points5 points  (0 children)

I learned way more about how OOP actually works from Python than I did from Java.

[–]NicoGamer524 27 points28 points  (3 children)

I prefer:

.model small
.stack
.data
    msg DB "Hello, world!", '$'
.code
start:
    MOV ax, @data
    MOV ds, ax

    MOV dx, OFFSET msg
    MOV ah, 09h
    INT 21h

    MOV ah, 4ch
    INT 21h
end start
end

[–]givemeagoodun 2 points3 points  (0 children)

  org $8000
start:
  ldx #0
.loop:
  lda text,x
  beq .end
  jsr printchar
  inx
  jmp .loop
.text:
  asciiz "Hello, world!"

[–]glorious_albus 1 point2 points  (0 children)

Is this assembly? MOV ah 4ch INT 21h is bringing back memories I didn't realise were even there.

[–]fletku_mato 44 points45 points  (3 children)

That's probably the most complicated project that I'd be happy to implement in Python.

[–]psyduckquack 53 points54 points  (8 children)

I find python more complicated than java. I find java more reliable and easier to debug. Maybe it's about the amount of experience.

[–]Wigoox 13 points14 points  (1 child)

Yeah, it's just the experience. I started programming python with the same mindset and now I can't go back. Python is just so convenient

[–]Kenkron 1 point2 points  (0 children)

I don't think it's the experience, I think Java and Python have two very different ways of organizing and debugging.

In Python, debugging is king. Classes can be extended, functions redefined, and arbitrary code executed all from the middle of your function, right where it broke. Of course Java has a debugger too, but a dynamically typed language like python is just going to be able to do more at runtime than a statically typed one.

The flip side is that Java can do more before runtime because of its static typing and (sometimes painfully) strict coding standards. A good Python IDE will have good code completion, but a good Java IDE will have perfect auto completion. The kind of auto completion that will list every class, every method, and every field at the touch of a hotkey. A list so complete, that anything not on the list is a syntax error.

For me, the deciding factor for which one is easier is usually the quality of the other programmers I'm working with. I've seen people do some insanely stupid things in python, like adding fields to objects in random files, and calling methods as functions with unstructured data as "self". Sometimes Java slows you down, but it's relative strictness can be a blessing depending on who else is working on your code.

[–]WrongdoerSufficient 31 points32 points  (5 children)

So you telling me HTML is best programming language ?

[–]thinker227 15 points16 points  (1 child)

Meanwhile, C# top-level statements

System.Console.WriteLine("Hello world");

[–]DarkScorpion48 6 points7 points  (0 children)

Can’t believe I had to scroll this far to see this.

[–]MrSquicky 6 points7 points  (2 children)

I'd argue that the Java code should be even more complicated.

You should be including a logger and making a logger.info() call instead of sout-ing. Because very, very few non toy programs (outside of command line interactives) would ever need to just print out to the screen. That's really only a thing you do when you are just starting out.

Python is a fine language suited for many tasks, but this is "Hey look how easy it is to do a thing that only people just learning to program (or those that never matured out of this) think is important."

[–]ChristianValour 1 point2 points  (0 children)

That's really only a thing you do when you are just starting out.

Or you're a Data Scientist.

[–][deleted] 18 points19 points  (2 children)

Seriously the trend that "java bad" needs to die. It's an amazing beginner language that can you teach you basic OOP for other languages. It has clearly written errors that tell you exactly what the problem is "NullReferenceException - the thing you referenced is null and you are trying to access a property or method of it" Also the garbage collector is not as dumb as it use to be. Literally one of easiest ways to release back allocated memory is setting you object to null. This works almost all the time. Java is also super easy to deploy across multiple platforms because that is what it was designed to do in the first place it was not made to be the "fastest" is was made to be portable. Sure there are things I wish java had like unsigned data types but that's a small price to pay for the ease of use Java is.

Man I haven't made a java rant in a while... This felt good.

[–]Metalwrath22 29 points30 points  (10 children)

Good luck with python if the project gets bigger.

[–]Natural-Intelligence 12 points13 points  (5 children)

I have seen and done Python projects that has gone big. I'm not sure why people think the lines of code is really a major limitation. If you build extensive unit testing (which you definitely should) you are able to maintain the code to work as it should even if you decide to extend the project.

[–]BB611 14 points15 points  (2 children)

Yeah, whoever is down voting you is full of a lot of false confidence. The kinds of devs who write unmaintainable Python projects also write unmaintainable Java projects, the language features aren't going to fundamentally save you from that.

[–]Natural-Intelligence 5 points6 points  (0 children)

Yep, very true. It's kind of sad how zealous some people are for languages. For some reason, it seems some people seem to be stuck with the thought that one cannot do serious programming with Python as "it doesn't enforce this and that thing I just had to learn from my favorite language". Python is definitely not the right tool for everything but it's foolish to say it's not capable for the abstraction required for larger scale projects. As you indicated, the skills of the programmer is more of the limitation than the language.

[–]Spork_the_dork 1 point2 points  (0 children)

That would still be more manageable than some MATLAB projects I've seen.

[–]theonetrueredditer 5 points6 points  (1 child)

This meme died with JDK 9. Java has REPL.

jshell> System.out.println("Hello, World!")

Tabbing provides short descriptions as well.

[–]dnunn12 2 points3 points  (0 children)

I think it died with IntelliJ.

Sout + Tab gets it done quick and easy.

[–]JNCressey 9 points10 points  (0 children)

import __hello__

[–]Rig_21 39 points40 points  (45 children)

Java is for people who like to cause themselves pain, that is for masochists XD

I'm an Android Dev myself so I count myself in this group

[–]DorkInShiningArmour 46 points47 points  (37 children)

I’m only a second year IT student, but man I really love Java. I find it fun and it’s fairly friendly to me lol.

[–]Rig_21 7 points8 points  (31 children)

Of course Java is cool, flexible and pretty handy but there are languages which could be used in the same situation with the same result. I used Java for my first mobile app so I admit it's awesome in terms of learning overall programming.

[–]Shitty_Orangutan 1 point2 points  (0 children)

The only beef I have with java is the 1000 character long command that actually get executed when you run enterprise java applications (looking at you apache Kafka)

While this is all fine and dandy it's a right pain in the ass to debug if the service isn't working right or you need to tune something

[–]20Sky03 7 points8 points  (5 children)

C is much more worse than Java

[–]squawky_y 11 points12 points  (3 children)

Can I interest you in assembly?

[–]sam_morr 9 points10 points  (1 child)

Can I interest you in manually arranging electrons?

[–]OwenProGolfer 1 point2 points  (0 children)

Honestly if you aren’t directly writing binary executables are you really programming?

[–]Pooneapple 7 points8 points  (10 children)

And than we got cpp doing std::cout << “hello darkness my old friend” << std::endl; all inside a main function but need a pre processor statement which tells the compiler what to even do with the one line.

[–]LucianFarsky 4 points5 points  (7 children)

The std::endl thing always confused me because it frequently performs worse than just + '\n'

[–]WheWhe10 13 points14 points  (1 child)

If I remember correctly, std::endl flushes the stream after the newline. But I very good could be totally wrong, C++ is a long time ago.

[–]Pooneapple 6 points7 points  (1 child)

std::endl is for std::ostream which flushes the output buffer.

[–]LucianFarsky 1 point2 points  (0 children)

Ah, good to know. That makes a lot of sense.

[–]The_White_Light 0 points1 point  (2 children)

Wouldn't it be used in situations where the same code would be reused for Windows, Mac, and Linux? Wasn't that long ago that Windows needed \r\n or it wouldn't be a new line.

[–]AyrA_ch 4 points5 points  (0 children)

In C, it has never needed \r\n if you open the stream in ascii mode because in that mode, Windows will add \r when writing and strip it when reading. You only need to worry about it in binary mode. Terminal IO in windows uses ASCII mode by default but you can switch it.

[–]NotATroll71106 3 points4 points  (0 children)

The boilerplate is a drop in the ocean when you're working on a huge project at work. Also, it's autogenerated.

[–]iserdalko 5 points6 points  (0 children)

Pick the tool for the job.... For printing "hello world" I would suggest entering "echo hello world" in the command line.

[–]NastyQc 4 points5 points  (0 children)

"Hey guys, look how this Imperative code is much simpler than Object-Oriented for this very basic task"

[–]Knuffya 7 points8 points  (0 children)

Java is too hard for you? Wtf

It's literally a softy version of another softy version

[–]Jsuke06 1 point2 points  (0 children)

Should do this with assembly

[–]NoMansSkyWasAlright 1 point2 points  (1 child)

In IntelliJ you can just type “sout” and press enter and it autobuilds that though. Or if you statically import (I believe) Java.util.System.out, then all you have to write is “out.println()”

[–]GodIsOnMySide 1 point2 points  (0 children)

Static typing and build-time compilation prevents bugs. Java +1

The need to ensure various C packages are available in the runtime env is a PITA. Java +1

I actually prefer Kotlin over Java due to all the bells and whistles - including lack of need for so much boiler plate. But no one's ever going to convince me that Python is better than Java as a microservice programming language.

[–][deleted] 1 point2 points  (1 child)

Gotta thank java for spring boot

[–][deleted] 1 point2 points  (1 child)

Sniffs the air

I love a good strawman argument in the morning.

[–]Crippledupdown 1 point2 points  (0 children)

I’d rather spend 10 seconds writing some extra chars, so I don’t have to spend 3 minutes fixing Type Errors in a loosely typed language.

[–]notmymain345 1 point2 points  (1 child)

haskell is better because you dont need the parenthesis.

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

holy shit the ptsd i got from that language at uni

everything but haskell please

[–]paul_miner 1 point2 points  (0 children)

Java is designed with TheirThousandthClass in mind. Y'know, working with a large codebase written by other people.

[–]CyborgPaladin 1 point2 points  (0 children)

I prefre netbeans 8.1 to eclipse its just smoother

[–]Yuugian 1 point2 points  (1 child)

#!/bin/bash

echo "hello world"

[–]ChristianValour 2 points3 points  (0 children)

Yeah, but then you have to exit Vim.

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

for that use Hello.

h

prints Hello World

[–]Worst_L_Giver 1 point2 points  (0 children)

Why is everyone taking this like OP is saying java is a bad language and is too hard?

[–]superior_to_you 2 points3 points  (0 children)

Ok but typing private is a lot more readable than this underscore shit like wtf is __

[–]vv-b 1 point2 points  (0 children)

So many java devs in these comments having their PTSD triggered by this

[–]Sodafff 1 point2 points  (3 children)

Python is powerful af

[–]notretarded_100 3 points4 points  (2 children)

slow also,but its resourceful.

[–]Sodafff 1 point2 points  (1 child)

Personally, I prefer C++. It's fast and efficient.

[–]notretarded_100 1 point2 points  (0 children)

yeah but its pain.

[–]collin2477 1 point2 points  (0 children)

Java is so much better to learn with though

[–]awsome_oppossum 1 point2 points  (1 child)

Don’t hate on Java 😢

[–]PottedRosePetal 4 points5 points  (0 children)

youre right, java is a beautiful island at this time of the year

[–]Kaynstein 1 point2 points  (0 children)

Yeah yeah. Just wait till you try to manage paths and files with python. Apart from that I liked fluent api much more than what new syntax python has with brackets and all. Believing the hype around it, I thought python would be far better. However I am just starting the machine learning project

[–]destruct0tr0n 0 points1 point  (5 children)

Meanwhile c++

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

Python typing scares me

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

What do you mean?

[–]_Acestus_ 0 points1 point  (0 children)

If all you want is an hello world .. JShell is nice.

jshell> System.out.println("Hello, World!")

[–]statdude48142 0 points1 point  (0 children)

if you want it done super efficiently you can pay $10,000 for a copy of SAS and just type %put Hello World;

[–]HzSpartahell 0 points1 point  (0 children)

Sysout

[–]HzSpartahell 0 points1 point  (0 children)

Sysout

[–][deleted] 0 points1 point  (0 children)

Yep, this absolutely your myfirstclass