Need refactoring ideas for Arrow Anti-Pattern

后端 未结 7 1482
刺人心
刺人心 2021-01-02 02:13

I have inherited a monster.

It is masquerading as a .NET 1.1 application processes text files that conform to Healthcare Claim Payment (ANSI 835) standards, but it\'

相关标签:
7条回答
  • 2021-01-02 02:44

    A state machine seems like the logical place to start, and using WF if you can swing it (sounds like you can't).

    You can still implement one without WF, you just have to do it yourself. However, thinking of it like a state machine from the start will probably give you a better implementation then creating a procedural monster that checks internal state on every action.

    Diagram out your states, what causes a transition. The actual code to process a record should be factored out, and called when the state executes (if that particular state requires it).

    So State1's execute calls your "read a record", then based on that record transitions to another state.

    The next state may read multiple records and call record processing instructions, then transition back to State1.

    0 讨论(0)
提交回复
热议问题