r/learnprogramming • • 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?

33 Upvotes

20 comments sorted by

8

u/aqua_regis 4d ago

Start at the common recommendations (I have omitted SICP from my usual recommendations since you already mentioned it):

  • "Think Like A Programmer" by V. Anton Spraul
  • "The Pragmatic Programmer" by Andrew Hunt and David Thomas
  • "Code: The Hidden Language of Computer Hardware and Software" by Charles Petzold
  • "Design Patterns: Elements of Reusable Object Oriented Software" by the "Gang of Four", or alternatively, for a lighter read: "Head First: Design Patterns"

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.)

1

u/TiberonChico 4d ago

Seconding Pragmatic Programmer. I’ve read multiple times and take away something new each time

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.

5

u/desrtfx 4d ago

Anything by Uncle Bob Martin.

That recommendation has fallen out of favor (and to quite large degrees already been debunked) in the last couple years. I stopped recommending him quite some time ago.

2

u/CorumLlawEreint 4d ago edited 4d ago

what does 'debunked' mean? I mean in the context of something like 8 books on software development.

Don't get me wrong... I am far from an acolyte. I don't like 'Clean Architecture'. It has the 'if all you have is a hammer, everything looks like a nail' effect on some people.

1

u/desrtfx 4d ago

Debunked means that a lot of his content and his statements have been proven wrong, countered, and simply made irrelevant with today's standards.

Some (especially in Clean Code) were outright wrong from the beginning and even contradicted themselves.

1

u/CorumLlawEreint 4d ago

I guess I phrased my question wrongly. I know what debunking means. I was hoping for specifics.

1

u/desrtfx 4d ago

I'd have to look up all the articles. There are more than enough.

1

u/CorumLlawEreint 4d ago

I’m sure there are. Whether I care enough to look them up is another matter.

1

u/MagicWolfEye 4d ago

Did it? I thought that was only in my bubble.

1

u/desrtfx 4d ago

No. That's far from a bubble.

Uncle Bob has his good stances that still hold up today, but, unfortunately, quite the majority of his "dogmas" (which as such are already quite bad) have been debunked or have gone way past their due time because of changes in approaches and philosophies about programming.

1

u/Br3ttl3y 4d ago

So have we moved onto another prophet? If so, who? If not, why not?

1

u/desrtfx 4d ago

Currently, there is no other prophet.

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.