Live data from Hacker News

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

news.ycombinator.com

141–150 of 186 posts

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

#141
post #105

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

Have you tried C#? It looks a lot nicer to work with than Java.

I'm using C# and Java professionally. I've been using for a long time while I'm newish on C#. Also I'm on a older version of .net vs. a modern Java. Honestly to me the language doesn't feel that great. It always feels sluggish, to work with, like I'm fighting against the language. And then there is the ecosystem, Spring Boot is just such a breeze to get a web app running with all the integrations you could ever want being just there. Add in Lombok and Apache commons and it's a real pleasure to develop in Java for me.

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

#142

For C, I've really enjoyed reading the Ruby source code. There are good and bad spots, but overall especially if you know Ruby the language, the source is both entertaining and enlightening.

Is there a good guide that covers that codebase? I'm very familiar with Ruby but I've never dived into the C code and I'm not sure where to start.

Probably helpful to understand the API first before understanding the implementation. There is a well known guide here: http://silverhammermba.github.io/emberb/

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

#143
post #61

Earlier quoted context omitted.

What makes it easy to read and understand though? I am seriously having a hard time figuring this out. People tout Go for this all the time, but I don't know of a single codebase in it that I think fits that description. When I look through them they look convoluted and just sort of messed up. Things like awkward error handling, dealing with null, capitalization for public/private, magic functions, and imports, and m…

Speaking for myself, the language itself is simple. There aren't a lot of features, which means you do have to write more and it's more verbose, but learning the entirety of the language's features is very easy to do. Even with the relative magic of things like init functions that execute on import, there's so much less magic that you have to consider. IMO it's the easiest to jump into for this reason. Yes, the code…

I'll echo this. When I'm looking at a Go codebase that somebody else wrote, it's a minimal effort to understand what it does. Rarely, if ever, do I scratch my head at a particularly clever type derivation or obscure language feature; macros are pretty much non-existent; even user-defined types are easily reduced by the IDE and language server. Patterns are standardized and yes, it's verbose, but predictably so. If something calls for containerization, it's dead simple. Go is a language for getting things done straightforwardly.

I know it's not everybody's cup of tea, and that's fine. There's room for different languages in the world. But I'm knocking out useful utilities that make a difference for my team and business in days or hours, and supremely uninterested in code golf, so I don't personally agree with the criticisms.

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

#144
The various flavors of Forth all qualify. They are great examples of how to bootstrap towards a powerful abstraction, starting from a relatively simple context. The 80% of the 80/20 rule here comes from "writing a Forth" being an engaging learning experience.

For anyone who would like to do that, I recommend looking up one of the old standards(FIG-FORTH, FORTH-79, FORTH-83) and implementing the words in them with whatever tools and languages you like. You will hit a point where your early assumptions about the implementation are wrong. Keep going, get it to the point where you are capable of using the metaprogramming words.

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

#146
There were 3 different libraries that impressed me:

1. The SunOS headers. Couldn't see the code but the number of header files was small enough in the 4.x Sun libraries that you could read them all. Mostly the documentation was terse but information dense.

2. The TeX sources. Knuths literate programming seems like such a missed opportunity.

3. ParcPlace VisualWorks. Due to the nature of Smalltalk you could read all the source code, learn object patterns directly from the people who invented it. A great learning experience when transitioning from C and so much better than the cfront based C++ hack.

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

#147
post #75
post #67

Earlier quoted context omitted.

It’s the complete lack of magic. What you see in front of you is pretty much exactly what happens. You don’t have to keep a cathedral of language semantic subtleties in your head when reading someone else’s code.

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.

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

#148

Guava -> In Java Golang Stdlib -> Golang redis -> C anything by armin ronacher -> Python

Armin Ronacher is definitely one of the engineers you should follow on GitHub, especially if you're writing Python or Rust. That guy is a genius at what he does.

Oddly, even though he wrote one of the two most popular frameworks for Python, Wikipedia still claims his entry doesn't meet notability requirements.

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

#149
post #34

Earlier quoted context omitted.

Now if only GitHub desktops actual UI/UX wasn't a poorly thought out mess of anti-patterns and anti-design.

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?

#150
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.

I think java is geared towards server applications because the JRE is so finicky about memory and other machine level details you can only control on your own services

Most major web services have java microservices that take on the performance critical and logic intensive parts of the business

Post reply on HN