How to: Clean Architecture for Systems Engineering
What software engineering can teach us about modelling
How do we make SysML v2 textual notation accessible to non-software engineers?
That was the first question I got after opening a session at a Systems Engineering Bar Camp.
Being enthusiastic about SysML v2 after working with the language for a couple of years, that wasn’t the question I was looking for. However, the question was a real concern. Software engineering is different in one way: it is invisible. Unlike a gear or a circuit board, software has no shape you can hold or draw.
While SysML v2 supports both textual and visual notations, the current tools are mostly focused on textual notation. They support semantic highlighting and can find keywords, much like software development tools. This underlines the concern even more. The concern at the Bar Camp was not whether engineers can learn a new syntax. It was whether an engineer whose instinct is to reach for something physical can build a credible architecture by typing it into an editor - the same way a developer writes a function.
Design Principles and anti-pattern in Software
Over decades, software engineering has collected its hard-won lessons and given them names. Design principles describe the qualities of good design: properties a structure should have so it stays understandable and changeable. Anti-patterns describe the opposite: recurring solutions that seem reasonable at first but violate those principles and cause problems over time.
A design principle that describes good design is high cohesion and low coupling. High cohesion means that one building block does one specific task. If the task needs to change, everything relevant can be found in that cluster. Low coupling means that building blocks know as little about each other as possible and only communicate through defined interfaces. As long as an interface stays the same, one block can change without the others noticing.
On the flip side, if one cluster does all the work of different tasks, it is called a god class. When one thing changes, the class has to change too and vice versa: if the class changes, everything else has to change.
SysML v2 looks like code, but do the lessons behind software engineering apply to systems architecture?
In order to answer that question, it is important to look at an array of design principles and anti-patterns, preferably with a positive and negative example for each principle and anti-pattern. The robotic vacuum cleaner from the GfSE will be used as the source for the examples [1]. It should be noted here, that finding no example is also a result. It may mean that a principle or anti-pattern does not transfer to systems architecture, or simply that this model does not contain the case.
The design principles examined here are low coupling and high cohesion; the anti-pattern is the god class.
Low Coupling
Definition: Building blocks know as little about each other as possible and only communicate through defined interfaces. As long as an interface stays the same, one block can change without the others noticing.
From RobotVacuum.sysml:
// Suction level: ends at the vacuuming system's port
interface : VacuumingSystem::suctionLevelPorts connect
supplierPort ::> ControllerSystem.suctionLevel to
consumerPort ::> VacuumingSystem.suctionLevel;
// Brush rotation level: reaches into the internal brush system (bs)
interface : brushRotationLevelPorts connect
supplierPort ::> ControllerSystem.brushRotationLevel to
consumerPort ::> VacuumingSystem.bs.brushRotationLevel;
Good (suction level): The controller only talks to the boundary of the vacuuming system, its port. How the signal travels inside is up to the subsystem. The suction unit can be replaced or rebuilt, and the top level never notices, as long as the port stays the same.
Bad (brush rotation level): The controller bypasses the boundary and connects directly to an internal part (bs). Now the top level has to know how the vacuuming system is built inside. Any change to the brush system, whether it is renamed, replaced or split, breaks the connection, even though nothing has changed at the boundary.
In short: Both signals go from the same sender to the same subsystem. The only difference is where the connection ends: at the boundary or behind it. That difference illustrates low coupling.
High Cohesion
Definition: A building block does one specific task. Everything that belongs to that task lives in that block, and nothing else does.
From EnergySupply.sysml:
part chr : Charger; // charges the battery
part bat : Battery; // stores energy
part reg : VoltageRegulator; // regulates voltage
part cpu : BatteryLevelComputer; // ?
From BatteryLevelComputer.sysml:
port chargeCmd : ChargeCommand; // tells the charger to start or stop
port energyLevel : EnergyRegulation; // sets the target voltage
// out ref ledSig {...} // LED colour, commented out
Good (charger, battery, voltage regulator): Each part has one clear job, and its name says what it is. If the charging behaviour changes, you go to the charger. If the voltage needs adjusting, you go to the regulator. Everything relevant to one task lives in one place.
Bad (battery level computer): The name says it computes the battery level. Its comment says it computes a colour for the LED. Its ports say something else again: it decides when to charge and sets the target voltage. Three tasks in one part, and only one of them matches the name. Anyone who wants to change the LED display ends up touching the charging logic.
In short: All four parts sit in the same subsystem, at the same level. Three of them do one thing each. The fourth collects whatever had no other place to go. That is how low cohesion starts, and if it keeps growing, it becomes a god class.
God Class (Anti-Pattern)
Definition: A single building block that collects responsibilities from across the system. Everything depends on it, and it depends on everything. When anything changes, it has to change. When it changes, everything else might have to change too.
From NavigationSystem.sysml, shortened:
part def Navigation {
part driveController : DriveController;
part engine[2] : Engine;
part laserTower : LaserTower;
part bumber : Bumper; // [sic]
part infraredController : InfraredController;
interface : BumperInterface connect ...
interface : LaserTowerInterface connect ...
interface : PwmControlInterface connect ...
}
From ControllerSystem.sysml:
part def Controller {
action def IsCarpet;
attribute def StartVacuumingSignal;
attribute def StopVacuumingSignal;
attribute def IdleVacuumingSignal;
port driverSignalOutputPort : DriverUnitControlPort; // navigation
port powerSignal : ~PowerSignal; // energy
port suctionLevel : SuctionLevel; // vacuuming
port brushRotationLevel : BrushRotationLevel; // vacuuming
port fillState : ~FillState; // vacuuming
}
Good (navigation system): Navigation contains its sensors, drive controller and motors, and only wires them together. It has one concern, moving the robot, and it delegates the work to its parts. Nothing outside navigation depends on what happens inside it.
Warning sign (controller): The controller is connected to every other subsystem: it steers navigation, receives energy, sets suction and brush speed, and reads the fill level. On top of that, it holds its own behaviour, like detecting carpet. Today, it is small. But every new feature that involves more than one subsystem has an obvious place to go: the controller.
In short: A central controller is not wrong. Real systems need coordination. It becomes a god class when it stops coordinating and starts doing the work itself. The controller in this model sits right at that line, and that’s what makes it worth watching.
Conclusion
What can be seen here is that these principles and anti-patterns can be applied here and found in the systems architecture. Just as there are no rules in software engineering that must be followed to the letter, these principles help improve software code quality. In the same way, they can help improve systems architecture.
The low-coupling examples show that an interface can lie on the boundary, while the building blocks can change internally without affecting the interface. An interface that goes beyond the boundary and into a building block, however, can have its connection broken by a refactor.
The high-cohesion examples show the importance of doing only one specific task. If one building block does more, it can quickly become a god class.
That is exactly what happened to the controller, which only grew in functionality as new functionality was added to the system. Unlike the navigation system, which delegated work, the controller started doing all the work. That is how a god class grows: not by design, but because it is the only part that knows everyone.
That implies that these principles are not language-specific. Low coupling, high cohesion and the god class describe relationships between responsibilities, as do the other design principles and anti-patterns used within software engineering.
SysML v2, with its textual notation, makes those relationships explicit in the same way code does: ports, interfaces, part definitions and behaviour are not diagrams you interpret — they are declarations you can read, reason about and critique.
This matters because it opens up a new way to perform quality control in systems architecture: semantic model-quality review. With visual architecture, the syntax can be checked: are the connections valid, is a name missing or incorrect, and does the stereotype fit? Semantic review is more difficult. Does this block have only one responsibility, or does this interface really have low coupling? The meaning of the diagram was outside the model, where no tool could reach it to validate or verify it.
In the software engineering world, principles like these are part of code-review checklists. If the same principles apply to SysML v2, and these examples suggest they do, then model quality is no longer just a matter of expert judgement. It becomes something that can be checked, taught and automated.
Today
In software development, the development process includes pull requests before the code gets merged into the repository. Additionally, a code review is done using a checklist: does this function do one thing, are the dependencies explicit, and is there anything here that will make the next change harder? That process exists because good design does not happen by accident. It is checked.
The same process can be applied to systems architecture. A checklist based on the principles gives the reviewer something to look for. Additionally, this makes technical debt visible, as it names the issue and gets it documented rather than leaving it as a gut feeling.
Maybe the concern at the BarCamp wasn’t really about software engineering, but about defining a system in software. Perhaps we don’t need to reinvent the wheel. We should start by looking at what software engineering has already learned about designing complex systems.
[1] MBSE_AG_vacuum-cleaner-robot-example/Functions/VacuumingRoboterSystem at master · GfSE/MBSE_AG_vacuum-cleaner-robot-example · GitHub

Diskussion über diese Post