Identifier for the “completed” stage of a process: 0, 99, something else?

Posted by Arnold Sakhnov on Programmers See other posts from Programmers or by Arnold Sakhnov
Published on 2012-11-23T04:02:29Z Indexed on 2012/11/23 5:09 UTC
Read the original article Hit count: 788

Filed under:
|
|

Say, that you are handling a multi-step process (like a complex registration form, with a number of steps the user has go through in order). You need to be able to save the current state of the process (e.g. so the user can come back to that registration form later and continue form the step where they were left off).

Obviously, you’ll probably want to give each “step” an identifier you can refer to: 1, 2, 3, 4, etc. You logic will check for this step_id (or whatever you call it) to render the appropriate data.

The question: how would you identify the stage after the final step, like the completed registration state (say, that you have to give that last “step” its own id, that’s how your logic is structured). Would it be a 0, 999, a non-integer value, something else entirely?

© Programmers or respective owner

Related posts about naming

Related posts about meta-programming