Live data from Hacker News

Ask HN: What are some of the most elegant codebases in your favorite language?

news.ycombinator.com

151–160 of 186 posts

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#151
post #78

I'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…

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

Java doesn’t enforce any particular style. I’ve seen extremely procedural code that is full of statics where it’s obvious the authors were attempting to write C in Java. I’ve seen all manner of attempts at OOP where classes were meticulously restricted to nouns and the opposite where every class was a Service/Verb. Of late I’ve seen Java server side code that’s drank the reactive kool aid and done it’s level best to recreate NodeJS in Java.

Now, your assertion about scaling to more engineers may be true but I’d argue tooling is the main reason for this because Java certainly doesn’t enforce any particular style of programming.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#154
post #114

Earlier 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.

Android apps are full of Java.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#155
post #135

Earlier quoted context omitted.

I have. Maybe I don’t have enough RAM for it, but I find their IDEs to be slow and laggy. Xcode and Visual Studio Code feel so much snappier on the same machine.

Take some time to learn the navigation and refactoring abilities of the JetBrains family. It is IMHO unmatched by most. Using almost any other IDE feels like a downgrade, especially on large codebases with complex dependencies. Beyond Java, they have excellent support for Python, C#, Go, Javascript, and more. The engine builds a deep understanding of your code, which can make ctrl-space to suggest a method on an obje…

Used JetBrains for more than 10 years, but got tired of it lagging all the time and using so much memory (even on M1 Pro with 32GB RAM, even on small projects). So I switched to VSCode for everything except Java. And I’m not a person who is easily annoyed I would say.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#156
post #155
post #135

Earlier quoted context omitted.

Take some time to learn the navigation and refactoring abilities of the JetBrains family. It is IMHO unmatched by most. Using almost any other IDE feels like a downgrade, especially on large codebases with complex dependencies. Beyond Java, they have excellent support for Python, C#, Go, Javascript, and more. The engine builds a deep understanding of your code, which can make ctrl-space to suggest a method on an obje…

Used JetBrains for more than 10 years, but got tired of it lagging all the time and using so much memory (even on M1 Pro with 32GB RAM, even on small projects). So I switched to VSCode for everything except Java. And I’m not a person who is easily annoyed I would say.

They seem to have fixed a lot of the weird lags recently. Right click context menu used to be slow, and the python debugger had performance issues for sure up to a year or so ago. Both way better now

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#157
post #5

Go 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?

#158
I really like Pandoc codebase [0]. It is a document converter written in Haskell.

Reading it’s source code a decade ago was a turning point for me. Prior to that, I always felt an insurmountable gap between my toy codebases and real projects. All those open source software written in C++ etc. looked so unapproachable that I felt like I could not write production ready software.

Pandoc however, was written in a language I didn’t know and did something very complicated very thoroughly, yet remained accessible. It was very nicely laid out and I could easily follow how it constructs it’s internal representation of documents and converts between them. I think this made me catch the functional programming bug for the next decade that let me build way bigger things than I had any right to, without getting crushed underneath all the complexity.

Putting together something in Java or even contributing to OOP Python codebases was still like an exercise in frustration, no matter how much better I thought I’m getting at programming I would feel stupid trying to wrap my head around those abstractions and hierarchies. Somehow FP just clicked for me and made me see how I could start from a simple library call and little by little build the complete program.

Today I am comfortable with all kinds of paradigms and levels of abstraction, but I definitely owe a lot to Pandoc for showing me I was smart enough to understand and modify real world software I did not build myself.

[0] https://github.com/jgm/pandoc

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#159
I’m surprised that nobody has posted about Elixir yet. I nominate the excellently written Phoenix library. Not only is the code well organized and easy to find, the documentation is expansive and right next to the code.

https://github.com/phoenixframework/phoenix

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#160
post #147
post #75

Earlier quoted context omitted.

Pointer vs value receivers and named returns have so many gotchas that it is not even funny. Lack of magic my ass.

The way you avoid these are twofold: 1) Use the pointer receiver unless you have a really good reason to do otherwise. 2) Never, ever use named returns. Code can (and should) always be written to not use them.

Can you elaborate point 2, please?I am wondering how is that related to the issue of pointer and value semantics.
Post reply on HN