←back to thread

Be Aware of the Makefile Effect

(blog.yossarian.net)
431 points thunderbong | 1 comments | | HN request time: 0s | source
Show context
nayuki ◴[] No.42664111[source]
I see this effect in Java Maven pom.xml files. It's hard to get a straightforward answer on why each build step is needed, what each attribute means, what parts are optional or mandatory, etc. There seems to be a culture of copying these XML files and tweaking a few things without truly understanding what the whole file means. I briefly looked at Ant and Gradle, and their ecosystems don't look any better. The build configuration files seem to have too much unexplainable magic in them.
replies(4): >>42664169 #>>42664174 #>>42664189 #>>42664272 #
imoverclocked ◴[] No.42664272[source]
> I briefly looked at …Gradle… The build configuration files seem to have too much unexplainable magic in them.

This is largely due to the use of groovy. When the Kotlin DSL is used instead, it can usually be introspected by (eg) IntelliJ. Otherwise, it’s pretty opaque.

replies(1): >>42664291 #
brabel ◴[] No.42664291[source]
Bullshit. Groovy can be introspected just as well as Kotlin. And the magic in kts files is still there:

    configure<SourceSetContainer> {
      named("main") {
        java.srcDir("src/core/java")
      }
    }
Unless you know this, there's zero way you will come up with this by typing `configure` and using just auto-completion. Might as well use Groovy and a String for the name of the thing you're configuring. Good tooling would be able to auto-complete from there whether it's Groovy or Kotlin (or Java etc).
replies(1): >>42664867 #
imoverclocked ◴[] No.42664867{3}[source]
That wasn’t my experience a few years ago with a large groovy-dsl project. Since groovy will take a look in several different namespaces to automatically resolve things in a script, editors I tried had no hope of telling me what anything was.

Also, groovy allows modification of private instance variables which leads to … un-fun situations. I converted tens of thousands of lines of groovy to Kotlin. A lot of those lines were automated. Too many were not automatable for myriad reasons.

As far as the magic in Kotlin, I can easily click through all keywords and jump to the implementation in IJ. Groovy (at the time and in the project I was in) was utterly hopeless in this regard.

replies(1): >>42664963 #
brabel ◴[] No.42664963{4}[source]
Groovy closure delegates' type can be declared, giving as much information as with Kotlin. The reason you couldn't follow the code was that the people who wrote those things either didn't declare types, or IntelliJ wasn't using the type declarations (I believe Groovy support in Gradle files is less good than in general Groovy files, where the IDE does support this). You're correct that some plugins will resolve things dynamically and those cannot be resolved by the IDE. But that's not the fault of the language, if you're going to rewrite in Kotlin with types, you could just as well add types to your Groovy declarations for the same result.
replies(1): >>42669643 #
1. loglog ◴[] No.42669643{5}[source]
"Can" is the key word here. If types are optional, _someone_ will always fail to declare them, and _you_ will suffer.