Live data from Hacker News

Build a Database in 3000 Lines with 0 Dependencies

build-your-own.org

21–30 of 59 posts

Re: Build a Database in 3000 Lines with 0 Dependencies

#21
I've started learning Velox last year, and it's a staggering amount of code. Sure, it has a ton of dependency because it wants to support so many things, but I feel like the core itself is also very complex.

I'm not sold on complexity being a necessity in software engineering, as I'm sure a lot of you also aren't. Yet we see a lot of behemoth projects.

Re: Build a Database in 3000 Lines with 0 Dependencies

#22
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

The proprietary test suite for SQLite3 is much much larger still. The battle-testedness comes in great part from that.

Is that where the 10x more lines came from? Writing more "testable" code?

Re: Build a Database in 3000 Lines with 0 Dependencies

#23

Earlier quoted context omitted.

The proprietary test suite for SQLite3 is much much larger still. The battle-testedness comes in great part from that.

Is that where the 10x more lines came from? Writing more "testable" code?

Oh no, SQLite3 is a lot more featureful than SQLite2. The proprietary test suite is what makes SQLite3 so solid.

Re: Build a Database in 3000 Lines with 0 Dependencies

#25
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

>I was typing out entire codebases for didactic purposes

I've read about an author who did this (I can't remember their name right now), writing down the works of another author they wanted to learn from.

Re: Build a Database in 3000 Lines with 0 Dependencies

#26
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

can you elaborate on typing out for didactic purposes, please?

It's a new iteration on the ancient form of learning by copying. I've only ever seen people copy stuff when writing by hand when wanting to memorize something though, I imagine with a keyboard the memory-enhancement effect of writing by hand is lost, but it's probably more effective than just reading alone.

Re: Build a Database in 3000 Lines with 0 Dependencies

#27

Earlier quoted context omitted.

Is that where the 10x more lines came from? Writing more "testable" code?

Oh no, SQLite3 is a lot more featureful than SQLite2. The proprietary test suite is what makes SQLite3 so solid.

This makes me wonder. Is anyone practicing TDD with genAI/LLMs? If the true value is in the tests, might as well write those and have the AI slop be the codebase itself. TDD is often criticized for being slow. I'd seriously like to compare one vs the other today. I've also heard people find it challenging to get it to write good tests.

Re: Build a Database in 3000 Lines with 0 Dependencies

#28
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

>I was typing out entire codebases for didactic purposes I've read about an author who did this (I can't remember their name right now), writing down the works of another author they wanted to learn from.

Hunter S. Thompson copied The great Gatsby on his typewriter: https://news.ycombinator.com/item?id=24696790

Re: Build a Database in 3000 Lines with 0 Dependencies

#29
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

Really puts the auto- in didact! Very curious to hear how this worked for you; it’s almost directly the opposite of the copilot approach. I learned assembler by typing in listings from magazines and hand dis-assembling and debugging on paper. Your approach seems similar in spirit, but who has the times these days?

I program in neovim with no plugins, no autocomplete and no syntax highlighting. I type everything myself (though I will use copy and paste from time to time). There is a discipline to it that I find very beneficial. As a language designer, it also makes me think very carefully about the syntactic burden of languages that I design. It keeps my languages tight. One of the nice things about typing all of my own code without suggestions is that it eliminates many distractions. I may get some things wrong from time to time, but then I only have myself to blame. And I never waste time messing around with broken plugin configs or irritating syntax highlighting nits.

It's not for everyone but I love it.

Re: Build a Database in 3000 Lines with 0 Dependencies

#30
post #5

I looked into this at one point, I was typing out entire codebases for didactic purposes: SQLite 3 was 120,000 lines of code, but SQLite 2 was 12,000. So for a bit more effort you get a battle tested real world thing!

one does not simply type out 120 000 lines of code..
Post reply on HN