Skip to content

Commit 1547308

Browse files
Merge pull request #717 from etas-contrib/improvement_fix_implementation_review_findings
fix implementation review findings
2 parents 57c8ea0 + 3f58144 commit 1547308

6 files changed

Lines changed: 207 additions & 351 deletions

File tree

process/process_areas/implementation/guidance/_assets/dd_traceability.drawio.svg

Lines changed: 2 additions & 2 deletions
Loading

process/process_areas/implementation/guidance/_assets/static_view.drawio.svg

Lines changed: 3 additions & 3 deletions
Loading

process/process_areas/implementation/guidance/implementation_guideline.rst

Lines changed: 155 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,21 @@ Guideline
2222
:complies: std_req__iso26262__software_744[version==1],
2323
std_req__iso26262__software_841[version==1],
2424
std_req__iso26262__software_842[version==1],
25+
std_req__iso26262__software_843[version==1],
26+
std_req__iso26262__software_844[version==1],
27+
std_req__iso26262__software_845[version==1],
28+
std_req__aspice_40__SWE-3-BP1[version==1],
29+
std_req__aspice_40__SWE-3-BP2[version==1],
30+
std_req__aspice_40__SWE-3-BP3[version==1],
31+
std_req__aspice_40__SWE-3-BP4[version==1],
2532
std_req__aspice_40__iic-11-05[version==1]
2633

2734
This document describes the general guidance for implementation based on the concept which is defined :need:`[[title]]<doc_concept__imp_concept>`.
2835
An example of a Detailed Design is maintained in the
2936
`module template documentation <https://eclipse-score.github.io/module_template/detailed_design_example.html>`_.
3037

38+
**Scope:** This guideline applies to both QM (Quality Management) and ASIL B components. Where specific requirements differ between QM and ASIL B (e.g., complexity thresholds, design principles), they are explicitly noted.
39+
3140
Workflow for Implementation
3241
===========================
3342

@@ -36,12 +45,13 @@ Detailed description which steps are need for implementation.
3645
#. Consult which programming languages, design/coding guidelines and tools are used for Software
3746
development according the rules given in the project specific :need:`SW development Plan <wp__sw_development_plan>`.
3847
#. Create a Detailed Design by using the template :need:`gd_temp__detailed_design`.
39-
In this step, the components are broken down into smaller, independent units that can be tested
40-
separately during the unit testing phase. The detailed design shall be so exact, that test and
41-
implementation can be run simultaneously.
48+
Based on the :need:`Component Requirements <wp__requirements_comp>` and the
49+
:need:`Component Architecture <wp__component_arch>`, the components are broken down into smaller,
50+
independent units that can be tested separately during the unit testing phase.
51+
The detailed design shall be so exact that test and implementation can be run simultaneously.
4252
#. Implement the source code, by using the coding guidelines given within the project specific :need:`SW development Plan <wp__sw_development_plan>` for the programming languages in your project.
4353
#. Create a pull request for your change.
44-
#. Detail Design and Code Inspection is done to review the code of the software and detect errors in it.
54+
#. Detail Design and Code Inspection is done to review the code of the software and detect errors in it. See the detailed design and code :need:`inspection checklist <doc__feature_name_req_inspection>` for evaluation criteria.
4555
#. Check the results of the static and dynamic code analysis (this includes compiler warnings). Acceptance criteria are defined in the Verification Plan :need:`gd_temp__verification_plan`.
4656
#. Fix or justify the errors.
4757
#. Merge the pull request.
@@ -54,6 +64,12 @@ Traceability
5464
The detailed design is created by using the template :need:`gd_temp__detailed_design`. In the template
5565
the static and the dynamic view for unit interactions is described.
5666

67+
Traceability from requirements to units is established implicitly through the verification work products:
68+
:need:`unit tests <wf__verification_unit_test>` and :need:`component integration tests <wf__verification_comp_int_test>` reference specific requirement IDs and exercise
69+
the units that implement those requirements. This creates the necessary requirement-to-unit link for compliance
70+
and audit purposes. See the :ref:`verification process area <process_verification>` for details on how requirements
71+
are verified through tests that exercise specific units.
72+
5773
.. figure:: _assets/static_view.drawio.svg
5874
:align: center
5975
:width: 30%
@@ -75,3 +91,138 @@ The dynamic diagram satisfies the architecture and implements the requirements o
7591
:name: dd_traceability_fig
7692

7793
The unit description will be generated automatically based on the comments in the source code and from the interface description.
94+
95+
Detailed Design Guidance
96+
========================
97+
98+
Definition of a Unit
99+
--------------------
100+
101+
A **unit** is a **granular, independent entity** of a component that can be **tested separately**
102+
during the unit testing phase. Each unit represents a **self-contained functionality** and is
103+
derived from the decomposition of a component.
104+
105+
**Characteristics of a Unit**
106+
107+
- **Independent** - Can be tested in isolation.
108+
- **Granular** - Represents a small, well-defined part of the system.
109+
- **Relational** - Has associations with other units, defined using **UML 2.0 notations** such as
110+
aggregation, composition, and generalization.
111+
112+
**Examples:**
113+
The definition of a unit depends on the used programming language. Examples for a unit are
114+
a source file, a definition file (e.g. c++ header), classes, structs, and functions.
115+
This list is not complete or exclusive.
116+
117+
**Units in UML Diagrams**
118+
119+
- **C++ development** - Each **class** can be considered a **unit** in the design.
120+
- **Rust development** - A **unit** is modeled using a **combination of ``struct`` and ``trait``**,
121+
as Rust does not have traditional classes.
122+
123+
Units within the Component
124+
--------------------------
125+
126+
The relationship between a unit and its parent component is established implicitly through the
127+
**file path** - each component has its own directory, and units residing within that directory
128+
belong to it and therefore align with the architecture. A separate static diagram per unit is
129+
**not required**; the unit's attributes and behaviour are documented in the source code itself,
130+
as the source code is sufficiently self-explanatory and adheres to the design principles outlined
131+
in the development plan.
132+
133+
However, for components with complex interactions or a large number of units, a textual description,
134+
a static or dynamic view can be beneficial for understanding the overall structure and relationships
135+
between units. The developer may choose to add an additional unit-level description, static and dynamic
136+
view if this helps explain the source code better.
137+
138+
It is important that the naming of the units, their interfaces and functions in any diagrams or
139+
descriptions matches the naming in the source code to ensure traceability. This means the diagrams
140+
and descriptions should not be outdated, should stay consistent with the source code, and should not
141+
introduce new terminology or concepts that are not present in the code.
142+
143+
Design Principles of the Units
144+
``````````````````````````````
145+
146+
The unit design and implementation should target quality attributes like simplicity, modularity and encapsulation,
147+
using project-defined coding guidelines and static analysis tooling appropriate for the language
148+
in use as specified in the software development plan.
149+
150+
For ASIL B components, the software development plan shall mandate compliance with the design principles
151+
specified in ISO 26262-6 §8.4.5 Table 6. These principles shall be enforced through project-specific
152+
coding guidelines and automated static analysis tooling.
153+
154+
The **source code** itself should be self-documenting with meaningful naming and structure.
155+
**Code comments** may be used where the logic is not self-evident and to provide rationale.
156+
These comments, along with commit messages, and any additional documentation accompanying the
157+
source code should use natural language.
158+
159+
The interface documentation of a software unit is part of the source code (e.g. public API headers,
160+
trait definitions, or documented function signatures). If interfaces of the units are also interfaces
161+
of the component, they should follow the same documentation rules as the component interfaces
162+
(see :need:`gd_guidl__arch_design`).
163+
164+
Especially for public interfaces, the interface naming should follow the naming of the logical
165+
interface in the feature and component architecture to ensure traceability. The interface
166+
documentation should be clear and comprehensive so users of the unit can understand how to interact
167+
with it without needing to read implementation details. The documentation should be maintained and
168+
updated as the implementation evolves.
169+
170+
Diagrams
171+
--------
172+
173+
Developers may add optional diagrams at the unit level if they believe it helps to explain the
174+
source code better. These are supplementary documentation and are not mandatory. Details are
175+
described in the following sections.
176+
177+
Static View
178+
```````````
179+
180+
If a static view is used, it should provide an overview of the **units** and their relationships
181+
using **UML 2.0 notations**, such as **aggregation, composition, and generalization**. It is depicted
182+
through **UML structural diagrams**, including:
183+
184+
- **Class Diagrams** - Define classes, attributes, methods, and relationships (e.g. inheritance,
185+
associations, dependencies).
186+
- **Component Diagrams** - Show the organization and dependencies among software units, which can be
187+
used to represent the units within a component.
188+
- **Rust** - Uses ``struct`` and ``trait`` combinations to represent units in UML diagrams.
189+
190+
The static view need not cover every class or struct in the implementation - it should show the units
191+
and relationships that are necessary to understand the detailed design.
192+
193+
The naming of the units and their interfaces in the static view should match the naming in the source
194+
code to ensure traceability. Implementation details that are not relevant at the design level may be
195+
omitted.
196+
197+
According to the software development plan of the project, the developer may use tools like PlantUML
198+
or Draw.io for such diagrams.
199+
200+
Dynamic View
201+
````````````
202+
203+
An optional **dynamic view** illustrates how the **units** within a component interact over their
204+
**interfaces** to fulfill a specific **use case** or **functionality**. This is a **component-level**
205+
view - individual per-unit dynamic diagrams are **not required**.
206+
207+
It is represented using **UML behavioural diagrams**, including:
208+
209+
- **Sequence Diagrams** - Depict interactions between objects in a time-ordered sequence,
210+
highlighting how methods are invoked and how control flows between objects over time.
211+
- **State Machine Diagrams** - Show how the state of an object changes in response to events,
212+
allowing the modeling of complex state transitions (if there is stateful behaviour).
213+
214+
A dynamic view is optional when the component's behaviour is straightforward and can be understood
215+
from the static view and interface documentation alone (similar to the rules depicted in
216+
:need:`gd_guidl__arch_design`).
217+
218+
Example using PlantUML:
219+
220+
.. uml::
221+
222+
@startuml
223+
participant UnitA
224+
participant UnitB
225+
226+
UnitA -> UnitB : request()
227+
UnitB --> UnitA : response()
228+
@enduml

0 commit comments

Comments
 (0)