Home About Blog GitHub 中文

Architecture

Draw the edges first

Architecture is often told as a choice of language, framework, or middleware. Those come later. The first question is: which parts sit on this line, how they talk, and where a failure is cut off.

I draw on paper first. Boxes are duties. Arrows are dependencies. If one sheet cannot hold the picture, the code will not hold it either. Once the edges are clear, directories, modules, and interfaces can follow.

flowchart TD problem[Problem] --> edges[Edges] edges --> dirs[Directories] edges --> mods[Modules] edges --> ifaces[Interfaces]

Rust Design Patterns and Best Practices is written in that order: name the layer the problem belongs to, then put the implementation next to it. The DAG is the same. The links matter more than the definition.

When the system has to change, change the drawing first. If the drawing still stands, the code is worth touching.

Back to the blog