News for hackers. Stuff that matters.
Re:Leaving Haskell Behind by alex_smart on Thursday August 24, 2023 @08:44AM (#37248111)
What is wrong with Java's tooling?
Re:Leaving Haskell Behind by pyrale on Thursday August 24, 2023 @09:25AM (#37248482)
If you ask for my personal experience:

- The community leans a lot on configuration over code, and that's annoying. Sometimes, a hardcoded string in your conf could have been a hardcoded string directly in the code.

- Sometimes, dependency injection systems are so abstract that knowing which class is depended on in a specific runtime instance becomes a pain in the ass.

- Your idea just won't load class x, the obvious "clean cache" doesn't work as advertised, and you're back to stack overflow to know which couple of file you need to get rid of. That stuff happens just often enough for you to have a lingering feeling of annoyance, but not often enough for you to remember the exact files.

- Sure, idea is great. But in <other language> I was fine with just vim. The LSP was a great help, not a lifesaver.

- Unit testing is great. Annotations are great. Don't you enjoy that unit test class with a dozen annotations spanning 20 lines just above?

- Hibernate. Spring too, while we're at it. Not sure whether you consider this one squarely fits the tooling box.

Re:Leaving Haskell Behind by systems_glitch on Thursday August 24, 2023 @11:00AM (#37249581)
These are job security features :P

Seriously though, the hours spent fighting dependency injection and Hibernate issues alone, when working on a really big Java project, could've been a full-time job.

For maximum fun, I once worked on a large ERP system that started out as a Struts 2/Hibernate 3/Jetty project and had an entire Rails app bolted on using JRuby. Some of the stuff in the JRuby side was injected thru Spring. ActiveRecord had to talk through Hibernate.

Re:Leaving Haskell Behind by patmorgan23 on Thursday August 24, 2023 @01:55PM (#37252322)
Gross
Re:Leaving Haskell Behind by systems_glitch on Thursday August 24, 2023 @02:47PM (#37252984)
I know, right? Hundreds of millions of dollars flowed through that system every year. I got the ball rolling on killing that design with fire after we hit one of the pathological limits in IIRC Hibernate 3 and thread safety.
Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @11:05AM (#37249673)
I agree with some of that criticism (although I haven't had issues with having to manually delete files - if you do, I suspect it's a project that hasn't been set up with a proper maven/gradle setup but where all the build info is in some IDE config. that's an antipattern at this point but used to be very common).

But I don't think it's necessarily about the tooling.

And yes, Hibernate is just horrible.

Re:Leaving Haskell Behind by pyrale on Thursday August 24, 2023 @03:25PM (#37253446)
Everything is in Maven and works fine in CI, which definitely does not use idea. But in some situations Idea believes the pom isn't as fresh as its rendition, unfortunately. I can live with some caching, but everytime that happens and the "clean cache" option doesn't work, I weep.
Re:Leaving Haskell Behind by MBCook on Friday August 25, 2023 @12:12AM (#37257959)
I don’t tend to run into that. But you should be able to fix it right clicking the pom and choosing Maven -> Reimport.

The number of times I actually needed to clean my cache I could probably count on one hand over the last 10 years.

Re:Leaving Haskell Behind by gmfawcett on Thursday August 24, 2023 @07:01PM (#37255658)
Really, only the LSP comment relates to Java tooling. The other comments are about language, framework, and cultural issues. Not disagreeing with your observations, though.
Re:Leaving Haskell Behind by xmcqdpt2 on Thursday August 24, 2023 @09:02AM (#37248262)
Too much XML?

Seriously though what's a decent Java build tool? Hacking on Gradle means having to learn another PL entirely. Maven?

Then say I want to publish a library for others to use from their own java project, how do I do that? I've never actually done it, but that page

https://maven.apache.org/repository/guide-central-repository...

seems awfully complicated compared to say

https://doc.rust-lang.org/cargo/reference/publishing.html

or even the pip equivalent.

Granted, working on a well set up java project is nice, but the setup process is not simple.

Re:Leaving Haskell Behind by paulddraper on Thursday August 24, 2023 @09:20AM (#37248419)
So you don't like a config language like XML because _____ and you don't like a DSL like Groovy because _____.

What is acceptable?

P.S. For easier publishing, use a different repo e.g. Artifactory instead of Maven Central.

Re:Leaving Haskell Behind by pjmlp on Thursday August 24, 2023 @10:07AM (#37248943)
Not only do Maven and Gradle support binary libraries (including native code) instead of waiting to build the whole universe on each checkout, their plugins for mixed language development are way better than writing build.rs scripts.
Re:Leaving Haskell Behind by alex_smart on Thursday August 24, 2023 @10:34AM (#37249197)
That maven link is perhaps not the most useful, but it is not hard to find better-written articles. For example-

https://docs.github.com/en/actions/publishing-packages/publi...

The steps are roughly: 1. Configure the repository you want to push to. 2. Set up your account with the repository. 3. Configure your credentials. 4. Deploy.

Re:Leaving Haskell Behind by chriswarbo on Thursday August 24, 2023 @10:39AM (#37249255)
I actually prefer using Maven and its giant XML files: at least they're declarative, and are easily parsed, transformed, generated, etc. by scripts. Most attempted replacements (Gradle, SBT, etc.) stick with largely the same model (i.e. no extra functionality) but use a full programming language for their "config" (Groovy, Scala, etc.).

The latter gives us a "config" that's subject to Rice's theorem: it's essentially opaque, with no way of knowing what it will do other than executing it. An example I ran into at work: there's no way to list the dependencies of an SBT project (in order to set up an offline sandbox). SBT provides commands which claim to do that, but config files often append dependencies based on arbitrary logic; e.g. we had some like "when running unit tests, add this mocking plugin"; since "list dependencies" doesn't run the unit tests, that plugin dependency was missing from the sandbox.

Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @11:08AM (#37249710)
> there's no way to list the dependencies of an SBT project (in order to set up an offline sandbox, in our case for reproducible building with Nix)

Well, the same is true for Maven. I know because I've tried. Plugins can download arbitrary dependencies at execution time.

That's where the point about Rice's theorem falls apart: it applies as much to maven as to Gradle because maven plugins can do whatever they want.

Re:Leaving Haskell Behind by chopin on Thursday August 24, 2023 @05:04PM (#37254529)
But that can't be runtime dependencies to your code?

I've written a couple of Maven plugins and you must declare your dependencies explicitely even for those. Pulling in stuff dynamically would be possible but not very clever.

Re:Leaving Haskell Behind by Tainnor on Friday August 25, 2023 @08:46AM (#37261087)
The maven surefire plugin downloads dependencies dynamically depending on the kind of tests it finds. Is it not very clever? I agree. But it's one of the most popular maven plugins.
Re:Leaving Haskell Behind by chriswarbo on Friday August 25, 2023 @11:36AM (#37262906)
That sort of thing is unfortunate, but not too bad since we can add those packages to our own dependency list (e.g. in the pluginManagement section). It's a bit redundant, but as a bonus it ensures that such "dynamic" behaviour is acting as expected (since the build will fail if it picks different packages to the ones we wrote down!)

The same approach can be used when depending on third-party jars/plugins which don't fully specify their dependencies: just add the missing ones as extra dependencies of our project. (This happens a lot, where projects have undeclared dependencies on some commonly-used library, and don't notice since it's usually available in a well-stocked ~/.maven2 cache)

Re:Leaving Haskell Behind by chopin on Saturday August 26, 2023 @05:14AM (#37270993)
During Maven build, sure. But it does not add unknown dependencies to your code at runtime.

I am used to classpath problems with surefire but that it downloads undeclared stuff is new to me. Afair it pulls only in transitive dependencies. Could you give an example?

I am mainly building war files and it turned out to be good practice to explicitely declare any ambigous transitive dependencies. There's even a Maven plugin which shows up classes with different hash during build, https://basepom.github.io/dependency-versions-check-maven-pl...

Re:Leaving Haskell Behind by Tainnor on Sunday August 27, 2023 @02:06AM (#37279848)
"Runtime" was imprecise, I meant at build execution time. The point being that you can't pre-download the dependencies without executing the build.
Re:Leaving Haskell Behind by grumpyprole on Thursday August 24, 2023 @05:05PM (#37254543)
Yep, SBT and Gradle make Maven look good.
Re:Leaving Haskell Behind by twic on Thursday August 24, 2023 @06:21PM (#37255321)
Gradle is declarative. The 'code' you write does not conduct the build; it assembles an object graph which describes the build, much like the one you get from parsing the Maven XML. The advantage of using code for this is that you the description can be more concise, expressive, etc. But once it's run, the graph is built, and you can explore that, list dependencies, etc, quite safely.
Re:Leaving Haskell Behind by grumpyprole on Thursday August 24, 2023 @06:38PM (#37255472)
> Gradle is declarative

Gradles own docs say "Well-designed build scripts consist mostly of declarative configuration rather than imperative logic".

When it's up to the programmer to make a script declarative, it's not a declarative language.

Re:Leaving Haskell Behind by gmfawcett on Thursday August 24, 2023 @07:02PM (#37255665)
Yes, Maven. Just embrace it, and move on: the decision will pay dividends.
Re:Leaving Haskell Behind by layer8 on Thursday August 24, 2023 @04:47PM (#37254331)
Maven is awfully slow and awfully stateful (plugins or multiple executions interfering with each other), has too many quirks, and documentation is lacking. Gradle is imperative and also stateful.

Dependency injection and annotation-driven development is “magic happens here” that is hard to analyze when something doesn’t work, and hard to reason about in the sense of building a proof that it will always behave in the correct and intended way.

Re:Leaving Haskell Behind by grumpyprole on Thursday August 24, 2023 @05:03PM (#37254525)
Don't forget Scala's SBT, a truly awful design with lots of additional bad taste added on top.
Re:Leaving Haskell Behind by alex_smart on Friday August 25, 2023 @04:38PM (#37266736)
> Dependency injection and annotation-driven development is “magic happens here” that is hard to analyze when something doesn’t work

I don't quite get the criticism against annotations. Metaprogramming and code as data seem to get a lot of love in the context of lisp, python or ruby, but a lot of hate when it happens to be done in Java. I absolutely love the powers that reflection, annotations etc give me.

The difficulty of analyzing dependency injection and "magic happens here" is overstated. Just run the code in the debugger. And if you are having problems with the auto-configuration stuff, you can always selectively disable it and explicitly define the beans you need.

Re:Leaving Haskell Behind by layer8 on Saturday August 26, 2023 @04:32PM (#37276628)
> Just run the code in the debugger.

How do you set a breakpoint on an annotation? You can’t, and that’s the issue. You can’t reason about annotations in the precise way you can reason about library calls.

Re:Leaving Haskell Behind by alex_smart on Saturday September 09, 2023 @09:43AM (#37445315)
> How do you set a breakpoint on an annotation? You can’t, and that’s the issue.

You can set a breakpoint on your normal method and you can see if any proxy object was introduced by the annotation in the call stack and set a breakpoint there. You can also just see the usages of the annotation to see where and how it is being used and set a breakpoint there.

Anyway, going back to my original question, similar criticism is equally valid when you do metaprogramming in lisp/python/ruby. Why are these concerns only raised in the context of Java?