You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each **class** can be considered a **unit** in the design.
90
-
- **Rust Development Approach** – Instead of traditional classes, **Rust uses `struct` and `trait`
91
-
combinations** to represent **units** in UML diagrams.
92
-
93
-
This view focuses **units, the interfaces and their relationships**.
94
-
Details such as **attributes and interfaces** are documented under the **Units within the Component section**
95
-
(refer to the template for details).
96
-
97
-
Note that the detailed design may not be complete in the way that it covers every class which is coded.
98
-
These not covered parts may contain implementation detail and should not be needed to understand the
99
-
the detailed design.
100
-
101
-
.. code-block:: rst
102
-
103
-
.. dd_sta:: <Title>
104
-
:id: dd_sta__<Component>__<Title>
105
-
:security: <YES|NO>
106
-
:safety: <QM|ASIL_B>
107
-
:status: <valid|invalid>
108
-
:implements: <link to component requirement id>
109
-
:satisfies: <link to component architecture id>
110
-
:belongs_to: <link to component id>
111
-
:includes: <link to sw_unit id>, <link to sw_unit interface id>
112
-
113
-
.. needarch:: or .. image:: <link to drawio image>
114
-
115
-
Dynamic View
116
-
````````````
117
-
The **dynamic view** illustrates how the **units** interact with each other over **interfaces** to fulfill a specific
118
-
**use case** or **functionality**. This view captures the **behavioural aspects** of the component as it executes.
119
-
It is represented using **UML behavioural diagrams**, including:
120
-
121
-
- **Sequence Diagrams** – Depict the interactions between objects in a **time-ordered sequence**,
122
-
highlighting how methods are invoked and how control flows between objects over time.
123
-
- **State Machine Diagrams** – Show how the **state of an object changes** in response to events,
124
-
allowing for the modeling of complex state transitions (if there is stateful behaviour).
125
-
126
-
These diagrams are essential for understanding the **dynamic behaviour** of the component and how
127
-
units collaborate to perform tasks. But this also means that if the dynamic behaviour is simple
128
-
it does not require a dynamic diagram at all (similar to the rules depicted in :need:`gd_guidl__arch_design`).
129
-
130
-
.. code-block:: rst
131
-
132
-
.. dd_dyn:: <Title>
133
-
:id: dd_dyn__<Component>__<Title>
134
-
:security: <YES|NO>
135
-
:safety: <QM|ASIL_B>
136
-
:status: <valid|invalid>
137
-
:implements: <link to component requirement id>
138
-
:satisfies: <link to component architecture id>
139
-
:belongs_to: <link to component id>
140
-
:includes: <link to sw_unit id>, <link to sw_unit interface id>
141
-
142
-
.. needarch:: or .. image:: <link to drawio image>
143
-
144
84
Units within the Component
145
85
--------------------------
146
86
147
-
For each unit it will have a id and the interfaces are shown in the interface view per unit.
148
-
The description of unit and its attributes can be seen in the code documentation.
149
-
For this we use the tracing to the documentation generated from the code comments.
87
+
The relationship between a unit and its parent component is established implicitly through the
88
+
**file path** — each component has its own directory, and units residing within that directory
89
+
belong to it and therefore inherit the accordance to the architecture. A separate static diagram
90
+
per unit is **not required**; the unit's attributes and behaviour are documented in the source
91
+
code itself as the source code is sufficiently self-explanatory and adheres to the design principles outlined in the development plan.
150
92
151
-
We link the unit id to the comments in the code like:
93
+
This is sufficient for ASIL B compliance per :need:`ISO 26262-6 §8 <std_req__iso26262__software_841>`, as the structural decomposition
94
+
is evident from the directory layout and the component-level static view already captures the
95
+
relevant unit relationships.
152
96
153
-
- Maintain your units in rst files and link them to the source code
97
+
However, for components with complex interactions or a large number of units, a static view can be beneficial for understanding the overall structure and relationships between units. The developer may choose to add a additional unit-level static and dynamic view if they believe it helps to explain the source code better.
154
98
155
-
Use `score_source_code_linker` from `docs-as-code` repo with
The unit design shall achieve quality attributes (like simplicity, modularity, and encapsulation) which shall be enforced through coding guidelines and static analysis tooling appropriate for the programming language in use (e.g. MISRA C for C/C++, Clippy lints for Rust) as specified in the project development plan to fulfill the guidelines :need:`ISO 26262-6 §8.4.5, Table 6 <std_req__iso26262__software_845>` and :need:`ASPICE SWE.3/SWE.4<std_req__aspice_40__SWE-3-BP3>` requirements.
159
103
160
-
.. code-block:: rst
104
+
The **source code** itself shall be self-documenting with meaningful naming and structure.
105
+
**Code comments** may be used where the logic is not self-evident and to give an rationale.
106
+
These comments, along with commit messages, and any additional documentation accompanying the
107
+
source code shall use natural language.
161
108
162
-
.. sw_unit:: cpp unit
163
-
:id: sw_unit__<Component>__<title>
164
-
:belongs_to: <link to component id>
109
+
The interface documentation of a software unit is part of the source code (e.g. public API headers,
110
+
trait definitions, or documented function signatures).
165
111
166
-
This implements the ....
112
+
Diagrams
113
+
--------
167
114
168
-
In your source file, any programming language, here with C++:
115
+
Developers may add **class diagrams** or **sequence diagrams** at the unit level if they believe
116
+
it helps to explain the source code better. These are optional and serve as supplementary
117
+
documentation — they are not required by the process.
169
118
170
-
.. code-block:: cpp
171
-
172
-
# need-Id: sw_unit__<Component>__<title>
173
-
class <class name> {
174
-
public:
175
-
176
-
};
177
-
178
-
- For cpp using doxygen style comments
179
-
180
-
.. code-block:: cpp
181
-
182
-
/**
183
-
* @rst
184
-
* .. sw_unit:: cpp unit
185
-
* :id: sw_unit__<Component>__<title>
186
-
* :belongs_to: <link to component id>
187
-
*
188
-
* This implements the ....
189
-
* @endrst
190
-
*/
191
-
192
-
- for rust
193
-
194
-
.. code-block:: rust
195
-
196
-
//! .. sw_unit:: rust unit
197
-
//! :id: sw_unit__<Component>__<title>
198
-
//! :belongs_to: <link to component id>
199
-
//!
200
-
//! This implements the ....
201
-
202
-
203
-
Interface View
204
-
``````````````
205
-
For every unit, the Interface View should display the interfaces provided by that unit.
206
-
For each unit and its corresponding interfaces, an implementation and documentation must
207
-
be created.
208
-
209
-
The following section provides templates for defining needs within the source code:
210
-
211
-
- Maintain your units in rst files and link them to the source code
212
-
213
-
Use `score_source_code_linker` from `docs-as-code` repo with
0 commit comments