TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java’s Cultural Problem

226 pointsby madmax108over 2 years ago

49 comments

bluejekyllover 2 years ago
I agree so much with this article. Java EE practices bloat programs, waste memory, and make debugging harder. Let alone all the language constructs.<p>&gt; Java allows null objects… that ship has sailed<p>Not necessarily, with project Valhalla, it should be possible to have generic Value Types in the language that would allow things like Optional to be defined on the stack where it would be non-null and then all it’s methods for checking if the Object it references would make sense, and actually work. This would be in contrast to today where the Optional type isn’t as useful as it seems since it can also be null.<p>Anyone know the status of this? <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Project_Valhalla_(Java_language)" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Project_Valhalla_(Java_langu...</a>
评论 #32896693 未加载
评论 #32896668 未加载
评论 #32899261 未加载
ilitiritover 2 years ago
Reading these comments, it&#x27;s strange to see that the &quot;Java&quot; paradigm&#x2F;context issue still exists after all these years.<p>I have never had significant problems with Java-the-language. But, like with many other programming languages out there, you can&#x27;t really dissociate the language from the environment and everything that goes with it. The paradigms, VMs, IDEs, patterns and practices etc etc.<p>And for the record it&#x27;s not just Java (it just seems to be more <i>pronounced</i> in the Java-development ecosystem). For every person who waxes lyrical about the joy of working with C# (for example), there are 3 more that will tell you anecdotes about &quot;assembly hell&quot;. Or how Visual Studio is slow and a massive memory hog. Or that there is no proper Forms support on XYZ-os.<p>Those are all fair points, but more often than not, they have little-to-nothing to do with current discussion. IMO, I think it&#x27;s usually far more productive to try to understand the discussion <i>in context</i> than to veer off into irrelevant semantic issues or tangential anecdotes.
评论 #32899675 未加载
评论 #32901861 未加载
评论 #32897333 未加载
评论 #32896778 未加载
vbezhenarover 2 years ago
I really don&#x27;t like Quarkus approach. It&#x27;s full of magic. It&#x27;s everything I&#x27;d love to get rid of. I&#x27;m using Spring which is kind of full of magic but I spent 15 years learning to deal with this magic, so it&#x27;s bearable to me. But it does not mean that I like it.<p>I liked Helidon SE approach (not MP, MP is the same EE crap). It&#x27;s 100% code, no magic. What I didn&#x27;t like is reactive, I don&#x27;t need reactive, so I don&#x27;t use Helidon SE for my projects, I still endure Spring. But if someone enjoys reactive programming and wants zero-magic approach, I can recommend it.<p>Helidon Nima might be a saviour to me. I didn&#x27;t research it yet.
评论 #32898473 未加载
评论 #32898799 未加载
评论 #32898275 未加载
评论 #32897957 未加载
tofflosover 2 years ago
I like SmallRye Config and I feel it&#x27;s designed this way because of the problems it tries to solve. The following is an excerpt from the MicroProfile Config standard which SmallRye Config is an implementation of:<p>&gt; The majority of applications need to be configured based on a running environment. It must be possible to modify configuration data from outside an application so that the application itself does not need to be repackaged.<p>&gt; The configuration data can come from different locations and in different formats (e.g. system properties, system environment variables, .properties, .xml, datasource). We call these config locations ConfigSources. If the same property is defined in multiple ConfigSources, we apply a policy to specify which one of the values will effectively be used.<p>&gt; 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. This requirement is particularly important for microservices running in a cloud environment. The MicroProfile Config approach allows to pick up configured values immediately after they got changed.<p>One reason we don&#x27;t know whether SmallRye Config is reading from a file or querying a database at development time is because that choice has been deferred to the system administrator at deployment time.<p>Records are immutable. If we want to be able to reconfigure applications at runtime it might make sense to use a mutable data structure.<p>You can load configuration programmatically if don&#x27;t want to use dependency injection and&#x2F;or want something that is easier to test. See <a href="https:&#x2F;&#x2F;download.eclipse.org&#x2F;microprofile&#x2F;microprofile-config-2.0&#x2F;microprofile-config-spec-2.0.html#_simple_programmatic_example" rel="nofollow">https:&#x2F;&#x2F;download.eclipse.org&#x2F;microprofile&#x2F;microprofile-confi...</a>.
评论 #32897123 未加载
评论 #32896886 未加载
ragneseover 2 years ago
I agree. Java has improved as a language quite a bit in recent years. And I don&#x27;t even mean that in a &quot;Java has followed the cargo cult of what&#x27;s fashionable in programming languages&quot;-sense. I mean that things like Records to define value types have &quot;always&quot; been desired in Java- at least in the 10 years that I&#x27;ve worked with people on Java code. If Java didn&#x27;t automatically make everything equatable&#x2F;hashable, it would be a different story.<p>Anyway, Java still has baggage that I doubt will go away any time soon. My biggest two complaints with Java are that null exists outside of the type system and that they mix runtime type reflection and non-reified generics. The latter features being actually incompatible with each other makes working with Java libraries&#x2F;frameworks a minefield.<p>But, aside from those issues, the OP is totally right that so much of Java&#x27;s bad reputation comes purely from library design and culture. Even when I preferred OOP architectures, I hated the fact that so many Java libraries and frameworks required a bunch of annotations for everything, even when it really wasn&#x27;t necessary. I get that Java code can be verbose, but if you don&#x27;t like it, use something else- don&#x27;t just throw away compile time safety and information for a janky runtime-checked &quot;DSL&quot; where a bunch of the features don&#x27;t even actually work together (I&#x27;m mostly looking at you, JacksonXML, but also Spring, et al).<p>Everyone praises the Java ecosystem as some kind of selling point, but I find that while the ecosystem is indeed <i>broad</i>, the actual quality and productivity of many of the popular libraries and frameworks is fairly low. And by &quot;quality&quot;, I don&#x27;t necessarily mean number of open bug reports, I mostly mean that the APIs are really difficult to understand and use correctly. In some sense the devs are &quot;off the hook&quot; when my app doesn&#x27;t work correctly because &quot;this is documented behavior&quot;, but that makes me think I should just start writing documentation for my apps&#x27; bugs and seeing what my boss thinks... ;)
评论 #32907101 未加载
nilsbover 2 years ago
Is it just me or is understanding those examples virtually impossible if you&#x27;re not intimately familiar with that particular framework? Then again... I guess that&#x27;s the author&#x27;s point.
评论 #32896974 未加载
评论 #32896473 未加载
评论 #32896647 未加载
strictfpover 2 years ago
This is why I left Java. Everything &quot;looks nice&quot; on the surface with annotations, but you loose the flexibility of code and a lot of the available tooling. Plus you need to be a real expert to debug issues and solve problems; understand framework architecture and read reflection code. You can&#x27;t just put a breakpoint in there and start debugging. It&#x27;s optimizing for the wrong thing.<p>The bad news is; this culture is permeating somewhat into Rust now that more Java devs are moving over.<p>This whole attitude is IBMs fault. They tried to get into the Java market by applying their big iron terminal thinking to create Java EE.<p>Java under Suns management was a lot more like golang today; pragmatism, fewer language features, and focus on writing code.
评论 #32897047 未加载
评论 #32897308 未加载
评论 #32897751 未加载
评论 #32898079 未加载
评论 #32896880 未加载
ncmncmover 2 years ago
&quot;I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product.&quot; — <i>Mark Dominus</i><p><a href="https:&#x2F;&#x2F;blog.plover.com&#x2F;prog&#x2F;Java.html" rel="nofollow">https:&#x2F;&#x2F;blog.plover.com&#x2F;prog&#x2F;Java.html</a>
评论 #32897201 未加载
评论 #32897253 未加载
throwaway4goodover 2 years ago
Can we maybe also talk about FP’s cultural problem: that lots of people with a functional programming background just don’t get object orientated programming and instead of trying to understand it, dismiss it as crap and enterprisey.
评论 #32897378 未加载
评论 #32898025 未加载
评论 #32897091 未加载
评论 #32903835 未加载
didipover 2 years ago
I agree with the general sentiment of the article.<p>It is clearly possible to write a straight forward Java code. See: Sparkjava, Javalin, or Vert.x. Hell, even Minecraft Java code is pretty easy to read.<p>Too bad Java culture is dominated by consultancy-like culture, which promotes as many obfuscation as possible.<p>The world will not end if you don’t use annotations and DI frameworks.
thriftwyover 2 years ago
&gt; Any FP developer should scream when seeing this<p>It would be an interesting observation in 2007, but fifteen years later with no industrial success of Haskell-inspired pure FP approach, I don&#x27;t see why we should listen to &quot;any FP developer&quot; criticisms.<p>It&#x27;s not that I have anything against FP - let&#x27;s just admit that side-effect pure FP is a &quot;futuretro&quot; of today. A future that never was.
评论 #32896528 未加载
评论 #32896626 未加载
评论 #32896762 未加载
HiIAmIlNanoover 2 years ago
The author is using field injection and claiming that the field cannot be private. As far as I know he should be using constructor dependency injection and make the field private and final. That way is also easier to write unit tests and maybe make use of interfaces in case he wants to avoid using a mocking framework.<p>Not only that but if I recall correctly quarkus resolves dependencies and config files at compile time and not at runtime using reflection as spring does.
评论 #32904683 未加载
tannhaeuserover 2 years ago
It must be said that this coding style may be the norm with Quarkus (and with Spring which it is trying to replace on graalvm&#x2F;native-image), but isn&#x27;t required by Java itself. As always, Spring-like Java buerocrats have chosen to chase and over-engineer trivialities because it&#x27;s so much easier lol; well until using your framework becomes a study in psychology or software archeology.<p>Update: what I don&#x27;t get with Quarkus though is why did they set out in Spring factory style only to have to immediately limit this for native-image&#x27;s &quot;closed world assumption&quot;
评论 #32897348 未加载
tomerbdover 2 years ago
I&#x27;ll take java any day for server side, I don&#x27;t know why but when I use java things just tend to be much more stable and It does not take me more time to write code at all.
m3047over 2 years ago
I haven&#x27;t programmed in Java in many years, except for making DAGs for Storm and a authorization metalibrary that none of the &quot;real&quot; Java programmers liked. Paradoxically the most sccinct statement of dislike concerned my choice of arraylike class: &quot;THAT&#x27;S WRONG!&quot;. The Java programmers had source control, just like the rest of us. But their Maven configs weren&#x27;t under source control, and they wouldn&#x27;t help the rest of us with ours. I&#x27;ve concluded that I&#x27;m indifferent to Java, but not so good with Java programmers.<p>There&#x27;s a big ball of puzzling contradictions in the above.<p>Have you heard of Lacan or Zizek? Well. Poetically speaking, I&#x27;ll paraphrase Tom Lehrer and opine that &quot;Java programmers must feel like a Christian Scientist with appendicitis&quot;. In my opinion: remember that.<p>They&#x27;ve build a lot of ritual around notions of control and deliberativeness (that array problem). They&#x27;re Catholic or Orthodox, really. The JVM is supposed to be &quot;safe&quot;, and I have to ask: does the communion wine really turn to the blood of Christ?<p>My father was a psychiatrist. I am well aware that Dr. Tim Leary was a pioneer in personality diagnosis, having found &quot;The Interpersonal Diagnosis of Personality&quot; on my father&#x27;s bookshelf. I analyzed precinct level voting patterns, and they exist; but the question &quot;is it something in the water, or new car smell?&quot; remains vexing and unsolved.<p>There is something that happens when people program in different languages with different tools, especially in groups. It&#x27;s not just languages: how does Docker culture compare to NanoVMs on the Leary radar chart?<p>But what I have for you is a (hopefully) playful personality diagnosis of some of the major programming languages. Make some popcorn. This is for entertainment purposes, but maybe it&#x27;ll give you something to think about.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=mZyvIHYn2zk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=mZyvIHYn2zk</a>
评论 #32902920 未加载
fedeb95over 2 years ago
Java doesn&#x27;t have a cultural problem. People need to understand that Java culture is almost entirely enterprise culture. Don&#x27;t want a language influenced by that for your project? There are plenty out there, pick one
评论 #32896602 未加载
评论 #32896907 未加载
zcw100over 2 years ago
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.<p>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.
评论 #32896592 未加载
评论 #32896817 未加载
评论 #32897968 未加载
评论 #32899589 未加载
评论 #32898229 未加载
评论 #32897116 未加载
评论 #32899233 未加载
评论 #32897910 未加载
评论 #32896648 未加载
dmitriidover 2 years ago
Java is fine. Java frameworks are not.<p>I&#x27;m still waiting for ASP.Net-like framework in Java where all configs are explicit and the framework doesn&#x27;t require hundreds of confusing annotations just to display a hello world page.
评论 #32897232 未加载
评论 #32896617 未加载
评论 #32896736 未加载
评论 #32897062 未加载
评论 #32896683 未加载
tannhaeuserover 2 years ago
<a href="https:&#x2F;&#x2F;github.com&#x2F;Hello-World-EE&#x2F;Java-Hello-World-Enterprise-Edition" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Hello-World-EE&#x2F;Java-Hello-World-Enterpris...</a>
评论 #32896582 未加载
评论 #32896555 未加载
exabrialover 2 years ago
This is a dumb rant about something the author doesn&#x27;t know anything about and hasn&#x27;t bothered to understand or research.<p>Dependency Injection is not functional programming. Dependency Injection solves a lot of problems and entire classes of bugs around application state, but with far more approachable stepping stones than something like pure functional languages.<p>Pure functional languages solve state problems as well but are far more complicated and difficult to grok because of the paradigm shift.<p>Whatever one chooses for a team of developers, the most important thing is being able to use the tools at hand. It&#x27;s pretty easy to explain to someone what Scope is and how CDI has some standard scopes.<p>The author doesn&#x27;t even seem to understand how Java annotations even work.
nerdponxover 2 years ago
I found this interesting because the ConfigMapping stuff reminds me a lot of Python. I knew that Python OO was inspired by Java OO to some extent, but I didn&#x27;t expect so much similarity.<p>I think Python could learn similar lessons here. But the flipside is that none of this stuff is a catastrophe in Python either, and the author&#x27;s tone seems a bit out of proportion with what they&#x27;re complaining about.<p>The author complains about:<p>1) not knowing the underlying data model and implementation details that might affect their design<p>2) mutable attributes and non-final classes<p>3) lack of obvious composition root<p>In the Python world, we often say that &quot;we are all consenting adults here&quot;.<p>Usually there is no need for private, immutable, or final things because people read docs know not to stray from the public interface. The trust also runs the other way, and it&#x27;s very rare for the function to perform some kind of weird unexpected mutation. A function that mutates a user-provided object without the user&#x27;s knowledge or consent is usually considered a bug. I actually found exactly this bug recently in a framework I was using, and several people were up in arms about it on the issue tracker. Yes, immutable data makes it harder&#x2F;impossible to write such bugs. But the community generally has not devolved into a Satanic orgy of mutable state.<p>Likewise, if a framework did something ridiculous like reloading a config file at every request, nobody would use it! I could only imagine how lively that GitHub issue thread would be. A framework that makes fundamentally bad design decisions tends not to be a lasting part of the community.<p>The only one that really would suck, and that also doesn&#x27;t seem to be a problem in Python, is the lack of an obvious composition root. I have never heard this term before, but it is a very very well-established pattern in Python application and library architecture. A framework that made it hard to design libraries in a conventional sensible way, would not be a very popular framework.
评论 #32897561 未加载
StrLghtover 2 years ago
What a stretch from a single badly designed (in author&#x27;s opinion) framework to &quot;cultural problem&quot;
LAC-Techover 2 years ago
Halfway through reading - is this just another episode of &quot;FP Programmers Don&#x27;t Understand Other Paradigms?&quot;<p>Because honestly at this point I&#x27;m pretty much all caught up on that.
p2detarover 2 years ago
What does one do to land a Java job when neither Spring, nor Quarkus experience is present?<p>Backstory: I have been using Java SE for more than a decade now. Currently building a Java 17 pure Vert.x project. I&#x27;m quite seasoned with the language, but not with large frameworks like Spring. I don&#x27;t have any desire to learn Spring. Quarkus seems like a good choice on the first look, but I&#x27;m also looking for other options.<p>Hints anyone?
jononomoover 2 years ago
I quit software altogether after programming in Java for about 7 years and decided I never wanted to program again. Then, a few years later, I discovered Python and jumped back in with delight. Now I have discovered Elixir and I&#x27;m super happy. But to this day I can&#x27;t even look at Java code without that dying-inside feeling.
andorover 2 years ago
The equivalent Spring @ConfigurationProperties annotation supports records.<p>Spring also requires fewer annotations overall and none of the CDI ones.
评论 #32897069 未加载
exabrialover 2 years ago
I find the Java 17&#x2F;Good IDE quite nice. Most of all the complaints have been resolved with the language, and it’s still faster than every other memory safe language (except Rust, which smokes everyone)
moondownerover 2 years ago
&quot;Java is good by modern standards, from a technical perspective, the platform having received a lot of improvements from Java 8 to 17. Unfortunately, it still stinks, and the problem is its &quot;enterprise&quot; culture.&quot;<p>Then the author rants about a specific Java-based framework and does not mention anything about the use of Java in the enterprise or any supposed cultural problems it may have.
评论 #32898616 未加载
ris58hover 2 years ago
Shouldn&#x27;t the title be &quot;Java EE&#x27;s Cultural Problem&quot;?
评论 #32896561 未加载
评论 #32897985 未加载
winnie_uaover 2 years ago
I don&#x27;t get, why author is bitching about validation.<p>What&#x27;s the point in referencing article about Haskell, if Java don&#x27;t have such parsing libraries.<p>I&#x27;ve also saw that article translated to Rust, but it ended being article, not library. And many questions of how to represent valid state remained unanswered.<p>And example provided, with throwing exception in constructor: that approach would just throw single error, but javax.validation approach allows to return list with ALL failed validations, so client don&#x27;t have to fix errors one at a time and retrying to see next error.<p>Small complain from me: EmailAddress class is not zero cost(unless java would have value types), but actually java devs do not care about this.
eastboundover 2 years ago
Shall we definitively say that a problem of all languages is that they evolve to the maximum complexity that a single brain can understand, then they collapse because nobody understands them?<p>All languages start with “Lightweight, lightening fast and hotreloadable!”, then become a gas plant as they need abstractions to handle industry concerns (hello Reflection API, javaagents, NIO, functional programming, now the Cloud, then AI),<p>Are there intrinsic properties a language can have that prevents bloating to the maximum complexity a human can handle, and yet allows it to handle industry usecases?
评论 #32897057 未加载
评论 #32897252 未加载
jcon321over 2 years ago
You don&#x27;t have to follow a framework explicitly to have success. You can use vanilla components of a framework and then treat the entire application more functional esque. The author&#x27;s examples are just so overboard. Annotations on fields to represent validation is valid and I see it all over JavaEE, but I&#x27;ve never thought of as my &quot;go to&quot;. (Or else you are then locked in to how to represent return values, relaying messages, entry points).<p>Live by the framework, don&#x27;t die by the framework.
sorokodover 2 years ago
&quot;I don’t care from where the configuration is being read&quot;<p>This hints at a junior developer. Once you have configurations depending on environment or geography you&#x27;d care a lot.
yotamoronover 2 years ago
So you think there&#x27;s some magical language, where things will never become complicated, syntax will always make simple sense and no developer can f** things up?<p>Think again. No such thing. Java is a tool, and like every other tool - you have to know how to use it if you want to get the best results from it.<p>When used by the right developer, Java can yield beautiful, concise and clear code. When used by the wrong developer... well...
flakinessover 2 years ago
This thread makes me smile as an Android programmer.<p>Android doesn&#x27;t have the cultural problem discussed here, but it has its own set of problems (mostly rooted to the poor platform API design). It&#x27;s so contrastive. Which do you like?
Nimitz14over 2 years ago
I&#x27;m worried about python also going in this direction. I see so many repos with the @property decorator <i>everywhere</i> for not a single good reason!
bullenover 2 years ago
It&#x27;s not culture, it&#x27;s the fact that Java enables huge structures to run that has become it&#x27;s problem. Listen to James in the last chapters of this interview: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=IT__Nrr3PNI" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=IT__Nrr3PNI</a><p>Just because Java can run bloated is not a good reason to do so. I have written my own HTTP&#x2F;DNS server with built in DB from scratch and it&#x27;s 150KB (around 10.000 LoC) and that&#x27;s how you use Java properly.
评论 #32897234 未加载
unwindover 2 years ago
I was going to post a comment about the regex used to (coarsely) validate email addresses made no sense, but when I opened the article in a new tab to copy for quoting, it had changed. :)<p>It&#x27;s now<p><pre><code> &quot;^[^@\\s]+@\\S+$&quot; </code></pre> with a comment also stating that it could be better. That&#x27;s at least sensible, the original one that I first saw was more or less &quot;^[^@]@.*&quot; which kind of makes no sense. Oh well, great that the author caught it, of course.
评论 #32897122 未加载
ciesover 2 years ago
That&#x27;s why there&#x27;s Kotlin, by JetBrains, who also make a framework name KTor.
axilmarover 2 years ago
I couldn&#x27;t agree more. I currently work on a web application that uses Spring Boot and Vaadin and it sucks a million miles. Spring sucks separately from Vaadin, which sucks another million miles.<p>The whole thing with beans and annotations is an abomination and whoever thought of it should be shot (not literally, for crying out loud!).
kache_over 2 years ago
Over abstraction is the devil :)
jeroenhdover 2 years ago
I strongly dislike working with most Java frameworks because I disagree with many of their design decisions (and type erasure keeps finding ways to bite me in the ass) but I accept that when I use Java, I need to comply with its expectations and work with the ecosystem.<p>This reads like a functional developer who believes that functional programming is The Only Right Way to program anything trying to shoehorn functional programming into a framework that&#x27;s decidedly not functional. Sorry, but that doesn&#x27;t make sense.<p>I agree with some parts of this; the lack of proper nullability in the type system is very annoying especially once you&#x27;ve worked with more modern languages. The conflict between recommending the use of `final` and major libraries being incompatible with such use is also quite jarring (though there are alternatives). However, statements like<p>&gt; This should be a pure data structure;<p>go unexplained, assuming that &quot;every FP developer&quot; should know this for an absolute truth because... why, exactly? I can easily see these methods have side effects because they read configuration files, for example. Hard-coding IP and port in the Java files is a terrible idea. Sure, the record based abstraction is nicer, but records are not supported for a large part of the JVM ecosystem because upgrading Java versions is slow and painful for larger applications.<p>I also don&#x27;t understand this &quot;annotations are bad&quot; argument. Yes, some annotations should be built into the type system (and there are projects to accomplish this!) but what&#x27;s wrong with @NotEmpty? Furthermore, the email address solution uses Objects.requireNonNull(value) without any annotations, making it difficult if not impossible for IDEs and static code analyzers to determine the nullability of this field. It also throws exceptions without any indication that the constructor can fail (I know many Java developers don&#x27;t like the `throws` keyword but if you&#x27;re going ham on code style and semantic programming, at least be clear what can and cannot fail).<p>Java is not a functional programming language and the ecosystem even less so. It&#x27;s an imperative language with functional aspects inserted to make your life easier. Projecting functional paradigms onto it is impractical at least, or maybe even just plain wrong; it&#x27;s the wrong tool for the job.<p>I personally find many of Kotlin&#x27;s paradigms get much closer to the functional programming paradigm than Java, especially with the new libraries and frameworks that make use of Kotlin&#x27;s language features. Kotlin is as imperative as Java but it&#x27;s val&#x2F;var system combined with (data) classes compiling to &quot;normal&quot; Java classes make it an excellent candidate for immutability constraints, stricter types, and other such annotation replacement language design. As an added bonus, the language works quite well together with most Java libraries.
cletusover 2 years ago
&gt; Java has null in it, all object references can be null, and it’s too late for that to change.<p>At Facebook I used Hack, which is a fork of PHP. They&#x27;ve spent a ton of time on the type system to the point where I&#x27;d argue it&#x27;s very good. One of the best things is that nullability is built into the type system so for:<p><pre><code> vec&lt;?string&gt; $a; &#x2F;&#x2F; alows nulls vec&lt;string&gt; $b; &#x2F;&#x2F; does not allow nulls function foo(string $s) {... } </code></pre> you get:<p><pre><code> $a = $b; &#x2F;&#x2F; this is OK $b = $a; &#x2F;&#x2F; error $b = Vec\filter_nulls($a); &#x2F;&#x2F; OK foo($a[1]); &#x2F;&#x2F; OK foo($b[1]); &#x2F;&#x2F; error if ($b[1] is nonnull) { func($b[1]); &#x2F;&#x2F; in this block the type is &#x27;string&#x27; so this is OK } func($b[1] as string); &#x2F;&#x2F; OK but throws a runtime error if it&#x27;s null </code></pre> I was surprised just how useful these seantics are and how many errors could be avoided this way in annotated code (there are an ever-dwindling number of corners of the FB code base that aren&#x27;t property typed).<p>Like Java, this operates on type erasure at runtime so there are limits to the protection. I hope other languages with less advanced type systems (and I include Java when I say that) adopt nullability as a first class type concept.<p>There&#x27;s a lot of talk here about dependency injection. This was a big innovation in Java 20+ years ago. For some reason no other language seems to collectively wring its hand about DI quite like Java does.<p>Java does suffer from a lack of duck typing, hence all these typically one use interfaces get created. It also has other issues (eg you can&#x27;t make your own class that&#x27;ll be a snap--in string replacement). Guice I consider to be a form of torture.<p>Maybe it&#x27;s time Java decides to stop rigidly solving a prroblem no one else seems to have. Maybe that part of a cultural problem.<p>As for the &quot;enterprise&quot; problem, is that specific to J2EE? Is that still a thing? Or is just the consequences of the patterns J2EE promoted that still propagate (eg rigid DI)?<p>It&#x27;s generally better to have some structure rather than none, even if it&#x27;s a bad structure. Maybe I just don&#x27;t travel in the circles where you see a lot of bad Java enterprise code?<p>Java has warts but the runtime maturity in particular is still world-class. I wish Google had bought Sun back in the day (I bet Google does too given the costs and consequences of the lawsuits) but Java continues to plod along and get better without getting massively complicated (I&#x27;m looking at you C++) so it all seems mostly fine.
评论 #32906804 未加载
评论 #32898582 未加载
democracyover 2 years ago
Sorry, it is not worth reading and analyzing. You can come up with a lot of criticism about Java (just as about any other technology) but the content is just too shallow.
sonicgear1over 2 years ago
Let&#x27;s just agree that java is trash.
ACV001over 2 years ago
It shows lack of java knowledge and understanding of OOP. Rants about Java, but talks mostly about Quarkus.
评论 #32897389 未加载
cruunchMuncherover 2 years ago
You need to educate yourself and learn Java better
评论 #32896598 未加载
评论 #32896475 未加载
quickthrower2over 2 years ago
No idea why I thought this was going to be about the Indonesian island. But I did!
javajoshover 2 years ago
The author shows good taste referencing Dropwizard. Then shows deep (even dangerous) inexperience with his email type. So while I encourage writing like this, and I especially like the exercise of considering all the different ways configuration can make it into an application, I don&#x27;t think this piece would be worth referencing in, say, a work argument.
评论 #32898671 未加载
评论 #32897284 未加载