Richard Bergmair's Blog


==> Kraken Technologies writes about how they organise their very large Python monolith.

I’m a big fan of layered (or even linear) dependency structures, too. Here is a simple trick I use in my Lua codebases: The layout of my source code files usually looks like this:


It has always bothered me that codebases don’t have a beginning and an end and that, therefore, it’s difficult for a reader to know where to start when they just want to read the codebase.

So, my approach is to impose this linear order and only allow code that comes later to depend on code that comes earlier, never the other way around. This way, you can read through the code rather easily. As you look at any piece of code, it will only depend on code you’ve already looked at, so you don’t have to constantly jump through the codebase as you read.

I’ve also found that failure to correspond to a linearisable dependency structure is a “code smell” and that, as I try to eradicate that code smell, I frequently end up with code that’s better in all kinds of ways.

#computers   |   Jul-19 2023