oopanti-patterns

Sequential coupling in code


Is sequential coupling really a bad thing in code?

Although it's an anti-pattern, the only risk I see is calling methods in the wrong order but documentation of an API/class library with this anti-pattern should take care of that. What other problems are there from code which is sequential? Also, this pattern could easily be fixed by using a facade it seems.

Thanks


Solution

  • Even in Wiki article you mentioned there is an opinion that

    This may be an anti-pattern, depending on context.

    In many cases there is no other way. Eventually we use algorithms to solve tasks. And they are by definition

    an effective methods for solving a problem using a finite sequence of instructions

    Sometimes it's possible to hide this sequence. But not always.