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, youll probably want to give each step an identifier you can refer to: 1, 2, 3, 4, etc. Your 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, thats how your logic is structured). Would it be a 0, 999, a non-integer value, something else entirely?
Identifier for the completed stage of a process: 0, 99, something else?
naming;meta programming;logic
I wouldn't store a step_id at all, as you're just limiting yourself in the future.  Break it down into 2 groups of orders:Incomplete orderComplete orderJust use a boolean to store that.  So you only have to worry about incomplete orders now (which are proportionately few compared to the total number of orders in your system).  Now every required detail that they have to enter has to be it's own field:NameStreetCityetc.Now in the future you may want to divide your steps up in various ways.  There's a tendency now to move away from steps and towards a single long page where the user can jump around and enter it in whatever order they want, but there might be steps.So when you reconstitute an incomplete order, you have something like:OrderStep currentStep(Order incompleteOrder){    if(!step1FieldsComplete(incompleteOrder))    {        return OrderStep.One; // silly naming, I know, but give it more meaningful name    }}bool step1FieldsComplete(Order incompleteOrder){    return         incompleteOrder.Name != null        && incompleteOrder.Street != null        && ...;}Now, when you want to move fields from one step to another, or merge 2 steps into one, you have lots of flexibility, and the code will even work if you add new fields in a previous step that the customer already filled out.  When they come back they'll just be bumped back to the step with the new field.