Making Non-Functional Constraints Visible in UML with Profiles and Stereotypes
Use a small UML Profile with stereotypes and tagged values to keep safety, performance and security constraints attached to model elements instead of buried in documents.
29 Jul 2025, 22:59 UTC

The design review starts well until someone asks where the safety requirements live. The class diagram shows PaymentProcessor, AuthService and Ledger. The architecture document mentions SIL levels, latency budgets and encryption requirements. The two artifacts drift apart, and the constraints get checked only late, in code review.
A small, project-owned UML Profile can keep those constraints attached to the model elements they govern. The thesis is simple: use stereotypes, tagged values and constraints to make non-functional concerns first-class annotations in UML 2.5+ diagrams, without leaving standard tooling.
Non-functional requirements disappear when they are not modeled
Functional structure is easy to draw. Classes, components and operations map directly to boxes and arrows. Safety, performance, security and reliability are cross-cutting. Teams tend to capture them in spreadsheets, ADRs or comments. That separation makes them invisible during modeling, hard to trace, and easy to miss during refactoring.
UML Profiles provide a standard extension mechanism in UML 2.x. A profile is a package of stereotypes that extends existing metaclasses like Class, Component or Operation. Stereotypes add vocabulary, tagged values add data, and constraints add rules. The core metamodel is unchanged, so the model remains standard UML and can be exchanged as XMI.
What a lightweight profile looks like
A practical engineering decision is to define a minimal profile for the concerns that repeatedly cause risk in your domain. Keep it small, project-owned, and focused on visibility rather than full code generation.
Common patterns are stereotypes such as <> for safety, <> for performance, and <> for security. Apply them to the metaclass where the concern is relevant, e.g., Class or Operation. Add tagged values for parameters that need to be recorded, and a constraint to express a rule that must be documented.
Tool support varies by vendor and version. Some tools render stereotypes with guillemets, show tagged values in properties panes, and evaluate OCL constraints. Others treat stereotypes as documentation only. Assume UML 2.5+ and verify the specific tool’s profile capabilities before relying on automated checks.
Worked example: SafetyProfile with <>
Profile name: SafetyProfile
Stereotype: <> extends Class
Tagged values:
- safetyLevel : String, allowed values 1, 2, 3
- failureMode : String
Constraint: a class stereotyped <> must have failureMode documented and safetyLevel set.
Application: PaymentProcessor is modeled as a Class. Apply <> from SafetyProfile. Set safetyLevel = 3 and failureMode = "degraded authorization with manual fallback". The stereotype appears on the diagram as <> PaymentProcessor, and the tagged values are visible in the element properties.
Practical verification: open the model in a UML 2.x compliant tool, create the profile, define the stereotype extending Class with the tagged values, apply it to PaymentProcessor, then inspect the exported XMI for a profileApplication referencing SafetyProfile and an extension of the Class element. This confirms the annotation is stored in the model, not just in the UI.
Profiles improve communication because the constraint lives with the element. Architects see risk at a glance, engineers know what to implement, and model-driven checks can flag missing data before code is written.
Trade-off: visibility versus governance
Stereotypes do not enforce semantics by themselves. Without validation rules in the toolchain they remain documentation. The real cost is profile proliferation. When each team invents <>, <>, <> with different tagged values, cognitive load rises and automation breaks.
Lightweight profiles are preferable to heavy domain-specific languages. Keep the profile to three to five stereotypes, define a naming convention, and store the profile as a single source artifact in version control. Review changes like code. Avoid tool lock-in by preferring standard stereotype, tagged value and constraint constructs over vendor-specific extensions.
Limitations to plan for: OCL constraint evaluation is uneven across tools, rendering of stereotypes differs, and some tools do not preserve profile information on import/export. Test the profile in the exact tool chain used for modeling and code generation.
Actionable next step
Start with one concern that causes repeated review findings. Define a profile with one stereotype, one tagged value, and one documented constraint. Apply it to three model elements in an existing diagram and add a model validation checklist that verifies the tagged values are present.
When the pattern proves useful, expand to performance and security stereotypes. Governance comes last: a short profile catalog, naming rules, and a single owner prevent sprawl while keeping non-functional constraints visible where design decisions are made.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.