Design and Architecture
Architecture Blueprint
A map of your code drawn from the code itself. Namespaces are grouped into a small number of components, the dependencies between them are drawn as arrows, and the problems that matter for architecture (cycles, dependencies to cut, layer violations) are colored on the map.

What it shows
The blueprint is generated from the last analysis. It does not need a diagram file and it is not drawn by hand. When the code changes, run the analysis again and click Refresh.
Opening it
Open Architecture Blueprint from the main menu of the project. The first screen is the Overview: all components of the project, with the dependencies between them. The line under the toolbar gives the totals, for example 7 components - 2 layers - 0 cycles - 0 data stores.
Reading the diagram
Boxes
Each box is a component. It shows its name, the number of namespaces it holds and its size in lines of code (LOC). The box you selected is outlined. Components with no real namespace (for example code in the global namespace) appear as (global).
Arrows
An arrow from A to B means that code in A uses code in B (calls a function, uses a type, inherits from a class, includes a type from it). The arrow is drawn once however many individual dependencies it stands for. Use the toolbar to show every dependency or fewer of them.
Colors and legend
The legend under the toolbar explains every color. An arrow or box without a color is a normal dependency.
| Color | Meaning | What to do |
|---|---|---|
| dependency cycle | Components that depend on each other, directly or through others. | Break the cycle: they cannot be built, tested or understood separately. |
| dependency to cut | An arrow that, if removed, would help most to remove a cycle or to respect the layers. | Start here: it is usually the cheapest change. |
| changes together | Components whose files are often modified in the same commits (needs the history, see Change coupling). | Hidden coupling: check if they should be one component, or share an interface. |
| layer violation | A dependency that your layer rules forbid. | Fix the code, or change the rule if the rule is wrong. |
| data store | A component that reads or writes a database, a file store or a similar external storage. | Check which components touch the data directly. |
Toolbar
| Control | What it does |
|---|---|
| Detail | The level of the boxes. Namespaces groups namespaces into components. Choose a finer or a coarser level to see more or less of the code. |
Components ≈ | The approximate number of components. Namespaces are merged or split to get close to this number. A smaller number gives a simpler map, a bigger one a more precise map. |
| All dependencies | On: every dependency between components is drawn. Off: only the main ones, to reduce the noise on large projects. |
| Data stores | Shows or hides the data store marks and the related findings. |
| Hide anonymous namespaces | Leaves out unnamed namespaces (the C++ namespace { ... } used for internal linkage). They are implementation details of a file and add noise to the map. |
| Change coupling | Adds the changes together findings, computed from the source control history. Off by default because it needs the history. |
| History | The period of the history used by change coupling (for example 12 months). |
Header actions
| Button | What it does |
|---|---|
| Configure layers... | Opens the layers editor: define layers and which components belong to each, and which layer may use which. See Layers and rules. |
| Clear rules | Removes the layer rules you defined. The map goes back to showing only the dependencies and the cycles. |
| Copy | Copies the diagram so you can paste it in a document, a wiki or a pull request. |
| Refresh | Redraws the blueprint from the latest analysis result and the current settings. |
Drilling down
Click a component to look inside it. The path at the top of the side panel (Overview > (global) > (global)) shows where you are, and each part is a link to go back up.
- Overview: all components.
- Component: the namespaces inside it, with the dependencies between them.
- Namespace: its types in the side panel. Click a type to open its source.
Layers and rules
A layer is a group of components with a role (for example UI, Domain, Infrastructure). A rule says which layers a layer may use. The blueprint then marks every dependency that breaks a rule as a layer violation.
- Click Configure layers....
- Create the layers and put the components in them.
- Set the allowed direction, for example UI uses Domain, Domain uses Infrastructure, never the reverse.
- Close the editor. Violations appear in red on the map and are counted in the summary line.
The summary line shows how many layers exist (2 layers). Clear rules removes them all if you want to start again.
Findings
Dependency cycles
Two or more components that depend on each other. The map colors the arrows that make the cycle. The summary line counts them (0 cycles means none).
Dependencies to cut
Among the arrows of a cycle or of layer violations, the ones where a small change gives the biggest improvement. Remove the dependency (move a type, add an interface, invert the call) and run the analysis again.
Changes together
Components whose files change in the same commits, even without an arrow between them. It shows a coupling that the code does not show: a shared file format, a duplicated rule, a protocol. Turn on Change coupling and choose a History period.
Data stores
Components that access external storage. The count is in the summary line. It helps to answer: which parts of the code know the database?
Typical workflows
Understand a new code base
- Set Components to about 10 and look at the Overview.
- Find the component that everything uses (many arrows in) and the one that uses everything (many arrows out).
- Drill down in the largest boxes to see how they are organized.
Enforce an architecture
- Define the layers with Configure layers....
- Fix the red violations, starting with the purple dependencies to cut.
- Keep the rules in the project: new violations show up in the next analysis.
Prepare a refactoring
- Turn on Change coupling with a long history.
- Look at the pink links: these components are modified together and are the candidates to merge or to decouple.
- Use Copy to put the map in the design document.
Tips
- For a very large project, start with fewer components and All dependencies off, then increase the detail.
- If you see a box called
(global)that is large, a lot of code lives outside any namespace. It is often C code or old C++ code, and it is the first thing to organize. - Keep Hide anonymous namespaces on, unless you want to study the internals of a file.
- Use the same Components value when you compare two analyses, otherwise the grouping differs.
Questions
The map is empty or has one box.
Run the analysis first. If everything is in the global namespace there is only one component: this is common for C projects.
There is no changes together link.
Turn on Change coupling. The project must be in a source control system that CppDepend can read, and the History period must contain commits.
Why do I get a different grouping than before?
The grouping depends on the code and on Components. After big changes in the code the groups can move. Fix the number of components to compare.
How is it different from the dependency graph?
The dependency graph shows every element you ask for. The blueprint summarizes the project in a few components, adds the layer rules and the findings, and is meant to be read as an architecture picture.
Thanks for your feedback. Tell us more or request a feature.
