[riot-devel] kinetis common - differences between families

Kaspar Schleiser kaspar at schleiser.de
Sat Mar 14 12:54:36 CET 2015


On 03/13/15 19:59, Hauke Petersen wrote:
> Of course this leads to some duplication of code, but in the end it
> leaves the overall folder structure very clean and it is always clear,
> where the code you are currently building is coming from.
No. Code duplication is evil.

It leads to regressions, features in only half the actual codefiles, ...

It makes fixing bugs harder as the same bugfix has to be applied n times.

It makes diffs harder to debug as one hunk will appear multiple times, 
with slight differences very similar to the mistakes a review is 
supposed to find.

Rarely one developer will have all platforms available, so testing will 
often only be performed for the code version a developer has the board 
lying around, all other modifications in duplicated code being in a 
"should work" state.

In short, duplicating (multiplying) code multiplies corresponding 
maintanance overhead.

If the price for avoiding code duplication is a somewhat more nested 
folder structure, IMHO it is more than worth it.

Check out "cpu/stm*/syscalls.c" as an example where "let's just copy the 
file for now" leads to. Those files are *mostly* identical, they could 
be the same file, but they do have minor differences. This is totally 
unnecessary code duplication with all the implied disadvantages.


More information about the devel mailing list