What does HackerNews think of sqlite?

Official Git mirror of the SQLite source tree

Language: C

The sqlite code base is really well done. Lots of documentation.

https://github.com/sqlite/sqlite

I wouldn't rely on Google to learn good practices for technical documentation (unless they want to release their complete internal technical documents on how their recommendation algorithms work, that is).

Instead, check out a reliable open source project like SQLITE, they have great documentation:

https://www.sqlite.org/arch.html

https://github.com/sqlite/sqlite

See previous discussion of sqlite structure here:

https://news.ycombinator.com/item?id=32250426

I don't buy the authors testing argument for a couple of reasons:

1. Verification is automated - From my perspective, tests predominantly serve to document AND verify the behavior of code. You don't have to follow TDD to buy into the idea that tests serve to verify behavior of the code that was written. Some applies to formal verification of software.

2. Documentation stays in sync with tests - I'd imagine that any snippet of code is read 2-10x more than it ever changes and tests help with that reading process. Writing tests means you're optimizing for the thing that happens most often AND you are somewhat guaranteed that your testing "documentation" stays up-to-date because as software evolves the tests will need to evolve as well there is an immediate penalty for not updating the tests; there is no corresponding immediate penalty for forgetting to update a specification document. The older a piece of software is the harder it will become to understand: the original developers stop working on it, the documentation becomes stale, context and initial reasoning for certain decisions is lost. In such an environment it's, in my experience, generally easier to make changes to old code bases with lots of testing because generally tests will tell you if there is something you don't understand with nearly instantaneous feedback: write some code, run the tests and it either works or it doesn't.

Similarly, I don't get the authors argument that code is more illegible than it has been in the past. More modern languages make this as easy as possible to get correct. Take something like Flask [1] written in Python and generally considered to be well-written and compare that to the C code in SQLite [2] which is generally considered to be well-written C and tell me which is easier to understand without any prior knowledge.

[1] https://github.com/pallets/flask [2] https://github.com/sqlite/sqlite

No worries. Just to point out though, SQLite does have an official mirror repo on GitHub:

https://github.com/sqlite/sqlite/

Yeah, that could be the case. That being said, lots of projects aren't on GitHub, and SQLite does have a mirror there which is kept up to date:

https://github.com/sqlite/sqlite/

The sqlite codebase is well-known for being a large, well-written C codebase:

https://github.com/sqlite/sqlite

The tests in particular are very impressive.

Some other notable C codebases: Redis, LuaJIT, FreeBSD, Memcached -->

https://github.com/antirez/redis

https://github.com/LuaDist/luajit

https://github.com/freebsd/freebsd

https://github.com/memcached/memcached