Live data from Hacker News

Ask HN: What are the “best” codebases that you've encountered?

news.ycombinator.com

161–170 of 278 posts

Re: Ask HN: What are the “best” codebases that you've encountered?

#161

Earlier quoted context omitted.

Redis is widely used in production environments. The code quality matters.

> Redis is widely used in production environments. The code quality matters. That's how you judge source code quality? By measuring its popularity? And ignoring the actual code?

That's not what I said.

Re: Ask HN: What are the “best” codebases that you've encountered?

#162
post #101

Earlier quoted context omitted.

In Go, a folder is a package and as soon as you write a comment before the `package foo` declaration, it's package documentation. And thus GoDoc automatically generates a nice webpage out of it. See for example this package comment: https://github.com/golang/go/blob/master/src/net/http/doc.go... Turns into this documentation (the beginning only): https://godoc.org/net/http Out of the box.

What's the point of all these empty comments throughout the code? // ...

It's likely the Go libter requiring every public method / variable to be documented.

Re: Ask HN: What are the “best” codebases that you've encountered?

#163
For Java, below are my favorites:

1. Jersey - https://github.com/eclipse-ee4j/jersey 2. Jetty - https://github.com/eclipse/jetty.project 3. Guava - https://github.com/google/guava

Common theme is - Easy to follow, clean documentation & use of consistent patterns.

Re: Ask HN: What are the “best” codebases that you've encountered?

#164
post #101

Earlier quoted context omitted.

In Go, a folder is a package and as soon as you write a comment before the `package foo` declaration, it's package documentation. And thus GoDoc automatically generates a nice webpage out of it. See for example this package comment: https://github.com/golang/go/blob/master/src/net/http/doc.go... Turns into this documentation (the beginning only): https://godoc.org/net/http Out of the box.

What's the point of all these empty comments throughout the code? // ...

It's just an ellipsis indicating that there be would more code after.

Re: Ask HN: What are the “best” codebases that you've encountered?

#165

For canonical C code, without a doubt I would say Redis and Postgres. Redis is written and annotated in a way that even someone with a cursory knowledge of C can understand what's going on. For Python, I really like how SQLAlchemy is written and designed. For Rust, ripgrep stands out as a sterling example of how to write a powerful low-level utility like that.

I just opened up server.c in Redis (not familiar with Redis and never seen it before) and at first glance it seems... alright, but I'm not sure what's particularly outstanding about it, and it could definitely be better. Some of the logic seems questionable (exit() in a signal handler? [9] also what about thread safety?), and more superficially (but annoyingly) I see: names like "sdscatprintf" [1] which are a little…

sdscatprintf is just mimicking the C style for a lot of string manipulation functions that have -printf suffixed. My guess would be the function just concatenates the data onto some sort of "SDS" string

Re: Ask HN: What are the “best” codebases that you've encountered?

#166
post #34

NetBSD, hands down. Beautiful, simple to understand, consistent. The documentation is also top notch -- I wrote a trivial character-device kernel driver using only the man pages as a reference. And you can too. Also -- the source code to Doom. Read it, marvel at its clarity and efficiency -- and then laugh when you realize that the recent console ports were completely rewritten in fucking Unity . And the Switch versi…

I used NetBSD as a reference when I needed a cross platform strptime that behaved identical everywhere.

I found the source very approachable. Source was well laid out and fairly clear. Some of it was subjectively a bit ugly to just look at, but when you read it, it was very clear.

Couldn't use glibc as a reference because this in a closed source commercial product and, well, GPL.

Re: Ask HN: What are the “best” codebases that you've encountered?

#168

Perhaps I'm jaded, but I notice that all the examples given here are developer tools or otherwise things with well scoped functional inputs and outputs (e.g. ffmpeg). Anyone have an example of a consumer application that has a good codebase? Chromium, GitLab, OpenOffice, etc? I feel like such applications inherently have more spaghetti because the human problems they're aiming to solve are less concretly scoped. Even…

Redis...

Re: Ask HN: What are the “best” codebases that you've encountered?

#169
post #126

it seems that in real life, a really high-quality codebase is hard to come by I think a common misconception amongst mid-experienced programmers is that they confuse look with quality. Reading clean written code gives you a feeling of control and also the feeling that someone must have thought about that program. It's reassuring. You have in front of you a code that gives you trust. When in fact, that code can be com…

> by running it in your head. I have encountered far too many people who don't even realize this is a thing. I figure they must be doing it in some limited form and just aren't recognizing it as a skill that can be trained up, otherwise I'm not sure how they can do any development, but...

I generally intentionally avoid running the program in my head because that requires too much context: I prefer to think about the change I want to make and the minimal set of preconditions that make the change valid.

Re: Ask HN: What are the “best” codebases that you've encountered?

#170

The Windows operating system. Windows is quite an engineering achievement. We didn't prioritize readability or "clean code". All the variables used hungarian notation, so you had horrible names like lpszFileName (lpsz = long pointer to a zero terminated string) or hwndSaveButton (window handle). You also had super long if(SUCCEEDED(hr)) chains that looked like your code was spilling down a staircase. Oh yeah, and pid…

I once tried to add a feature to Windows (back in the sd days), and it was a nightmare. I was in the C&E org so it was a side project thing, and I eventually postponed it (but then left MS so never got it finished). I imagine it's gotten much better since then, in large part from the shift to git alone. It certainly was super impressive feat for the shear scale and longevity. I have a lot of respect for the folks who make that beast work. And there are bits of it that are brilliant. But it was an ugly beast.
Post reply on HN