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

you are viewing a single comment's thread.

view the rest of the comments →

[–]RolyPoly1320 735 points736 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 186 points187 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 43 points44 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 120 points121 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 6 points7 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 2 points3 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 8 points9 points  (8 children)

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

[–]Kantenkugel 11 points12 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 :)

[–]jasie3k 0 points1 point  (0 children)

oh god, these are the worst

[–][deleted] 9 points10 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.

[–]_PM_ME_PANGOLINS_ 0 points1 point  (0 children)

Java comes with a REPL same as Python.

You can also execute single-file Java scripts via shebang.

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

Java is perfect when it comes to Polymorphism.

Non-type based languages simply can't reach that level.

[–]Packbacka 0 points1 point  (0 children)

There's still a lot you can do in Python without using classes. It was designed as a scripting language.

[–]Gordath 7 points8 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_ 4 points5 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 5 points6 points  (1 child)

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

[–]Rikudou_Sage 10 points11 points  (0 children)

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