Identifying Common Code Smells - Arne Mertz - C++ on Sea 2022

preview_player
Показать описание
---

Identifying Common Code Smells - Arne Mertz - C++ on Sea 2022

Code smells are subtle or not so subtle hints that there may be problems within our code. Some code smells are universal and independent of the language we use, others are C++ specific. Usually, a code smell represents violations of basic design principles or negligence of idioms and patterns that would make the code easier to grasp and maintain.
In this talk, we will see examples of code smells from real code bases, and how they can be identified and fixed.
---

Arne Mertz

Arne Mertz has been working with modern and not-so-modern C++ codebases for over 13 years in embedded and enterprise contexts. He is a mentor and teacher for clean code and modern C++ for colleagues and customers at Zühlke Engineering and a freelance trainer. Since 2015 he writes more or less frequently about those topics on his blog "Simplify C++!".
---

C++ on Sea is an annual C++ and coding conference, in Folkestone, in the UK. The 2022 conference was conducted as a two part, physical and online C++ event.

---

#Programming​ #Cpp​ #CppOnSea​
Рекомендации по теме
Комментарии
Автор

salariesByName - the simple naive loop is easy to write, easy to read and comprehend and has very little you can do wrong. Now the std::transform of that is just hideous. That is not just "a bit more readable". std:: transform in general is just not nice to read. Ranges were supposed to make this better but they too seem to fall flat in terms of useability (at least with c++23 some of the glaringly obvious stuff has been fixed).

The codingstyle-guidelines seem a bit iffy at times.
Right now i would like to have better code, but the last thing i had to change is.... smelly.... to the point that i talked with 3 coworkers and for all of them the reaction was the same: "this is ugly, i don't want that, i do't want to write that, but it is the best you can do without a major change to an already running production system". And even this "quick&dirty" solution took me a couple of days, doing it nicely would involve several meetings with people from other countries, product management, sales and so on.
If only the requirements were clear 3 years ago when the system was designed.

ABaumstumpf