Live data from Hacker News

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

news.ycombinator.com

191–200 of 278 posts

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

#191

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…

I love this description. Thank you.

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

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

Running non-trivial code in your head is far too tedious for daily use. I'd much rather add debug checks for invariants when I want to confirm that the code works the way I expect it to.

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

#193

Earlier quoted context omitted.

Any PHP framework is a case of inner-platform: https://en.wikipedia.org/wiki/Inner-platform_effect PHP already is the "framework" and every time you load a page it's executing the script from scratch. You're wasting a lot of time loading a framework to handle control flow for your program which doesn't have any control flow in the first place.

I'm not a PHP dev, but I've dabbled. And I'm not sure I follow. How is it a framework for frameworks sake? I take that to mean it's pointless/not useful. Whereas I'd say Laravel and it's ecosystem are far more productive and time saving than simply using just PHP. It's the opposite of wasting time. From their github repo[0] Laravel has: - Simple, fast routing engine. - Powerful dependency injection container. - Multi…

These features don't make sense for PHP's execution model, your script is supposed to render one page and then exit. There's nowhere to put background tasks, event handlers, etc. Is it doing something else? I can't imagine turning PHP into an application server, and if you were, I'd suggest getting a different language.

It's possible to have request routing if you want to have the same .php file serve every request on your site, but that's totally inner-platform. There's already a thing routing URLs and it's the web server.

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

#194
post #157
post #140

Earlier quoted context omitted.

Actually, this line: /* Set expansion level */ expansion = atoi(argv[++i]); Is an example of ugly code. They're doing multiple things in one line, and in a confusing order. # Increment i by 1. # Grab the command line argument in position i # Convert from string to integer. # Assign to the variable expansion. Note that there's no error checking to handle strings that don't convert to ints. Arguably, any serious C deve…

I don't have a problem with that code. It is idiomatic C code, like *p++ or flag &= ~mask. ++i is a bit less common than i++ but nothing unusual. The lack of of error checking is more concerning though. It can be justified though, and it brings me to the next point. The comment is the worst part. It is useless, it literally repeats the most obvious part of the code. A good comment would be something like "there is no…

[deleted]

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

#195
post #157
post #140

Earlier quoted context omitted.

Actually, this line: /* Set expansion level */ expansion = atoi(argv[++i]); Is an example of ugly code. They're doing multiple things in one line, and in a confusing order. # Increment i by 1. # Grab the command line argument in position i # Convert from string to integer. # Assign to the variable expansion. Note that there's no error checking to handle strings that don't convert to ints. Arguably, any serious C deve…

I don't have a problem with that code. It is idiomatic C code, like *p++ or flag &= ~mask. ++i is a bit less common than i++ but nothing unusual. The lack of of error checking is more concerning though. It can be justified though, and it brings me to the next point. The comment is the worst part. It is useless, it literally repeats the most obvious part of the code. A good comment would be something like "there is no…

> The lack of of error checking is more concerning though. It can be justified though...

How so, in this case? It could lead to undefined behavior.

> The comment is the worst part.

Useless comments may be irritating, but, as a bad practice, they are not comparable to skipping checks for possible errors and creating the possibility for undefined behavior.

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

#196

Earlier quoted context omitted.

Keldon Jones’ Race for the Galaxy AI is brilliant. Every line is documented C. It trains and deploys a neural net. It has a fast and functional GUI. Most diehard RftG players have cut their teeth by losing to Keldon a few dozen times before really learning the game. Keldon was contracted a few years later to develop the RftG apps on iOS and Android, which are easily worth $4. Source: https://github.com/bnordli/rftg P…

> Every line is documented C Every line? Oh dear [1]: /* Set verbose flag */ verbose++; ... /* Set advanced flag */ advanced = 1; ... /* Set expansion level */ expansion = atoi(argv[++i]); ... /* Initialize game */ init_game(&my_game); I assume the verbose flag is incremented because there's multiple levels of verbosity, whereas the advanced flag is a boolean, and i is incremented because expansion is not a command l…

It seems to follow the notion that more comments = better code. If the symbol names are explanatory enough, the code itself will be self-explanatory. Then all that must be commented about will be special cases handled/not handled and why a certain decision is taken about handling in a certain way.

Often, "every single line is commented" results from blindly following a certain "Standard" that demands that. Eventually generating meaningless comments all over the code. Then the important points never gets mentioned in the comments or just gets buried in the noise.

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

#197
post #3

ffmpeg https://github.com/FFmpeg/FFmpeg

The build system and assembly system (x86asm) are very underrated. Open source went from autotools, which are awful, to cmake, which also seems to be awful. ffmpeg's configure/make system has the same interface as autotools but is actually good. libavformat is rather difficult to use and difficult to fix bugs in - you'll never find the bugs. Same with the ffmpeg frontend, which makes it easy to ask for something it's…

libavformat is rather difficult to use and difficult to fix bugs in - you'll never find the bugs.

Some examples?

encoding never worked as well, which is why nobody uses ffmpeg2/4/etc and x264 is a separate project.

Most users use x264 _via_ ffmpeg since they may need to filter the video and/or filter/process/mux audio and other streams.

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

#200
post #74

Earlier quoted context omitted.

I completely agree. I've gotten to work with both of these at my summer job and it's been an absolute pleasure.

You've gotten to work with both NetBSD and Doom in one summer job? Now I'm really curious what you've been doing. I think I may want that too.

My project was to port DOOM to the seL4 microkernel (on rpi3b+). To continue with that I’ve been porting NetBSD Rump kernel components to seL4 as well.

DOOM itself is a breeze to port. NetBSD can get confusing at times but it’s nice to know there’s always a logical reason behind the design decisions. It rewards you for spending time to understand the code and I like that. Rump kernels are especially cool.

It’s a myth that you can’t get paid to work on BSD ;)

Post reply on HN