• Dunstabzugshaubitze@feddit.org
    link
    fedilink
    arrow-up
    7
    ·
    1 day ago

    which is why many (oop)-patterns exist, what i described is a prime candidate for the strategy pattern, which basically means to turn different algorithms for a task into extra classes with the same interface that can be given to the transaction depending on it’s kind or something else in the context. the question is allways: does the pattern improve my code now or will it improve my code soon, because i know i have to implement 3 more of “almost the same”

    blindly applying a pattern or a guideline like “DRY” has allways the chance to turn into messy ball of code.