33 ms·
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 belie
by grumpyprole 4y ago
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/003877.html https://mail.openjdk.org/pipermail/lambda-dev/2011-August/00...
- fedeb95 4y agoWhat 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...
- grumpyprole 4y agoYes 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.
- kaba0 4y agoI 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.
- BlargMcLarg 4y agoWhere are you drawing that conclusion from? Java has an immense legacy to draw talented developers from. Is it really Java itself, or its legacy?
- fedeb95 4y agoIf 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?
- BlargMcLarg 4y agoThe 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.
- fedeb95 4y agoGo 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.
- Retric 4y agoThat comment is pointless, if you want to raise the level of discourse actually provide some evidence rather than simply request it from others.
- fedeb95 4y agoI didn't make the original post, so while your answer is legit, it goes back to the original poster
- Retric 4y agoI don’t see them asking for studies etc?
- fedeb95 4y agoNonetheless 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
- Retric 4y agoAnd 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.
- pards 4y ago> 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
- Retric 4y agoThe 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.
- RHSeeger 4y ago> 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?
- PaulHoule 4y agoI'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.
- throw_m239339 4y agoJava 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.
- grumpyprole 4y agoIt'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.
- samus 4y agoMinor nitpick: Records have been delivered in Java 16. Java 19 will also include the first preview for Record Patterns.
- PaulHoule 4y agoIn 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.
- kaba0 4y agoMost 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.
- p1necone 4y agoYou 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.
- grumpyprole 4y ago> 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.
- Ma8ee 4y agoYou get quite far with the "final" keyword.
- PaulHoule 4y agoActually 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.
- jstimpfle 4y agoThis 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.
- the_af 4y agoThe recent interview with Lex Fridman seems to indicate Carmack hasn't backpedaled at all.
- jstimpfle 4y agoCan 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.
- the_af 4y agoScheme and Haskell are not the central point. Carmack mentions he still appreciates FP lessons when writing C code.
- jstimpfle 4y agoHe 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.
- the_af 4y agoWell, 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!
- UncleMeat 4y ago"Encouraging a more functional style of programming" and "screaming as soon as you see an abstract class" are two different things.
- pragmatic 4y agoThis 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.
- PaulHoule 4y agoThe 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.”
- agumonkey 4y agoml is basically java with implicit BiFunction import /s
- Jtsummers 4y ago> 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.