News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:31PM (#28981601)
Being verbose is one of the biggest negatives a programming language can have. When you’re working on a team with other programmers and reading someone else’s code, verbose code takes much longer to read and grok because you have more boilerplate code to read.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:35PM (#28981634)
But reading terse code requires a lot more prior knowledge, which you might not have. You learn to recognize patterns in the boilerplate and just glance over it, taking no additional time.
Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:43PM (#28981712)
It definitely does not take “no” additional time to read verbose boilerplate code.

As for prior knowledge, that argument doesn’t fly. A lot of the verboseness of Java could be addressed VERY easily with clear syntax that doesn’t require a lot more prior knowledge. An example is getters and setters, which are very easy to understand in languages that have built-in support for concise syntax but Java has somehow ignored the advantage of concise syntax for 25 years.

Besides, if your argument is that Java doesn’t require “prior knowledge,” I beg to differ. E.g., correct usage of arrays vs. ArrayList.

Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @05:01PM (#28981876)
Heh, getters and setters. An unpopular opinion, but imo you don't need them most of the time. Usually, a getter just returns a field and a setter just assigns it. If that's the case, and unless you're writing a public API of a library, just make the field public. Make it public final if it's read-only.

The difference between arrays and ArrayList is simple: an array has a constant size known at the time of allocation.

Re:New language features since Java 8 to 17 by skneko on Sunday October 24, 2021 @04:50PM (#28981771)
> E.g., correct usage of arrays vs. ArrayList.

Arrays vs lists is a thing in all languages, not Java. They just have different names (list, vector, sequence...)

Re:New language features since Java 8 to 17 by kayodelycaon on Sunday October 24, 2021 @04:56PM (#28981821)
I don’t think Ruby or Python have linked lists, only arrays.
Re:New language features since Java 8 to 17 by mattnewton on Sunday October 24, 2021 @05:10PM (#28981951)
Ruby and python only have an equivalent to Java’s “array list.” It’s not in the standard library, but you can trivially make linked list nodes yourself if the problem calls for it; I don’t remember encountering a need for the data structure over the built in array-list type outside of interview questions anyways.
Re:New language features since Java 8 to 17 by skneko on Sunday October 24, 2021 @05:06PM (#28981924)
ArrayList is not a linked list, it's an array-backed list like List in C# or other languages, like the name implies. Linked list is `java.util.LinkedList`.
Re:New language features since Java 8 to 17 by weatherlight on Sunday October 24, 2021 @04:38PM (#28981668)
garbage collected programming languages are for people, not computers.

Kotlin isn't terse.

Re:New language features since Java 8 to 17 by edoloughlin on Sunday October 24, 2021 @05:03PM (#28981893)
I think I could make the same argument for terse code.