Skip to content

Commit 0db77d1

Browse files
rework implementation (#689)
* rework implementation * add links
1 parent b5d98e9 commit 0db77d1

1 file changed

Lines changed: 67 additions & 161 deletions

File tree

process/process_areas/implementation/implementation_concept.rst

Lines changed: 67 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ Detailed Design
3838
===============
3939

4040
In this step, the **components** are broken down into smaller, independent **units** that can be
41-
**tested separately** during the unit testing phase.
41+
**tested separately** during the unit testing phase. This decomposition shall support the implementation
42+
and testing of the component's requirements while adhering to the design principles and patterns
43+
established in the architecture.
4244

4345
Following the **Detailed Design Template** :need:`gd_temp__detailed_design`, we must document the
4446
**design decisions** and **constraints** that guide the decomposition of the component into multiple
@@ -48,7 +50,7 @@ units. These decisions should be made based on the following ideas:
4850
- **Design patterns**
4951
- **Testability strategies**
5052

51-
The goal is to ensure that the decomposition supports **reusability** , **maintainability**,
53+
The goal is to ensure that the decomposition supports **reusability**, **maintainability**,
5254
**scalability**, **extensibility** and **ease of testing**.
5355

5456
The detailed design and implementation should follow an **iterative approach**, allowing for
@@ -75,189 +77,93 @@ This list is not complete or exclusive.
7577

7678
**Units in UML Diagrams**
7779

78-
- **C++ development** Each **class** can be considered a **unit** in the design.
79-
- For **Rust development**, a **unit** is modeled using a **combination of `struct` and `trait`**,
80+
- **C++ development** Each **class** can be considered a **unit** in the design.
81+
- **Rust development** – A **unit** is modeled using a **combination of `struct` and `trait`**,
8082
as Rust does not have traditional classes.
8183

82-
Static View
83-
```````````
84-
The **static view** represents the **units** and their relationships using **UML 2.0 notations**,
85-
such as **aggregation, composition, and generalization**. This is depicted through
86-
**UML structural diagrams**, including:
87-
88-
- **Class Diagrams** – Define **classes, attributes, methods, and relationships** (e.g., inheritance, associations, dependencies).
89-
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-
14484
Units within the Component
14585
--------------------------
14686

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.
15092

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.
15296

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.
15498

155-
Use `score_source_code_linker` from `docs-as-code` repo with
156-
`user docu <https://eclipse-score.github.io/docs-as-code/main/how-to/source_to_doc_links.html>`__.
99+
Design Principles of the Units
100+
``````````````````````````````
157101

158-
In your rst file:
102+
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.
159103

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.
161108

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).
165111

166-
This implements the ....
112+
Diagrams
113+
--------
167114

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.
169118

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
214-
`user docu <https://eclipse-score.github.io/docs-as-code/main/how-to/source_to_doc_links.html>`__.
119+
Static View
120+
```````````
215121

216-
In your rst file:
122+
If a static view is used it shall provide an overview of the **units** and their
123+
relationships using **UML 2.0 notations**, such as **aggregation, composition, and
124+
generalization**. It is depicted through **UML structural diagrams**, including:
217125

218-
.. code-block:: rst
126+
- **Class Diagrams** – Define classes, attributes, methods, and relationships (e.g.,
127+
inheritance, associations, dependencies).
128+
- **Component Diagrams** – Show the organization and dependencies among software units,
129+
which can be used to represent the units within a component.
130+
- **Rust** – Uses `struct` and `trait` combinations to represent units in UML diagrams.
219131

220-
.. sw_unit_int:: <here InterfaceDemo - change it>
221-
:id: sw_unit_int__<Component>__<title>
222-
:belongs_to: <link to sw_unit id>
223-
:implements: <real_arc_int, real_arc_int_op>
132+
The static view need not cover every class or struct in the implementation — it should show
133+
the units and relationships that are necessary to understand the detailed design.
134+
The naming of the units and their interfaces in the static view should match the naming
135+
in the source code to ensure traceability. Implementation details that are not relevant
136+
at the design level may be omitted.
224137

225-
This implements the ....
138+
According to the software development plan of the project the developer may use tools
139+
like PlantUML or DrawIo for such diagrams.
226140

227-
In your source file, any programming language, here with C++:
141+
Dynamic View
142+
````````````
228143

229-
.. code-block:: cpp
144+
An optional **dynamic view** illustrates how the **units** within a component interact over their
145+
**interfaces** to fulfill a specific **use case** or **functionality**. This is a
146+
**component-level** view — individual per-unit dynamic diagrams are **not required**.
230147

231-
# need-Id: sw_unit__<Component>__<title>
232-
class InterfaceDemo
233-
{
234-
public:
235-
virtual ~InterfaceDemo() {}
236-
virtual void OverrideMe() = 0;
237-
};
148+
It is represented using **UML behavioural diagrams**, including:
238149

239-
- For cpp using doxygen comments
150+
- **Sequence Diagrams** – Depict the interactions between objects in a time-ordered sequence,
151+
highlighting how methods are invoked and how control flows between objects over time.
152+
- **State Machine Diagrams** – Show how the state of an object changes in response to events,
153+
allowing for the modeling of complex state transitions (if there is stateful behaviour).
240154

241-
.. code-block:: cpp
155+
A dynamic view is **optional** when the component's behaviour is straightforward and can be
156+
understood from the static view and interface documentation alone (similar to the rules
157+
depicted in :need:`gd_guidl__arch_design`).
242158

243-
/**
244-
* @rst
245-
* .. sw_unit_int:: cpp unit
246-
* :id: sw_unit_int__<Component>__<title>
247-
* :belongs_to: <link to sw_unit id>
248-
* :implements: <real_arc_int, real_arc_int_op>
249-
*
250-
* This implements the ....
251-
* @endrst
252-
*/
159+
Example using PlantUML:
253160

254-
- For rust
161+
.. uml::
255162

256-
.. code-block:: rust
163+
@startuml
164+
participant UnitA
165+
participant UnitB
257166

258-
//! .. sw_unit_int:: rust unit
259-
//! :id: sw_unit_int__<Component>__<title>
260-
//! :belongs_to: <link to sw_unit id>
261-
//! :implements: <real_arc_int, real_arc_int_op>
262-
//!
263-
//! This implements the ....
167+
UnitA -> UnitB : request()
168+
UnitB --> UnitA : response()
169+
@enduml

0 commit comments

Comments
 (0)