News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by imheretolearn on Sunday October 24, 2021 @04:09PM (#28981418)
Could you please support your statement with reasons?
Re:New language features since Java 8 to 17 by ronri19 on Sunday October 24, 2021 @04:36PM (#28981651)
Not sure about the person above but the following are my opinion on why I don't like Java:

1. no unsigned integers

2. no freestanding functions

3. pom files are a huge pain

4. the com.blah.blah.blah ridiculously long package path precedent makes it awful to work with if you don't have an ide

5. you can't actually use javac to compile your code. everything is so big and complicated you have to use ant, gradle, maven, etc.

6. too much boilerplate. "public static void main" etc.

There's a few more, but they'd take more than a sentence to explain.

Re:New language features since Java 8 to 17 by xxs on Sunday October 24, 2021 @04:50PM (#28981767)
>no unsigned integers

technically, char is unsigned. For practical purposes use ByteBuffer.

>no freestanding functions

you can "import static" all the static functions you want; it's not any different than C, where you need to include the headers.

> pom files are a huge pain

That has nothing to do w/ java, itself, like at all.

>you can't actually use javac to compile your code. everything is so big and complicated you have to use ant, gradle, maven, etc.

If you use ant, how did you get to use pom? That's pretty much saying that using 'make' is terrible. For personal projects that involve no web, I don't quite need anything else but the JDK, itself. In that case, it's totally doable to call javac form the command line.

Re:New language features since Java 8 to 17 by karmakaze on Sunday October 24, 2021 @05:06PM (#28981922)
Great (unintended) straw-man comment. These are all minor reasons in the context of an introduction to developing software. Yes, there's some initial setup, but once that's done and you're learning how programs are constructed with classes, objects, methods and where static typing can help you, they're all the important things that will carry you well into a career.
Re:New language features since Java 8 to 17 by dunefox on Sunday October 24, 2021 @05:13PM (#28981986)
Just because you can have a career in Java despite the disadvantages does not mean that they're not disadvantages that most other languages don't have.
Re:New language features since Java 8 to 17 by karmakaze on Sunday October 24, 2021 @06:30PM (#28982527)
Wasn't suggesting that one make a career of Java, but rather apply the knowledge learned in using a statically-typed, compiled language with OO and functional bits. Hopefully advancing to using languages with type-inference as one progresses.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:26AM (#28985618)
For beginners, you can literally write Java the same way you would write python.

Write class Hello { public static void main(String[] args) { … }} into a Hello.java file and issue java Hello.java and it will compile and run your code. It hardly gets easier than that.

Also, it’s a bit unfair mixing in build tools for beginner courses - I doubt beginners start with python virtual envs either. And then don’t get me started on the multi giga node folder hell that you get from a simple Js project.

Re:New language features since Java 8 to 17 by dvdkon on Sunday October 24, 2021 @04:51PM (#28981779)
Lots of other good arguments have been posted, but I'd like to say something to the teaching aspect. In high school, we had four years of Java. I already knew most of the curriculum at the start, so others would sometimes ask me for help with assignments. Quite a few times, even after years of school, I'd run into people being confused by classes, instances, what curly braced blocks meant on a class vs on a control statement...

You could say the class should've been taught better, or that the students just weren't good enough, but I think a good tool (programming language) should help users, not be a barrier to overcome. Programming in Java doesn't require too many concepts, but you have to start with all of them at once, and I think some students just never got over that initial step.

It's of course debatable whether another language would have been better or whether Java really contributed to the problem, but I think we can agree there are languages that better lend themselves to teaching complete beginners.

Re:New language features since Java 8 to 17 by Longhanks on Sunday October 24, 2021 @04:24PM (#28981529)

  public class Main {
      public static void main(String[] args) {
          System.out.println("Hello, world!");
      }
  }
vs

  print("Hello, world!")


Please comment again if you still cannot see the bloat/unnecessary verbosity.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:25PM (#28981547)
Global scope is a terrible invention. The less implicitness there is, the better.
Re:New language features since Java 8 to 17 by valenterry on Sunday October 24, 2021 @09:40PM (#28983666)
Global scope is not a terrible invention and if you look carefully then you will notice that the Java version uses it as well.

Or where is the import to get "System" into scope? It's imported globally everywhere (just like all everything from java.lang).

So the only question is: should "print" be burried under layers or not. I don't think the advantages of burrying are really worth it.

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:28AM (#28985640)
OP meant the public static void main part (that is you define what happens encapsulated in a class) Of course implicit imports are needed, like what else would you have without?
Re:New language features since Java 8 to 17 by valenterry on Monday October 25, 2021 @04:44AM (#28985747)
> that is you define what happens encapsulated in a class

Apart from that it is really unintuitive to have something "static" within a class (which is commonly understand as a template), it is not encapsulated because it is static _and_ public. _And_ now you can search for this thing everywhere - and what happens if you find two of them?

Yeah no, the idea of "public static void main" wasn't a great one, no matter how I look at it.

It's much better to be explicit and ask the user to decide which file they want to use as the starting point.

> Of course implicit imports are needed, like what else would you have without

They are of course not needed. You could also just import everything manually. Okay, Java's import suck, but in a better language you could do "import prelude._" in the beginning of every file and otherwise you are left with keywords only. Not saying that's a great idea, but it certainly can work without implicit imports.

Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:29PM (#28981587)
then write assembly.
Re:New language features since Java 8 to 17 by kjeetgill on Sunday October 24, 2021 @08:02PM (#28983117)
What? Barring the stack, everything's essentially global in assembly. Like you can touch your process whole address space from anywhere!
Re:New language features since Java 8 to 17 by weatherlight on Monday October 25, 2021 @09:18AM (#28987428)
also, everything is explicit. the op seems to correlate the two.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:33PM (#28981623)
What I'm trying to say that at some point in piling up abstraction layers, abstractions stop being helpful and start getting in the way.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:27AM (#28985628)
But that verbosity doesn’t scale with code size, so it is largely meaningless.
Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:26PM (#28981563)
“It’s extremely busy and verbose” were the reasons.

I agree with those reasons and I’ve always felt Java sucks because of them. When Java first came out I was a C/C++ programmer and was excited to learn it. Very quickly became disillusioned because it was incredibly verbose. I hoped the language would evolve quickly but it took FOREVER. Meanwhile Microsoft introduced C#, whose v1 looked like a copy of Java, and very quickly evolved the language to make it much better. They did what I hoped Sun Micro would do. But Sun just sat there and twiddled their thumbs.