Fun fact: Win32 checkboxes are buttons with a bitflag that says they are actually checkboxes.
TL;DR: Vibes
Here we're loading the customer record and updating their discount %
Here we're loading the broker record and updating their commision %
They will have 99% identical code.
It's possible but exceedingly unlikely we have found 2 things that should be a load_record_and_update_percent(file,id,field,val)
Tomorrow the business logic behind one of those will no longer be a simple % and now you have a real mess.
It can, that's all about how aggressively you factor and structure your code, eg. combinators make it easy to reuse code in different application patterns without rewriting.