News for hackers. Stuff that matters.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @04:25PM (#28981538)
Being verbose is a plus. I really really really hate the terseness of Kotlin and how it's basically unreadable without an IDE.

Languages should be dumb. Standard libraries should be smart. Not the other way around. The number of syntax constructs that generate standard library calls when compiled should be minimized as much as possible.

Edit: one more thing, operator overloading is extremely harmful for readability.

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.
Re:New language features since Java 8 to 17 by filoeleven on Sunday October 24, 2021 @05:11PM (#28981968)
> Languages should be dumb. Standard libraries should be smart. Not the other way around.

This is a strong argument for Clojure. The language makes helpful and readable guarantees about data shape, and provides a wealth of functions that operate on its core data structures.

Kotlin has a bunch of inferred classes, and Java has a bunch of explicit ones. Clojure recognizes that data does not look like either of those: it’s fundamentally a sequential list of things or a key/value map of things. Everything else is a special case that only your program cares about, and it gives you the tools to build a system to work with them as generally or specifically as you need it to.

Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:14AM (#28985527)
That is data. Not every problem is fundamentally about data though — the special case you mention may very well be the whole problem domain. Eg. what percent of data does a compositor work with vs state-holding objects with proper structures like WindowLayoutEngine and the like?
Re:New language features since Java 8 to 17 by filoeleven on Tuesday October 26, 2021 @12:36PM (#29002549)
I’m not familiar with compositors, so unfortunately I don’t have a ready answer, only more questions.

What makes a WindowLayoutEngine “a state-holding object with proper structures?” How is it different from “a data tree with proper structure,” except that the former includes methods inside the class instance while the latter relies on functions to operate on the data tree?

Re:New language features since Java 8 to 17 by aww_dang on Monday October 25, 2021 @02:38AM (#28985022)
I like verbosity. I like knowing what I am getting. I like explicitly specifying the defaults, rather than assuming or having the details buried in the documentation.

Solving problems and formulating a problem solving approach takes time. This is the important part of writing software. A few extra keystrokes are relatively minor in comparison.

"I want to write software, but I don't want to type too much", never made sense for me.

Re:New language features since Java 8 to 17 by goatlover on Sunday October 24, 2021 @05:14PM (#28981989)
"The utility of a language as a tool of thought increases with the range of topics it can treat, but decreases with the amount of vocabulary and the complexity of grammatical rules which the user must keep in mind. Economy of notation is therefore important." - Notation as a Tool of Thought by Kenneth Iverson
Re:New language features since Java 8 to 17 by V-2 on Sunday October 24, 2021 @05:09PM (#28981942)
If Kotlin is unreadable without an IDE, it's Kotlin done badly. You can misuse its features to obfuscate the code, but in and of itself it's an extremely clear language.
Re:New language features since Java 8 to 17 by grishka on Sunday October 24, 2021 @05:12PM (#28981978)
Kotlin relies on the developer to write readable code, and just generally offers way too many ways of doing the same thing. Too much freedom of expression. Java, by virtue of being more verbose, requires writing everything out explicitly, so you really have to expend some extra effort to make your code unreadable.
Re:New language features since Java 8 to 17 by V-2 on Monday October 25, 2021 @05:09AM (#28985843)
"generally offers way too many ways of doing the same thing"

Such as?

"Java, by virtue of being more verbose, requires writing everything out explicitly, so you really have to expend some extra effort to make your code unreadable."

Boilerplate is what makes code unreadable. Getters, setters, backing fields, all that noise, takes lots of space getting in the way of grasping the meaning of the code. Java is too much about how instead of what.

Re:New language features since Java 8 to 17 by grishka on Monday October 25, 2021 @11:20AM (#28988807)
Incapsulation is very much overrated.
Re:New language features since Java 8 to 17 by wyager on Sunday October 24, 2021 @04:45PM (#28981733)
The tradeoff space you’re describing doesn’t reflect reality. Adding more brackets and pointless keywords to a language doesn’t meaningfully improve the programmer experience in any way. There are plenty of terse languages that don’t require an IDE to understand. If anything, Java effectively requires an IDE to use because it’s so verbose.

The things that I write in a computer program’s code should correspond as closely as possible to what the program means - nothing more and nothing less. Java is terrible at this.

Re:New language features since Java 8 to 17 by BMorearty on Sunday October 24, 2021 @04:51PM (#28981780)
Excellent counterpoint about Java requiring an IDE because it’s so verbose. In fact when I complain about Java’s verboseness, Java fans tell me “who cares, just use your IDE’s ability to auto-generate code!” But of course that doesn’t help with the _reading_ of verbose code.
Re:New language features since Java 8 to 17 by kaba0 on Monday October 25, 2021 @04:18AM (#28985564)
Counterpoint counterpoint: an IDE is most definitely not required to write Java, but due to the ecosystem’s size, reliance on IDE and language’s simplicity (that does cause some additional verboseness), Java’s IDEs are top notch and I wager that you actually type less characters for the same codebase in Java than in some less verbose language due to them. So all in all, win-win with more readable code and less typing.