That's the best question that nearly no one asks. I'm with you on Quantlib and Strata, haven't really seen a very good design around but I've seen quite a few bad ones.
It is definitely doable and has big advantages in terms of testing, maintenance, scalability.
The golden rule is that your objects must correspond to concepts.
The core problem (in bad ...