Earlier quoted context omitted.
From your repo: Respectfully, I disagree that checked exceptions are a misfeature. Java’s implementation definitely leaves a lot to be desired (inheritance doesn’t make sense for them), but otherwise checked exceptions are a better form of Result types.
Unchecked exceptions are the better version of Result type. The problem with checked exceptions is that methods throwing them force its callers to react to the even if they are irrelevant to them. In 99% of cases I don't have any JSON specific error handling, yet Jackson forces me to do a try-catch-rethrow ceremony in thpse 99% to declare I don't want to do anything specific.
Ask HN: What are some of the most elegant codebases in your favorite language?
171–180 of 186 posts
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#172Earlier quoted context omitted.
What's wrong with it?
It completely ignores the simple UI paradigm of tabs or a sidebar. You should be able to move between repos without blowing away whatever you're in the middle of. I'm forced to be in one at all times, and I can't manage multiple repos at once via a simple sidebar. It's like it takes all of the inherent arcane complexity of Git and creates a UI that is so barebones it almost mocks you for deigning to ask for a GUI.
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#173I'd nominate Java itself. In the decades Java sources have been available, any of the kazillion junior programmers could debug-step into java.* and see exactly what's happening -- progressive disclosure at its finest for building expertise. Most other languages have a hard boundary, so the roots of language are a matter of conceptual documentation and experience. Java also offers that fly-over knowledge, but when pro…
While I think there's a lot to love about Java, the standard library itself is not an especially great role model. Most of it was written a long time ago and has a fairly antiquated style - lots of mutable state, nullability, and checked exceptions. Not that the library isn't an incredible asset - it's luxuriously rich compared to working in Node.js - but if it were written from scratch today, I suspect it would look…
Comment for a method says "null safe" - why not use an annotation?
A package called "util" is a code smell for me.
UrlUtils only provides two methods for URL encoding so why not name it appropriately?
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#174Earlier quoted context omitted.
As an end user though, I honestly can’t think of any Java software I actually enjoy using. Minecraft? That’s literally the only thing that comes to mind.
I think you just don’t realize when a given software is Java. I personally really like intellij, one might say it is “bloated” (though I hate that word), but that’s only because of indexing everything, not due to java itself. On the server front many cloud infrastructures themselves, apple servers, pretty much every top 500 company has some form of business critical infrastructure chugging along on top of the JVM hap…
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#175Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#176Go and it’s standard library. ‘Elegant’ is pretty subjective, but it’s a treasure trove of learning how things work under the hood. I’ve learned loads about networking, compression, encryption and more by browsing through it, because the code is super easy to read and understand.
I find the Golang standard library code annoying to read and understand because of their use of single letter variables or very short abbreviations. I know some people like this but I don’t.
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#177Earlier quoted context omitted.
While I think there's a lot to love about Java, the standard library itself is not an especially great role model. Most of it was written a long time ago and has a fairly antiquated style - lots of mutable state, nullability, and checked exceptions. Not that the library isn't an incredible asset - it's luxuriously rich compared to working in Node.js - but if it were written from scratch today, I suspect it would look…
I only looked over your code for a minute but found some stuff I would comment on in a code review. Comment for a method says "null safe" - why not use an annotation? A package called "util" is a code smell for me. UrlUtils only provides two methods for URL encoding so why not name it appropriately?
How would you refactor this to avoid a util package or a UrlUtils class?
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#178Earlier quoted context omitted.
As an end user though, I honestly can’t think of any Java software I actually enjoy using. Minecraft? That’s literally the only thing that comes to mind.
Android apps are full of Java.
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#179Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#180Earlier quoted context omitted.
After a decade of programming 50+ hours a week in many languages (typescript, javascript, python, scala, java, lua, bash, c++, etc), I have come to the conclusion that Java is simply the best. The tooling, libraries, stability, verbose rigidity. It forces a style of programming that simply scales to more engineers better
As an end user though, I honestly can’t think of any Java software I actually enjoy using. Minecraft? That’s literally the only thing that comes to mind.
I can attest that AWT and Swing were hot garbage 20 years ago, though. The cross-platform aspect worked great, but the algorithms weren't worth making cross-platform to begin with. It was basically a giant GUI ecosystem written by people with no understanding of how to implement graphics efficiently. My favorite was how they bragged about their "lightweight" visual components that don't require OS-level window objects. Except, OS window objects are part of an algorithm that tracks exposure regions and repaints it efficiently without needing to redraw the whole screen. Swing took the approach of repainting the entire application window in a back-buffer on every visual change and then copying that up to the entire application window area, even for things as small as tooltip pop-ups or menus.
I haven't checked which GUI framework DBeaver is using. I suppose it's possible that it is Swing and my workstation is just so fast these days that the inefficiency doesn't matter.