PROGRAMMING TIP
avoid repeating the same 4 lines of code twice by writing 270 lines of beautiful, abstract, generic code

@jk So when four things fail, you have to go through the 270 lines of abstract, generic code looking for the correct line to change.

As opposed to fixing it in one of the four places but forgetting the other three.

Meh. It's a subject of debate. I'd still rather have a single place to change it. 🤔

@GrahamDowns
Third option: use #define to create a macro of your 4 lines of code, so you only have to type a few letters each time! Best of both worlds! (As long as you aren't worried about the size of the resulting compiled program).
@jk

@dheadshot There are always going to be minor changes in each implementation, though, to make it fit the context. Variable names, mostly. I don't know the tool you're talking about though, so I don't know if it's able to handle that. And when it comes to maintenance/enhancement/bug fixing, will I still be able to make the change in only one place and have it automatically propagate to all four places?

If so, then what you're describing is basically creating a single, generic, abstract function that you call from four different places. In which case, we have an accord. :-)

If not, then see my other replies: one of the biggest issues with duplicating code like that is that people change it in one place but don't know or forget that they need to change it in three others. The three other places maybe affect functionality that's not used very often or not used by very many clients, so it gets overlooked... until the next release, maybe months down the line, where it causes a show-stopping bug for a client and now we have to drop everything and work all-nighters to get it fixed. It's happened. @jk