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
Copy file name to clipboardExpand all lines: doc/decisions/dr-004.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,7 +91,7 @@ The following variants of this option, specifies different methods to cope with
91
91
92
92
#### Option 2a)
93
93
94
-
Instead of directly using a modified Arduino interface (for example for a specific `class`), we use an adapter.
94
+
Instead of directly using a modified Arduino interface provided by the extensions (for example for a specific `class`), we use an adapter.
95
95
The adapters would be integrated just as for option 1.
96
96
But compared to option 1 this only needs to be done for those smallest indivisible interfaces which are not compatible to the vanilla ACA.
97
97
@@ -113,8 +113,8 @@ Assuming that we do define interfaces for one or several HALs, we should not fol
113
113
Because that would possibly complicate to write adapters for different HAL implementations.
114
114
And allowing variants is one of the purposes of the adapters.
115
115
116
-
Instead we would design the interfaces such that they fit the usage.
117
-
In general an object oriented approach is sensible to represent the different components which are available through HALs.
116
+
Instead we should design the interfaces such that they fit the usage.
117
+
In general an object oriented approach is sensible to represent the different peripheral components which are available through HALs.
118
118
Also an object oriented approach is the most straightforward to implement dependency inversion.
119
119
120
120
This from those variants, **option 1a)** would be the best.
@@ -129,10 +129,10 @@ This from those variants, **option 1a)** would be the best.
129
129
- Using a different implementation of our - to be defined - HAL interface would not require to modify the users of our HAL interface.
130
130
Instead only a different adapter - implementing our HAL interface - would be required.[¹](<\ref dr004_1 "¹")
131
131
- Cons:
132
-
- This approach requires to write adapters for all HAL interfaces to 3rd party libraries.
133
-
This is difficult and may result in boilerplate code.
134
-
Note, that this would mean to write adapters to a HAL implementation, which is an adapter (to proprietary peripheral drivers) in itself.
135
-
-**Option 2a)**: Use adapters for extensions to vanilla ACA
132
+
- This approach requires to write adapters for all used HAL interfaces to 3rd party libraries.
133
+
A reusable interface is difficult to design and the adapters may result in boilerplate code.
134
+
Note, that this approach would mean to write adapters to a HAL implementation, which is an adapter (to proprietary peripheral drivers) in itself.
135
+
-**Option 2a)**: Use adapters only for extensions to vanilla ACA
136
136
- Pros:
137
137
- Compared to option 1a), only a fraction of the adapters would need to be written.
138
138
- Cons:
@@ -154,9 +154,9 @@ This from those variants, **option 1a)** would be the best.
154
154
- In general conditionally compiled sections of code reduces its readability.
155
155
156
156
\note \anchor dr004_1
157
-
¹: Although, *in practice* our HAL interface may not be suitable to accommodate the new HAL implementation (see [Rule of Three](https://en.wikipedia.org/w/index.php%3Ftitle%3DRule_of_three_%28computer_programming%29%26oldid%3D1173684754)).
157
+
¹: *In practice* our HAL interface may not be suitable to accommodate the new HAL implementation (see [Rule of Three](https://en.wikipedia.org/w/index.php%3Ftitle%3DRule_of_three_%28computer_programming%29%26oldid%3D1173684754)).
158
158
Thus we would have to adjust our HAL interface and the code using it accordingly.
159
-
In other words: It is difficult to design an HAL interface such that we would actually benefit when changing the HAL implementation to a different 3rd party library. Thus this advantage may not be relevant for that case.
159
+
In other words: It is difficult to design a HAL interface such that we would actually benefit when changing the HAL implementation to a different 3rd party library. Thus this advantage may not be relevant for that case.
160
160
Also - in case the HAL implementation is changed - it may be less effort to adjust all the uses of the new HAL interface than to write adapters for the changed 3rd party library.
161
161
162
162
\note \anchor dr004_2
@@ -173,7 +173,7 @@ After careful consideration, we've decided on:
173
173
174
174
And more specifically for testing on native environments, use:
175
175
176
-
> **Option 2b):** Where the ACA is used it is allowed to add small conditionally compiled sections for tests in order to cope with deviations of the ACA used in productive code from the vanilla ACA.
176
+
> **Option 2b):** Where the ACA is used, it is allowed to add small conditionally compiled sections for tests in order to cope with deviations of the ACA used in productive code from the vanilla ACA.
177
177
178
178
The latter relaxation is in order to facilitate the use of ArduinoFake to stub the HAL's interface.
0 commit comments