In UML, does an object’s state machine define that object’s lifecycle?
That is, do transitions from the initial state to an ordinary state create the object, and transitions to the final state dispose of that object?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Generally yes – at least that’s probably the most common way of using them.
It’s not mandated that way in the UML spec; it allows a more general use of state machines. For example, a Final State can be used to signify the end of a behaviour thread within a region if the state machine has >1 regions. Or a state machine can be used to define a protocol instead of an object’s lifecycle.
Some variants (profiles) of UML do enforce the behaviour you describe, for example Executable UML.
I’d probably turn the question on its head and ask: would it be useful to you if the state machine did define the object’s lifecycle? If so then just use it that way. If you need to formalise then you could define a profile. But it’s equally fine to just agree informally in your team.
hth.