r/learnprogramming • u/IAmNotNeru • 4d ago
What are some good resources to learn how to properly structure large scale codebases?
This is specifically about going from "I know how to write a 700 line program and solve individual problems" to "I need to write maintainable and organized code for possibly thousands upon thousands of lines"
I am already confident enough to be able to solve most if not all problems I encounter given enough googling and time, but I have heard enough horror stories about projects becoming unmaintable messes
It would be nice to have something to learn how to compose programs in a way that is logical, I heard the terms "software enginering" "software architechture" and "software design" being thrown around, but most youtube videos mostly worry with teaching some specific software design paterns, but I am aware enough to know that attaching yourself to one type of patern and trying to apply it to everything would be logical, in theory I could only learn ECS and use that for everything since I mostly make games, but that would be like using a hammer for everything, in theory it could work, but it is far from ideal, and following common conventions doesn't make code good either
Plus, software design paterns like "use composition over inheritence" and OOP are not (and should not) be the underlying philosophy behind every decision within a large codebase
I've seen some recomendations, structure and interpretation of computer programs (SICP) and how to design programs (HTDP), both SICP and HTDP have the problem of using lisp-like languages to teach, which isn't that bad but does make studying a bit unnecesarially confusing since lisp is so different than anything you deal with on a daily basis (less you code in clojure or something)
with SICP that can be mitigated by using the javascript edition of the book (or better yet, the comparasion edition)
I did not read SICP yet but but I did give HTDP a try and it seemed a bit overtly abstract and verbose, as well as over-explaining topics that, at least for me, don't need explaining
Anyways, do you guys have other recomendations or should I stick with SICP/HTDP?
8
u/aqua_regis 4d ago
Start at the common recommendations (I have omitted SICP from my usual recommendations since you already mentioned it):
If you want to go all in, the absolute classic is "The Art of Computer Programming" by Donald Knuth et.al. Dry, heavy read, not even 100% finished yet (and most likely never will be) but it's a tome of infinite wisdom.
Then, there are books specific to Game Design - if I am not completely mistaken, there is a book about Game Design Patterns - which could be a useful read. Unfortunately, I can't remember the exact title (yet, I guess that just googling "Game Design Patterns book" will get you quite far.)
4
u/CorumLlawEreint 4d ago
Design Patterns by “the Gang of Four”
Anything by Uncle Bob Martin.
Personally I prefer a flatter architecture then they would expound, but their impact is undeniable.
1
u/pancakeQueue 4d ago
For software that is packaged refer to the package manager of that language. Python and Rust both prefer the repo to be laid out in certain ways that when you package your own code everything is found where it needs to be.
1
u/dahiya_xa 3d ago
since you mostly make games, game programming patterns by robert nystrom is the one. it's free to read online and it's all about keeping a growing game codebase from turning into spaghetti, with real game examples instead of abstract theory. after that the best teacher is honestly refactoring your own 700 line projects when adding a feature starts to hurt
1
u/adumbCoder 4d ago
Clean Code and Clean Architecture are 2 solid starting points
0
u/_usr_nil 4d ago
what is a large codebase ?
are you trying to design a serverless/cloud service, an efficient program or a library ?
First you have to find actually a problem then learn what to use to solve it, or maybe you want to reinvent the wheel somewhere you think it's worth it ?
from an architectural standpoint each language will have it's nuances and idiomatic ways to approach modularity and that will also influence your file structure/naming conventions, some old book won't save you when it teaches C++ from the 90s and you're going to write any multi-paradigm language let's say at work.
You can always ask AI what are the strategies for one language and to always link the source so you can check it yourself more in depth or at a slower pace, often language creators leave a reason for a certain feature because they wanted to solve a problem from that era or that currently is appearing.