With cross-cutting concerns, I like to begin with copy/paste
With cross-cutting concerns, I like to begin with copy/paste. I accept the duplication at first. Once I've copy pasted a few times and exercised the code a bit, it's easier to see what the ideal abstraction is.
Related quote: "Prefer duplication over the wrong abstraction." - Sandy Metz
A solid post by Sandy on this: https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction
Summary: Duplicate at first. Eliminate duplication when the right abstraction is clear.