Shigoto Shoujin

Shigoto Shoujin dev blog, mostly C and C++

ShigotoShoujin on github - Discussions
15 October 2021

Refactor and SetParent

Refactor

Looking at the Window.cpp constructor code leaves a bad smell. It’s not self-documenting, and very hard to understand.
By adding more tests and then refactoring the class, the outcome smells much better.

Leaving bad smell would accumulate over time, and affect the motivation to go on.

It can be hard to write the code nicely on the first try, especially when experimenting.
This is why the test / refactor cycle is good.

If the existing code is an obstacle to the refactor, move it aside.
It’s faster to write from scratch while looking at the previous version, than to change the existing trying not to break it.

At which point to create the child window