Richard Bergmair's Blog



#politics#computers#business2023q42023q32023q22023q12022q42022q32022q12021q12020q32020q12019q42019q32019q22019q12018q32018q2


==> 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:

01_foo/
  03_foo.lua
  04_bar.lua
  15_whatever.lua
02_bar/
  22_whatever.lua
  56_something.lua

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


#politics#computers#business2023q42023q32023q22023q12022q42022q32022q12021q12020q32020q12019q42019q32019q22019q12018q32018q2