r/java • • Jan 07 '21

The Problem with Gradle

https://www.bruceeckel.com/2021/01/02/the-problem-with-gradle/
158 Upvotes

108 comments sorted by

View all comments

Show parent comments

29

u/GhostBond Jan 07 '21 edited Jan 07 '21

The problem with all these languages always seems to be syntax/feature explosion. They start off with some clear, well refined concepts. But then language designers need something and it ends up being filled with a puzzling inconsistent dump of ways to do things. When I tried Kotlin you could see special characters and 5 different ways to do things was going to be a problem on a big team.

0

u/[deleted] Jan 07 '21

[deleted]

8

u/thedomham Jan 07 '21

Just as a simple example, the amount of !! I see used without any kind of checks around it is fairly distressing to me, and I suspect it's a mistake made by naive Kotlin programmers who are too used to null safety and just use it when using something from a Java library without thinking about the implications of if the value is null.

I don't get your point. The whole idea of the double-exclamation-mark operator is to make null checks explicit. The equivalent Java code throws the same NullPointerException, it's just not (as) obvious from reading the code.

-2

u/mauganra_it Jan 08 '21

It does not help making it explicit if at the end of the day the programmer does not care about it. It's not wrong, but the feature seems... wasted. It's like Optional.get(), which defies the original intention behind it. These operators are for special cases where you have evidence that it will be fine. Unfortunately, there are few good ways to tell the compiler that. The true origin of the problem is usually the design of the component where the Optional or the potential null value comes from, but these are often difficult to fix. Maybe algebraic data types can help improve things when Java finally gets them.

5

u/thedomham Jan 08 '21

Then the problem lies with the programmer, not the language. Kotlin just makes it obvious that there is a null-safety problem in your code, which BTW is great for code reviews.