top | item 42456074

(no title)

dajtxx | 1 year ago

I started with Java 1.0 and thought it was great. I still do, although I haven't used it since 2020.

The only thing I don't like is how there is no built-in JSON package which seems like a necessity these days.

Removing the public static void main(String[] args) business seems like pandering to a non-existent audience, or at least a miniscule and insignificant one. Anyone who is going to use Java for a real project is not going to be worried about that, and anyone who thinks that's too difficult to deal with is never going to be a good programmer anyway.

discuss

order

Zu_|1 year ago

The last part seems like a very 'gate keepy' point of view.

If you want to introduce someone to programming, you probably don't want them to worry about what all those 'magic words' do.

At least for their first steps, they won't need to know what a class is or what `public` and `static` mean.

jraph|1 year ago

I think gp is right, and I don't think it's gatekeeping. I thought this about Java, it was easy to criticize its verbosity, but I realized how insignificant this is when actually practicing it. There's probably way more interesting and deeper criticism to make about Java.

About the first steps of a newcomer, there's always going to be some level of "don't worry about this now, we'll see what this means later" for any language. I remember this to be the case for every tutorial I read to learn a language. And it's fine, as long as you can try stuff and it doesn't get in the way.

I'd say it's more important for a language and its vocabulary to be well structured and well documented for a newcomer and Java does quite good on this front.

unclad5968|1 year ago

GP is right. If the words public static keep you from learning how to program you were never going to learn anyway. If I introduce someone to soccer and they quit because they couldn't figure out how to put their shoes on, chances are they werent going to learn how to play no matter what.

smaudet|1 year ago

Agreed.

I still feel like the author is missing the forest for the trees. Bash is not great to write e.g. a red black tree in or do complex image processing, but you don't have to maintain a Java install, download libraries, or setup an editor with an LSP (and really, calling java script.java 10 asdf? Why do I need to invoke Java at all? At that point, I'm probably going to wrap it in a script anyways...)

Python has its own issues but it's a small, embedded install that you don't have to accept 5 different licenses for and worry about it being able to get the same version...

And bash? That's what pacman -S jq is for - anything I can't easily do in bash or batch I just offload to a small utility written in python or rust.

Java is, at it's core, just too heavy, IMO.

znpy|1 year ago

> If you want to introduce someone to programming, you probably don't want them to worry about what all those 'magic words' do.

I learned Java when i was 15 or 16, reading some random book first and then I stole 35 euros from my mother's purse and bought a copy of "Java how to program" by deitel and deitel[1]. The recommended version at the time was Java 5, and the SJCP certification was still issued by Sun Microsystems.

I can tell you, "public static void main" is not going to be the problem.

[1]: looking back (i'm in my 30ies now) sometimes I wonder if i would have been better off buying weed or alcohol (or both)

AnimalMuppet|1 year ago

As mongol said in a top-level comment, Java isn't a great language for programming "in the small". It's not a great language for a casual user - or rather, there are languages that are significantly better. If you want to introduce someone to programming in a semester course, "public static void main" isn't going to be a significant hurdle. If you want to introduce someone to programming as a 14-year-old, maybe don't start with Java.

jknoepfler|1 year ago

Yeah, you want to start with basic imperative programming with as little cargo-cult nonsense in the way as possible.

Your csci 101 kids will not benefit from unpacking what it means to compile an object-oriented language down to bytecode to run on a virtual machine. It's not that it's not valuable knowledge, they just won't have the context to make meaningful heads or tails of it.

related: I still puke a little remembering the requirement that students work on assignments in emacs on terminal machines rather than their text processor of choice(which was fine for me, but why on god's green earth would you put usability warcrimes like 'hjkl' in the way of someone just starting to learn? No wonder nobody in the early naughts wanted to learn to program...).

voidhorse|1 year ago

I'm of two minds about it. On the one hand, the verbosity is arguably noise if you are first learning to program, or just want to write something quick, so I can see why people dislike it.

On the other hand, viability, classes, and "staticness" are all fundamental structural concepts in Java. Hiding them for a special case is sort of like lying, and, in the long term, I can actually see this special case causing more confusion for new learners. It's sometimes better to be upfront and transparent and force your users to work with the paradigm and semantics they chose to adopt, rather than pretend it doesn't exist. If Java had been designed to allow for top-level functions from the start, it'd be a different story. I think special casing is a generally bad way to evolve a programming language.

gf000|1 year ago

But there is absolutely no hiding, the design is very smart!

You simply get an unnamed implicit class like `class Tmp367 {` written at the top, and the runtime loader has been modified to be more accepting of main methods. There was basically a tiny language change, and no bytecode change, java semantics are just like they always were.

The Main loader just simply will accept an instance method named 'main' for a class with an empty constructor with no args, instead of psvm.

II2II|1 year ago

> Removing the public static void main(String[] args) business seems like pandering to a non-existent audience, or at least a miniscule and insignificant one.

Perhaps the audience doesn't exist because of that business. There are many times when I would have used Java over Python to write simple programs for no other reason than having the ability to create a GUI without resorting to third-party libraries. Yeah, Python has tk but it has never clicked with me in the sense that Swing does. Unfortunately, cramming every last thing into an OOP model means that simplicity is rapidly lost. (The same can be said of Python, except Python has not forced it. Java, historically did.)

msgilligan|1 year ago

I agree that for experienced programmers working on large projects a little bit of verbosity around `main` is insignificant. But first impressions matter, especially when there is pervasive word of mouth about "verbosity".

Pretend you are a college student and you are taking your first programming class (e.g. CS 1) and your friends have told you that Java is "verbose". You start with "hello world" and you have to type `public static void` etc. One of your friends shows you the same code as a Python 1-liner.

Or similarly you're a beginning programmer in the workforce and your employer asks you to solve a problem using Java. You've heard Java is verbose and when you start with "hello world" you find that what you heard was true.

This is not a non-existent/minuscule audience. They should have fixed this decades ago. Better late than never.

I've been impressed with the modernization of Java over the last 10+ years. Simplifying "hello world" is a minor change relative to the others, but still an important one.

dgfitz|1 year ago

> But first impressions matter, especially when there is pervasive word of mouth about "verbosity"

I watched most of my comp sci 101/102/201 classmates fail out because they didn’t want to understand how things worked, they just wanted to make a lot of money.

Edit: hn even helped me prove the point: https://news.ycombinator.com/item?id=42457515

Teach that to a 10 year old, where their primary keyboard experience is a phone.

More than that, if rust is the future, which I have seen espoused before, picking on the Java keywords and syntax is highly amusing.

bigstrat2003|1 year ago

I did cut my teeth on Java back in middle school-ish. It never bothered me at all, I was too busy having fun learning to program. I agree with GP, the mandatory class is a completely overblown complaint about Java.

fijiaarone|1 year ago

If you think Java boilerplate is bad, wait until you have to learn about ELF file formats in order to execute almost everything else.

norir|1 year ago

The problem is when java is used as a first language, this is needless complexity that gets in the way of the actual fundamentals of programming. Access privileges are irrelevant for a beginner who is hopefully not writing libraries that will be consumed by anyone. The distinction between an instance and static method is also confusing and irrelevant. It's just pointless ritual for the student.

Now, if one is learning java as a second language, that's a different story.