News for hackers. Stuff that matters.
Re:Java’s Cultural Problem by zcw100 on Monday September 19, 2022 @06:34AM (#32896529)
This is just an angry rant by someone describing themselves as a “functional programming enthusiast”. The post is only tangentially about Java and is really about a framework called Quarkus.

If there’s a culture problem it’s the “Look at me. I learned something new and now I’m going to do my best to burn down everyone else”. If you want to program in Haskell or whatever have a great time. Think it’s so great? Prove it by writing great software with it.

Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @06:43AM (#32896592)
The way I see it, is people searching for a better way, after years of trying to actually use Java. And what does Java's chief architect think?

"It is my belief that the best direction for evolving Java is to encourage a more functional style of programming. ... We're not going to turn Java into Haskell, nor even into Scala. But the direction is clear."

https://mail.openjdk.org/pipermail/lambda-dev/2011-August/00...

Re:Java’s Cultural Problem by p1necone on Monday September 19, 2022 @07:02AM (#32896717)
You can absolutely write fairly nice functional code in Java already with a decent Either type, streams etc.

I imagine it's not that widespread because most people probably switch to a different JVM language like Scala rather than going all in on functional Java. Your functional Java code is going to be just as unreadable to a standard Java dev anyway, so the appeal of it being a widespread language is somewhat lost.

Re:Java’s Cultural Problem by lf-non on Monday September 19, 2022 @09:46AM (#32898216)
Yes, also kotlin is pretty nice if you want to write oop/procedural code with some functional flavor.

- Lot of inline methods in stdlib alleviate the performance penalty of using higher order functions for tight loops.

- It is nice to have everything as expression

- Extension functions, it parameter, operator overloading, tuples are all micro-conveniences that coherently add up to a very pleasant experience.

I think the author's experience would have been substantially different if they used ktor/http4k/vertx with kotlin.

Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @07:11AM (#32896785)
> You can absolutely write fairly nice functional code in Java already

You mean it has Lambdas? Yes that's a start, but there's a lot more it needs to claim good FP support. Programming with lambdas is not sufficient to do "functional programming", which is really about composing pure functions (everything else follows from this, e.g. immutable data). Java's roadmap does look promising though.

Re:Java’s Cultural Problem by oaiey on Monday September 19, 2022 @09:06AM (#32897778)
Pure Functions is indeed a factor, but not the only one. Other irrelevant factors are pattern matching, tail call recursion, recursion instead of loops, etc. FP is about treating data differently and dealing with side effects differently. Pure Functions are an implementation strategy of FP, not the core differentiator.

And that data/side effect difference, you can easily handle in Java, C# and other OO languages if you just overcome the culture of OO-only thinking. And despite I think the article is not perfect (who says, that a function cannot have a class/interface wrapper (aka strategy)), there is an element of truth in the spirit of the headline.

Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @09:33AM (#32898080)
> Pure Functions are an implementation strategy of FP, not the core differentiator.

"Functional Programming" is not a well-defined term. But I would argue that if you are not using pure functions then you have more of a hybrid imperative/functional language, which is fine, especially if you are careful with how you structure your effects. Modern FP languages use monads (Haskell) and/or algebraic effects (Eff) to enable pure functions to describe effects. The pure function is what enables mathematical reasoning and safe function composition.

Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @11:27AM (#32899663)
What about the Lispian way of FP, e.g. Clojure? It is noting like the Haskellian one, yet they are also on the same spectrum.
Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @01:42PM (#32901477)
Clojure encourages pure functions and immutable data, so definitely a "functional first" language. But it's not a "purely functional" language.
Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @02:09PM (#32901811)
I don’t think there is a boolean pureness flag, rather a spectrum. Haskell can also introduce arbitrary side effects in any code with some unsafe escape hatches, but sure, the common case doesn’t employ that, so it is a bit more pure than Clojure.
Re:Java’s Cultural Problem by Ma8ee on Monday September 19, 2022 @08:37AM (#32897515)
You get quite far with the "final" keyword.
Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @08:52AM (#32897663)
Actually it’s the other way around. There are very good persistent collection libraries for Java but if you are going to ‘update’ then you can’t store them in a final field since you get a new collection object. On the other hand the only thing final about

   final List<Whatever> that
is the identity of the list.

I also think Either and Optional are cancers. Type erasure takes some of the fun away from Either. Before you had Optional you had one problem, you might have a null. With Optional you have two problems, you can get a null AND you can get an empty.

I worked at a place that used Scala and the engineering manager would talk your ear off like an Amway scam person about how much better monads were for error handling than Exceptions. I started working on non-Scala stuff but once they put me on the Scala side I found out that error handling was just missing in most places even though they allegedly did code reviews. It was definitely a frying pan to fire situation relative to Exceptions.

(The time before that whenI coded in Scala I found that people would spend 3 days writing something concurrent with Actors that only used 2 out of 8 cores and was rife with error conditions that could be done in 20 minutes with an Executor in Java.)

In a a parallel universe where LISP was the dominant language, people would be writing essays about how great COBOL and Cold Fusion and PHP are, about what a genius Noam Chomsky was, how recursive descent parsers are a force multiplier, etc.

Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @09:25AM (#32897992)
> With Optional you have two problems, you can get a null AND you can get an empty.

That's not really the fault of the Optional. That's Java adding null as value to every type. Java also allows lists of nulls, mappings to null etc. An optional is just a container that stores one item at most. I do agree that it makes optionals less useful in Java. In Haskell and OCaml they are used essentially instead of null.

Re:Java’s Cultural Problem by ryanianian on Monday September 19, 2022 @10:34AM (#32898889)
Static analysis can catch a `null` being used in a place that wants an Optional. With Optional being fully pervasive in a codebase the `null` concept could effectively be eliminated.
Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @09:57AM (#32898360)
I'd grant that. I'd say the authentic-to-Java approach to the problem is to static import something like a "map" function

   var result = map(x,x=>x.y)
which is equivalent to

   var result = isNull(x) ? null : x.y
where isNull is static imported from Objects.

An approach which is authentic to some other languages is to consistently used a list with 0 or 1 members instead of optionals.

Re:Java’s Cultural Problem by switchbak on Monday September 19, 2022 @10:34AM (#32898884)
"The time before that whenI coded in Scala I found that people would spend 3 days writing something concurrent with Actors that only used 2 out of 8 cores and was rife with error conditions that could be done in 20 minutes with an Executor in Java"

Sounds like you were working with some folks that were just learning the language/idioms (which is admittedly a big hurdle).

I haven't used actors in a very long time. Simple future composition and reactive streams get you very far, at an absolute fraction of the code size and complexity of the equivalent vanilla Java approach (ie: not using Rx).

Re:Java’s Cultural Problem by Skgqie1 on Monday September 19, 2022 @11:36AM (#32899790)
That sounds very close to a "No True Scotsman" type fallacy. I've done a fair bit of consulting in the past working with Scala, and my experience closely matches the one described in the grandparent post - the issues happened with veterans more than newbies in my experience (Although that's a function of mostly working with veterans and few newbies)
Re:Java’s Cultural Problem by switchbak on Tuesday September 20, 2022 @12:23AM (#32907635)
I have seen junior and senior devs (and myself sometimes) struggle with fancier asynchronous trickery. That's true, but I think it's shortsighted to write off that effort as compared to "just using executors" (whatever that means exactly).

For me there was a lot of learning (that often just felt like grinding), and I can confidently say that I'm leagues more productive than trying to mimic this with low level vanilla Java primitives.

I'm sure this would also apply with go channels, async/await, etc. Raising the bar of abstraction in this case can be valuable. As compared to something really high leverage like reactive streams it's just going to take a ton of code and be far less flexible in a naive approach (in most cases).

I've seen this same pattern with others. Is it worth the investment of time to get there? Not sure, maybe Go is a better set of tradeoffs for most, but I wouldn't go back to straight executors, locks, and the rest of the Java 1.5 concurrency offerings (which is what I thought the OP was saying).

Re:Java’s Cultural Problem by SamoyedFurFluff on Monday September 19, 2022 @08:48AM (#32897628)
> Your functional Java code is going to be just as unreadable to a standard Java dev anyway

I’m largely unsure of this. I think the standard Java dev might have difficulty adapting but the ramp up isn’t too hard. A Decent Java shop right now should be adapting functional features from Java into their code already.

Re:Java’s Cultural Problem by switchbak on Monday September 19, 2022 @10:26AM (#32898773)
I've had a good deal of difficulty getting enterprise Java devs on board with functional Java approaches.

In many ways introducing Kotlin was easier because it was clear it was a new language, and they had more openness and excitement for learning a new language.

Re:Java’s Cultural Problem by pragmatic on Monday September 19, 2022 @08:35AM (#32897489)
This is because c# lead the way ( but also scala, etc) in showing how functional concepts could be blended into an OOP language,

I say C# more than scala as it odd a little more mainstream.

Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @08:38AM (#32897528)
The people behind Java always admired the ML family of languages, the Hotspot compiler and generational GC cam out of a research project intended to make ML languages run fast. In the JDK 8-* timeframe Java is increasingly looking like “ML the good parts.”
Re:Java’s Cultural Problem by Jtsummers on Monday September 19, 2022 @10:41AM (#32898977)
> the Hotspot compiler and generational GC cam out of a research project intended to make ML languages run fast.

Do you mean Self and Smalltalk? Because the Hotspot compiler came out of the work on them, not ML languages.

Re:Java’s Cultural Problem by agumonkey on Monday September 19, 2022 @09:31AM (#32898052)
ml is basically java with implicit BiFunction import /s
Re:Java’s Cultural Problem by fedeb95 on Monday September 19, 2022 @06:49AM (#32896627)
What do you mean "trying" to use? Many corporations use it with profit. Is there a better way to make money? Probably. But this way is very much used and profitable enough. So trying is not the right verb...
Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @06:55AM (#32896666)
Yes they have succeeded in using Java to make profit, but argubly not in creating reliable, secure and easily maintainable software. Like I said, even Java's creators believe there is significant room for improvement.
Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @07:16AM (#32896821)
I would argue about that reliable, secure and easily maintainable software.

Surely there are terrible examples for unmaintainable software monsters in every language, Java not being exempt. But based on the only relevant, existing evidence on the topic: empirical evidence, Java is probably one of the, if not the best at the software maintainability game.

Clean FP in and of itself doesn’t solve the problem, so it’s not like there is a clear cut answer to the question. I do agree that incorporating more and more immutable elements to java is a worthwhile goal to pursue, but at the same time I also believe that on a local, single-threaded scope mutability can increase understanding, so neither imperative nor pure functional is an answer to every problem in themselves.

We should strive to make both toolkits available and be ready to use the correct one for each case, the pragmatic approach.

Re:Java’s Cultural Problem by BlargMcLarg on Monday September 19, 2022 @07:21AM (#32896857)
Where are you drawing that conclusion from? Java has an immense legacy to draw talented developers from. Is it really Java itself, or its legacy?
Re:Java’s Cultural Problem by fedeb95 on Monday September 19, 2022 @07:46AM (#32897036)
If Java survival is to be attributed to the talent of its developers, isn't this the "Java culture" the post is talking about, which is supposed to be the problem?
Re:Java’s Cultural Problem by BlargMcLarg on Monday September 19, 2022 @08:05AM (#32897186)
The culture can both exhibit the problems author describes and create the foundation for its culture to be great at security.

Thing is, if I look at most places hiring Java devs, they are prominently places that care a lot about security. Wouldn't it be a self-fulfilling prophecy then, that Java culture cares more about security and tries to maintain higher standards? Especially considering Java was dominant for decades in places willing to pay big for security.

I just don't see why that would also mean it's directly atrributable to the language itself to the point it is 'the most'. C# exists too, it's not that different.

Re:Java’s Cultural Problem by fedeb95 on Monday September 19, 2022 @07:41AM (#32897006)
Go on and argue that, by providing evidence that by using Java you decrease those three metrics compared to other languages, in projects of similar size. I don't know if there are studies but if you know about them please share. Otherwise we're all talking about biased opinions, less the fact that Java is widely used and maintained.
Re:Java’s Cultural Problem by Retric on Monday September 19, 2022 @08:30AM (#32897439)
That comment is pointless, if you want to raise the level of discourse actually provide some evidence rather than simply request it from others.
Re:Java’s Cultural Problem by fedeb95 on Monday September 19, 2022 @08:34AM (#32897486)
I didn't make the original post, so while your answer is legit, it goes back to the original poster
Re:Java’s Cultural Problem by Retric on Monday September 19, 2022 @08:40AM (#32897541)
I don’t see them asking for studies etc?
Re:Java’s Cultural Problem by fedeb95 on Monday September 19, 2022 @09:07AM (#32897779)
Nonetheless they state a problem in Java culture. That should be backed by data and not by personal opinions. Otherwise they're worth what is worth. The burden of proof is on who says Java sucks in this or that way. I'm not saying it doesn't. Just that Java is there, used by thousand of professionals making money with it
Re:Java’s Cultural Problem by Retric on Monday September 19, 2022 @09:38AM (#32898132)
And your back to arguing they should be held to a higher standard with “should be backed” and “The burden of proof”

The burden of proof rests on everyone making an argument. There isn’t a privileged stance between Java is ok/awesome/terrible. I think popularity demonstrates it’s not a terrible language like say Brainfuck, but it says little about individual aspects. Individual weaknesses in some aspect could be made up by a strong showing in other areas and being popular alone provides some real advantages.

Re:Java’s Cultural Problem by fedeb95 on Saturday September 24, 2022 @03:46PM (#32965987)
Everything may be. You're missing my point: if someone makes a claim, as you said, should provide "proof", I think in this context one study would suffice. Otherwise he should use different tones, like "maybe", "in my humble opinion", "I'd like to know if..." but I guess it wouldn't make lots of visits to his website. I just pointed out a possibility that invalidates his claims (if proved of course). This suffices to show that a study is needed, in either direction, to say something about the topic at hand. The fact remains: Java is out there and widely used. Let me remark I'm not saying it's necessarily a merit of the language per se
Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @09:21AM (#32897935)
I'd say Java is the second programming language that was specified by adults. (The first was Common Lisp)

The original Java memory model was broken and got fixed. It took C/C++ another 10 years to do the same.

People use Java for server back-ends because it is possible (and not unreasonably difficult) to write correct and high-performance concurrent code with threads.

Re:Java’s Cultural Problem by RHSeeger on Monday September 19, 2022 @09:07AM (#32897782)
> even Java's creators believe there is significant room for improvement

Are there any languages for which this isn't the case? Of those, are any of them in relatively common use for production environments?

Re:Java’s Cultural Problem by pards on Monday September 19, 2022 @08:27AM (#32897402)
> not in creating reliable, secure and easily maintainable software

Every online banking system I've encountered (4+) was built in Java. None of them have been breached.

Please cite a counter reference

Re:Java’s Cultural Problem by Retric on Monday September 19, 2022 @08:33AM (#32897475)
The Equifax data breach was directly related to using Java specifically Apache Struts.

Banking software is generally riddled with security issues, if you assume something is secure without having it tested by a 3rd party chances are it’s got issues.

Re:Java’s Cultural Problem by UncleMeat on Monday September 19, 2022 @08:32AM (#32897463)
"Encouraging a more functional style of programming" and "screaming as soon as you see an abstract class" are two different things.
Re:Java’s Cultural Problem by jstimpfle on Monday September 19, 2022 @07:22AM (#32896864)
This is from 2011, maybe around the peak of functional hype, when even John Carmack sent out memos about approaching things in FP ways, and tried making his things in Haskell and then Scheme. It's my impression (which could be wrong) that he has significantly backpedaled from that since then.
Re:Java’s Cultural Problem by bigDinosaur on Monday September 19, 2022 @07:53AM (#32897103)
What do you mean exactly by 'backpedal'? As far as I know Carmack has stated that FP in general is achievable for games, he sees the benefit, but the languages and tooling just aren't there yet. There's probably some more research that needs to be done into the ideal mix of imperative and functional features in a language, too, that's something I think is very much not settled. I believe his comments about Haskell specifically deemed it ultimately unsuitable, although not necessarily because of the paradigm. At least that's what I remember him writing and talking about ~8 years ago.
Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @09:26AM (#32897997)
I'd say generally you lose a factor of two in performance when you use immutable persistent collections. Performance isn't everything (otherwise Python wouldn't be so popular) but when people have a system that works the last thing they want to hear is about a way to slow it down.
Re:Java’s Cultural Problem by the_af on Monday September 19, 2022 @12:51PM (#32900815)
> I'd say generally you lose a factor of two in performance when you use immutable persistent collections.

Is there a reference for this?

Re:Java’s Cultural Problem by the_af on Monday September 19, 2022 @07:47AM (#32897055)
The recent interview with Lex Fridman seems to indicate Carmack hasn't backpedaled at all.
Re:Java’s Cultural Problem by jstimpfle on Monday September 19, 2022 @07:50AM (#32897072)
Can you share a timestamp? I'm not aware of any new stories from his Scheme and Haskell adventures.

In the first section of the interview he specifically points out the merits of C and C-style C++, and explains how Lisp (especially mountains of macros) are hard to maintain in a team.

Re:Java’s Cultural Problem by the_af on Monday September 19, 2022 @12:14PM (#32900302)
Scheme and Haskell are not the central point. Carmack mentions he still appreciates FP lessons when writing C code.
Re:Java’s Cultural Problem by jstimpfle on Monday September 19, 2022 @12:30PM (#32900531)
He does. Not that anyone cares, but I do as well. But considering FP lessons while still writing C is a long way from considering how far Java can be moved towards Haskell. Or experimenting with writing large parts of games and systems software in Scheme.
Re:Java’s Cultural Problem by the_af on Monday September 19, 2022 @12:54PM (#32900838)
Well, the link between whatever Carmack thought about FP and C, and Java and FP idioms, was tenuous to begin with. Yet you introduced it in your comment...

To give my perspective: Carmack was a latecomer in this, at least for the widespread programming paradigms community, and also remember game programming is a niche (so what worked there was unlikely to permeate to the general community [1]). So whatever Carmack thought (which I appreciate, since I hold him in high regard!) is unlikely to have had any sway in Java, Kotlin, Scala, and other proglangs adopting FP idioms. I distinctly remember back in that era, few people who were not gamers even knew who Carmack was (to my chagrin!).

[1] I remember an experience from my distant past, when interviewing at Vostu (a Zynga-like online game company), the chief engineer told me "we don't use frameworks here, just plain Java. Forget Spring, forget Hibernate, forget everything. We don't use them. Everything we do, we do by hand". (I didn't take the job offer for unrelated reasons). Note this is highly unrepresentative of the Java community at large!

Re:Java’s Cultural Problem by waffletower on Monday September 19, 2022 @11:23AM (#32899606)
How is a celebrity game/AR developer's opinion relevant to a discussion of API design in Java?
Re:Java’s Cultural Problem by the_af on Monday September 19, 2022 @12:15PM (#32900320)
Carmack is an accomplished and top notch programmer, I'd say his opinion is highly relevant.

If you think he is "an AR programmer" you may want to re-read his bio...

Re:Java’s Cultural Problem by jstimpfle on Monday September 19, 2022 @11:35AM (#32899774)
Isn't it relevant enough to the comment that I replied to?
Re:Java’s Cultural Problem by throw_m239339 on Monday September 19, 2022 @06:57AM (#32896678)
Java needs to be more flexible and expressive, that's all, type inference, traits,collections,function expressions ... some things already made their way into the language after years of inflexibility as a philosophy.

If the language improves, then frameworks and API can be made less verbose.

A lot of "design patterns" in Java were created simply because of the language lacking expressiveness and are thus obsolete now.

Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @07:19AM (#32896843)
Most design patterns come way back from C++’s OOP hype area, actually.

Java just made those insane architectures possible due to not segfaulting at every turn, hence it also got associated with them. And indeed, many are “deprecated” by all the “new” features, including generics which is not exactly new.

Re:Java’s Cultural Problem by grumpyprole on Monday September 19, 2022 @07:05AM (#32896732)
It's not about just being more expressive. See the Brian Goetz quote. A more "functional style of programming", this means less mutation, more pure functions, e.g. Java's proposed records are immutable.
Re:Java’s Cultural Problem by samus on Monday September 19, 2022 @08:37AM (#32897511)
Minor nitpick: Records have been delivered in Java 16. Java 19 will also include the first preview for Record Patterns.
Re:Java’s Cultural Problem by PaulHoule on Monday September 19, 2022 @09:31AM (#32898053)
In general Java has picked up many features of the ML family of languages such as pattern matching, sealed classes, etc. It is so much fun to write compilers in Java using this stuff.

I code a lot of Python also, and I've been pleased to see pattern matching adding to Python by a process that seemed very similar to that in Java, that is, in both cases the feature was developed gradually with a lot of care to make sure it works well with the rest of the language.

Re:Java’s Cultural Problem by krzyk on Monday September 19, 2022 @07:15AM (#32896817)
No, he shows real issues with Java code base littered with annotations that do "magic".

The example with email validation really hits the homebase really well. Also dependency on old java versions (without records) is really troubling.

Fortunately Spring 6 will depend on JDK 17.

Re:Java’s Cultural Problem by oaiey on Monday September 19, 2022 @09:16AM (#32897881)
Code Annotations are data (code = data). Data which is used in a function (side-effect-free) which validate a record. I do not know how more functional a generic purpose validation function can be.

The problem for people, is that they do not like the place where the function is called and side effects are applied. In your typical Java/C#/... OO framework, this function is called two or three stack frames down into the framework. And here the author's point of Java/C# culture has its point.

Re:Java’s Cultural Problem by josefx on Monday September 19, 2022 @09:17AM (#32897888)
Instead he expects interfaces to do magic. AutoClosable isn't even one of Javas pre annotation marker interfaces and the documentation makes it clear that just because the interface is present doesn't mean that a call to close makes sense.
Re:Java’s Cultural Problem by mike_hearn on Monday September 19, 2022 @08:12AM (#32897251)
Email address validation isn't magic and nor is annotating fields to give more context about what they're meant to contain.

The article author believes everything should be done with types. But Java has always been able to represent an EmailAddress type. It's not like the Quarkus guys don't know about strong static typing! Bean Validation exists because:

1. Every tool knows what a string is. Very few know what your custom email address type is. In theory you can solve this with sub-typing, or duck typing, etc. But in Java the String class is final, so you can't extend from it. This has definitely had big advantages over the years - there's no proliferation of custom utility string types, and new Java versions could optimize the internal representation aggressively. It's not at all clear that Java would be better if String was an open class.

2. Bean Validation lets you validate every field at once and collect the errors together. This is extremely helpful for user interfaces where you want to be able to copy user data into an object, validate it, and then return all the problems to the UI for rendering next to the form. With the type approach he gives you'd get exactly one problem followed by an exception. The user would fix it, re-submit the form or re-execute the tool, and then get the next problem. Painful! Ditto for APIs where you want to de-serialize JSON into objects, validate them all in one go and return a single error response if there are issues.

3. Bean Validation is designed to be applied to both database entity and GUI model (e.g. config) objects, though it can be used for anything. Immutable types are useless for this use case because the database and GUI are both fundamentally about mutable state. The DB layer can generate far more optimized SQL and thus far more optimal DB resource usage if it can record what's changing (which requires some sort of "clever" stateful object), and for the UI you need to be able to hold invalid data somewhere - ideally in your model object, so the user's data can both be held in the model and also trigger validation errors.

4. It can also be used with parameters and return types on methods (with sufficient framework support from your implementation). This lets you add constraints to implementations in an API compatible way. Changing types wouldn't allow for that.

The author should really just read the intro to the Jakarta Bean Validation spec, which lays out the rationale quite clearly:

https://jakarta.ee/specifications/bean-validation/3.0/jakart...

Does anyone worry about whether reading a value out of a config object will launch rockets? No. The type system could express this, but the value of doing so would be very low. It is obvious from context. The reason it uses interfaces is because, if we check the docs:

"Under some circumstances, some data sources may change dynamically. The changed values should be fed into the client without the need for restarting the application"

If you implement config handling in the FP way he wants then a change to any part of the config requires rebuilding the entire object graph representing the entire configuration, and then re-plumbing that all through the rest of your (presumably immutable) set of objects. What you'd intuit should be a very fast operation with little memory overhead can suddenly require re-initializing large chunks of your app. A functional programmer might simply assert that being able to mutate configuration at runtime is a bad feature, but in the real world we do this sort of thing all the time and being able to handle it well is a useful feature of a config library.

The core disagreement here isn't actually anything to do with Java. More or less any imperative language would attract the ire of this author. What he's upset about is the existence of libraries and frameworks designed for mutability. But, mutability is inherent to the world. You can try to manage and constrain it but you can't remove it and sometimes you have to embrace it. That's not "Java culture", it's just life.

Re:Java’s Cultural Problem by pjmlp on Monday September 19, 2022 @07:43AM (#32897020)
The poster child of AOP, I guess that isn't magic.
Re:Java’s Cultural Problem by krzyk on Monday September 19, 2022 @07:45AM (#32897033)
AOP is magic, you don't know what, where and how.

AOP should end at `@Override`, all the rest turns Java into some kind of DSL which makes it unreadable (similar to what some people do to Scala, because it is too easy to make it into a DSL).

Poster child of AOP is logging, you log stuff, don't change the code (e.g. adding validation).

Re:Java’s Cultural Problem by kaba0 on Monday September 19, 2022 @08:25AM (#32897375)
You can’t change code either in Java — annotation processors are explicitly unable to do that — Spring’s magic works through loading new classes up that either implement the same static interface you use, or extending the class, and injecting this new proxy instead.

In short, if you want to log certain methods at enter and exit time with AOP (not manually adding it everywhere), you just create a proxy object and do a logEnter(); targetedObj.method(); logExit();

That’s why some people dislike Lombok as that actually changes byte code at compile time.

Re:Java’s Cultural Problem by samus on Monday September 19, 2022 @08:40AM (#32897544)
The bytecode format is well-documented. If Lombok would just augment these, then there would be no major problem with it. But it actually does something worse: it uses reflection and other tricks to extend the Abstract Syntax Tree, which is purely an implementation detail of the Java compiler. And it must do the same with every tool that touches Java Sources.
Re:Java’s Cultural Problem by zaptheimpaler on Monday September 19, 2022 @09:23AM (#32897968)
He is the author of Monix, a great concurrency library in Scala and many other OSS contributions. Personally I think it's one of the best libraries ever. It actually exemplifies a very pragmatic mix of OOP and FP that decidedly leans away from trying to recreate Haskell unlike a lot of other Scala libs.
Re:Java’s Cultural Problem by nogridbag on Monday September 19, 2022 @11:22AM (#32899589)
We're about 1 year into development of a Quarkus application and I'm still a big fan. The fast startup and hot-reloading are amazing for rapidly iterating. Most importantly, it's really easy to reach a Quarkus developer if you have any questions. They also have a YouTube series "Quarkus Insights" and they do live stream events where you can ask questions.

It's true the documentation initially feels a bit lacking for the Getting Started scenario. But now I really appreciate the Guide format (essentially How-To's). Whenever I need to accomplish something, there's a guide for it.

With that said yes I still wish there was less magic in the Java ecosystem. Some years ago I toyed with Clojure a bit and I had some issue related to sessions with the popular Ring HTTP library. I viewed the source code on Github and was amazed that it was all vanilla Clojure. And even for a novice Clojure dev it was written in such a basic style I immediately understood how the whole library worked and found the solution to my problem.

Re:Java’s Cultural Problem by _old_dude_ on Monday September 19, 2022 @10:58AM (#32899233)
And Quarkus / microprofile API offers a programmatic API, ConfigProvider.getConfig()

see https://quarkus.io/guides/config-reference

Re:Java’s Cultural Problem by RockingGoodNite on Monday September 19, 2022 @09:19AM (#32897910)
Agreed, mostly a Quarkus is best post. Spring Boot and no functional programming are where Java and enterprises succeed in my view.
Re:Java’s Cultural Problem by willsmith72 on Monday September 19, 2022 @06:52AM (#32896648)
Exactly. They didn't even look for other frameworks either. If you want something that looks less like Spring, you could at least try out one of the kotlin frameworks like ktor, which is still totally accessible for java developers.
Re:Java’s Cultural Problem by Nullabillity on Monday September 19, 2022 @07:35AM (#32896964)
Alexandru is the author of Monix and a major contributor to cats-effect.

This seems like an investigation into "How does typical Java code look?", not "What's the best possible way you could write this on the JVM?".