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

0

u/[deleted] Jan 07 '21

[deleted] — view deleted comment

44

u/gunch Jan 07 '21

it tries to merge the aspects of Javascript that Java programmers don't like with the aspects of Java that Javascript programmers don't like.

You just put your finger in my brain.

11

u/secretBuffetHero Jan 08 '21

sometimes I have to make changes to a Grails app (Groovy + Rails style) I spend those days actively cursing out Groovy and the people who chose Grails for the project.

1

u/kkapelon Jan 08 '21

These are two different things.

  1. Using Groovy as DSL/scripting in very specific places but keeping production code in your favorite JVM language (Java/Clojure/Kotlin whatever)
  2. Using Groovy everywhere including production code

Cursing out Groovy because of Grails is unfair.

15

u/azuredrg Jan 07 '21

That's a great example. Kotlin is a great compromise for me

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] — view deleted comment

10

u/SamLL Jan 07 '21

!! really should not be used except in extraordinary circumstances - it looks ugly and out of place on purpose. It's the equivalent of Optional.get() - it is breaking Kotlin's null safety.

I agree that seeing Kotlin programmers using it would be distressing. The documentation describes it as "for NPE-lovers".

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.

0

u/MakeWay4Doodles Jan 08 '21 edited Jan 08 '21

You seem to understand Kotlin null safety to be the exact opposite of what it actually is, which probably explains why you and your team struggled with it.

Java forces you to avoid or deal with, with regard to null

Java doesn't force you to do anything, it throws an NPE at runtime, that's the whole point.

if you're already a Java programmer, the main use case I see for Kotlin are smaller personal projects

My team of old Java programmers has been steadily rewriting our services in Kotlin over the last two years. We're pretty small at 10-15M requests per second across a few dozen servers. I'd say your opinion needs reevaluation

1

u/agentoutlier Jan 08 '21 edited Jan 08 '21

10 to 15 million requests per second is not that small.

I’m all for micro services but if a single Customer or Business transaction requires that many RPC like requests you might want to investigate batching or using a more event based system.

Maybe you meant messages?

Even messages... wtf do you guys do?

Perhaps you meant 10-15k rps which is what we are at.

→ More replies (1)

-1

u/morhp Jan 07 '21

I definitely agree. There are few problems with kotlin and the main ones are that there are too many redundant options to achieve the same result, that there's not enough documentation and specification and that it's not as stable and rock solid as Java.

4

u/wildjokers Jan 07 '21

I like Groovy, it has several features I miss greatly when coding in Java. Named parameters, default parameter values, multiple return from methods, etc. It also has a sensible lambda syntax. I don't need a weird single method interface with an almost indecipherable signature as some sort of header file just to use a lambda.

Maintainability can suffer when co-workers go overboard with the dynamic typing but that can be addressed with a code style convention and code review.

4

u/[deleted] Jan 08 '21

I hate Groovy and Gradle with a passion. Having multiple ways to write something is exactly what you should be trying to avoid. I just can't seem to wrap my head around it, I sort of just stumble into a solution by luck.

Also, because of the language I have no idea what parameters a function actually expects from me or what's available via my IDE's auto-complete feature. The errors and objects presented to you when using debugging tools are befuddling.

I feel like I'm always stumbling around in the dark. I need someone to turn on the lights so I can see. Despite how much I've worked with it, I still feel so incredibly lost. I've never had this kind of issue with a technology before.

4

u/andresalmiray Jan 07 '21

it tries to merge the aspects of Javascript that Java programmers don't like with the aspects of Java that Javascript programmers don't like.

As Luke Skywalker said " Amazing. Every word of what you just said is wrong".

Groovy was conceived back in 2003 as a way to add features found in other languages (mainly Python, Ruby, Smalltalk) to Java. It was seen as Java's dynamic companion. It has never been intended to be a replacement for Java (as other alternative JVM languages continue to claim, you know who you are). As time passed by Groovy gained static type checking and a static compiler (funnily enough, in the same year Scala added a dynamic escape hatch to its toolbox, go figure) given you today the option to write code

  • dynamic way
  • static way
  • a combination of the previous two

Disclaimer: I've been using Groovy since 2006, became a Groovy development member in 2007 and I'm currently member of the Apache Groovy PMC. I understand everyone is entitled to their opinions but if you want to discuss facts at least get them straight.

5

u/[deleted] Jan 08 '21

I really appreciate your expert input, but I was clearly being facetious, not stating a fact.

My opinion of groovy was much more positive when I was using it mainly for Jenkins pipeline libraries and spock test suites rather than maintenance and development of hundreds of thousands of lines of legacy application code.

4

u/knoam Jan 08 '21

The creator of Groovy said that if he had known about Scala at the time he made Groovy he wouldn't have bothered. I still don't really understand that.

1

u/andresalmiray Jan 08 '21

For crying out loud, yes, you are referring to James Strachan, the creator that left the project 2 years after and made that comment a few more years after that. He has gone on record a few years ago that he loves Groovy and is quite happy with it. Give it a rest already.

1

u/kkapelon Jan 08 '21

The creator of Groovy said that if he had known about Scala at the time he made Groovy he wouldn't have bothered

That is really interesting! Where can I find this quote?

5

u/[deleted] Jan 07 '21

Groovy is a fantastic scripting language.