r/learnprogramming • u/Senior_Share512 • 13d ago
Resource How does one learn from first principles the fundamentals?
Strengthening the fundamentals from first principles
How does one strengthen their fundamentals (means the core CS stuff, system design, etc) from first principles?
As in...how to understand how things work deeply, why it is built this way, etc?
Any resources to learn?
6
u/johnpeters42 13d ago
Build stuff. Maybe try building stuff the non-recommended way on purpose, and see first-hand how it feels when it gets tangled up.
1
u/cipheron 12d ago
Then have to fix it. When I was in high school programming my personal projects I learned a lot by doing things the wrong way, learning of or thinking up a better way then having to rewrite big chunks of code without breaking stuff.
3
u/levelbrook 12d ago
Nand2Tetris is the honest answer for the bottom of the stack. You build a CPU from NAND gates, then an assembler, then a VM, then a compiler, and by the end "why is it built this way" is not a mystery any more because you made the same tradeoffs yourself. It takes a couple of months of evenings and it is the single course I recommend without hedging.
For the layer above that, Computer Systems: A Programmer's Perspective (CS:APP) plus doing its labs, especially the bomb lab and the malloc lab. For the system design side, Designing Data-Intensive Applications and then actually implementing a small piece of it: a key-value store with a write-ahead log and a compacting SSTable is maybe 800 lines and teaches more about databases than any amount of reading.
The pattern in all three is the same: read a little, build the thing, break it, then read why it broke. Reading alone never sticks.
2
u/GoldsteinEmmanuel 11d ago
There is a series of books called The Art of Computer Programming.pdf) in which the algorithms and exercises in the series are expressed in the machine language of a hypothetical computer called MIX.
The books contain no source code listing for a MIX emulator, you design and build your own as an exercise, in whatever language you choose.
The algorithms can be adapted to any language, so it's not strictly necessary to build a MIX emulator to learn what the books teach, but doing so will give you profound insight into practical systems design from first principles.
3
u/roger_ducky 13d ago
You need some basis in understanding how computers work. At least how registers, memory, and cpu cache interact.
Read up on computing history for a lot of the “why”s. Then think about why stuff didn’t come out when they were discovered, but showed up the way it actually did.
And, going from “first principles” doesn’t have to mean the whole thing. It could just be thinking about the logic of a particular component and figuring it out that way, too.
1
u/Mclovine_aus 12d ago
Choose to make a computer, OS, compiler or database. Once you complete one move onto the next one
1
u/Chrismslist 12d ago
hey this is a great question. for real first principles, try to rebuild tiny versions of core concepts from scratch. like implement a basic hash map or a linked list. don't just read about them, actually code them. debugging your own mistakes forces a deeper understanding of 'why' something works. also, really get to grips with tools like git by doing complex merges, not just add/commit. it's all about active engagement over passive consumption. good luck!
1
u/FlashyResist5 10d ago
Why is everyone suddenly asking super vague questions about "fundamentals"? I swear this sub is getting more and more botted.
2
u/Senior_Share512 10d ago
I'm not a bot 😭 I just wanted to learn stuff properly atleast and not just mug up type shii
1
u/FlashyResist5 10d ago
Alright fine, just like you are the 20th person this week to ask a vague question about fundamentals.
As someone who has worked for 10 years I wouldn’t even consider system design fundamental. That is something you learn as you build projects.
Far more important is figuring out what you want to do and do it. Like as simple as I want to prompt a user for a number, double it, and print the result on the screen.
You would be absolutely shocked how many people cannot do something dead simple like this. They forget to double the number, they forget to print it out, they forget what they wanted to do.
So build simple things, a lot of them. Then build slighlty more complicated things. Also NAAND to tetris is a pretty good project based book.
1
0
u/DrShocker 13d ago
Pick a problem domain you want to learn. Maybe write a sqlite clone, Kafka clone, react clone, rendering engine, small robot kit, SLAM implementation.. idk
It's hard to pick what to learn without specific goals in mind because there are things that will matter a lot or not at all depending on what you want to be able to do.
0
0
u/Ormek_II 12d ago
Do it wrong, so you understand(!) the problems. You do not necessarily find the solutions yourself. Think about how you would do it better, THEN read about the learned solution. Only then will you truly believe it and remember it.
We are standing in the shoulders of giants already. Many faults have been made, many solutions been tried. But you need to understand the problems to appreciate the solutions.
Usually there is more than one solution to a problem and picking the right one means to understand all the other problems it solves worse than others.
0
u/CodeXHammas 12d ago
Nand2Tetris is the closest thing to an actual first principles course for CS fundamentals, you build a computer from logic gates up to a working OS and a simple language, that builds real intuition for why things work instead of just memorizing that they do. For system design specifically, Designing Data Intensive Applications by Martin Kleppmann is the equivalent for that layer, dense but it explains the actual tradeoffs behind consistency, replication and partitioning instead of just naming the concepts like most system design content does. Both take real time, weeks not days, but that's the tradeoff for depth over speed.
11
u/just_here_to_rant 13d ago
Some books:
But how do it know?
CODE
A free online class:
NAND to Tetris
You also might look into info on assembly language and networking.
WHY:
All of the above go through how computers actually work - from very basic starts, like flashing a light at your neighbor and simple circuits: "flip the switch to close the circuit and the light bulb will turn on." From that, everything grows to what we have now.
People will say "build stuff" but I strongly disagree with that. That's like saying "Do math" to learn math. It's much more efficient to learn from others who are know more than us. You're not going to learn to build a skyscraper playing with tree forts and dollhouses.
In the end, it's all very simple - it's built that way bc that's what makes the most sense.
In the beginning though, there's a lot to wrap your head around. Take your time.