Code Layout and Management - Q&A

Code Layout and Management - Q&A

Answering questions about UCCL - Uniform C/C++ Code Layout (aka “The Dogfood Layout”) proposal.

Q: Apart from Pitchfork Layout, are there other layout proposals?
A: The only other one I’ve found so far is Canonical Project Structure. If I find more, I’ll add them to this list.

Q: What is the main difference between using CPM and using Git submodules?
A: UCCL and CPM indirectly advocate for living at head. Dependent modules aren’t contained in a “parent” module, they are separate folders and one must use the same version in all “parent” modules. Using another branch except the head is possible but probably not a good idea.

Meanwhile, git submodules are links to a fixed commit. Different “parent” modules" can use different versions of the same submodule.

Q: Is “living at head” a good idea?
A: According to Google’s Abseil Project, yes. To quote from the reference above:

With over 250M lines of C++ code and nearly every project building from head, we’ve demonstrated a different approach to software engineering: one largely free of version mismatch issues and one where even the most common libraries can be refactored regularly, and safely.

And:

We believe that the current paradigm for software is inherently unsustainable: dependency management is brutally complex. Unsolvable “diamond dependency” issues are common — the only ways to avoid these are to never change, or to ensure that there aren’t multiple versions. We prefer the latter, so we will do what we can to get you to live at head along with us — if everything is built from source at head, there can be no more diamond dependencies, branch conflicts, and complicated discussions about merge policy. All of that time spent could be spent on more useful things, like actually writing code and solving problems for users. Join with Abseil, and stop paying the content-management tax!

Q: Apart from the Abseil project, are there other projects using the “live at the head” philosophy?
A: Sure, Microsoft’s WIL (Windows Implementation Library) and GoogleTest are just two such examples.

Q: Is “living at head” compatible with dynamic linking?
A: In my opinion and in most cases: no. You would need to distribute the dynamically linked modules and make sure they don’t conflict other versions of the same modules that already exist on users’ machines. To do that, the only sustainable solution is to place them in an application specific directory. This pretty much negates the whole purpose of the shared objects.

Created: 2023-11-24