What Design Pattern To Replace 'CurrentStep' Variable
Posted
by Rob P.
on Stack Overflow
See other posts from Stack Overflow
or by Rob P.
Published on 2010-05-09T21:33:44Z
Indexed on
2010/05/09
21:38 UTC
Read the original article
Hit count: 136
design-patterns
|vb.net
Tried to search but didn't know how to phrase it. I've got some code that is essentially...
Private CurMajorStep as Integer = 0
Private CurMinorStep as Integer = 0
Public Sub PerformNextStep()
Select Case iMajorStep
Case 0
ThingOne()
Case 1
ThingTwo()
Case 2
ThingThree()
Case 3
ThingFour()
Case 4
AnythingElse()
Case 5
Finish()
End Select
End Sub
And then, in some of those, the CurMinorStep keeps track of the current state of that particular 'step'.
I hope that all makes sense.
The code is messy and I know it's going to be problematic to maintain. Can someone point me to a clean OO pattern to handle this?
© Stack Overflow or respective owner