I have a question regarding sequence diagrams.
When drawing sequence diagrams,
Is it enough to draw one diagram per user case ?
or do we need to draw a set of sequence开发者_运维问答 diagrams to cover each user case instance ? (is a sequence of actions a system performs that yields an observable result of value to a particular Use Case Actor)
What you need to do is describe the functionality of the system enough that you can begin development. That doesn't necessarily mean 1 sequence diagram per use case; it doesn't even mean you have to have any sequence diagrams at all. In fact, I would submit that sequence diagrams belong as definitions of individual method calls, not use cases, but they're only necessary if you're doing a really big design up front, which is usually not a wise thing to do, as you don't always have enough information at design time to define the entire system.
I personally rarely use sequence diagrams; I stick with activity diagrams for use cases and only build a sequence diagram if I actually need to define the flow of a particular method of a particular class, and those only happen if circumstances make it necessary to define at design time.
Sequence diagrams are a powerful tool that lets you understand the dynamics of a use case.
I would define "enough" sequence diagrams as the amount of them that lets you understand each use case. If there's a part of a UC that is not been represented, then the one who implements it, may not include it - they might have doubts because they didn't see the diagram. So I would do the diagrams I feel necessary, and then call some other person involved, show him/her the UC and the Sequence diagrams, and tell him/her to tell me what he/she understood.
Always remember to code / document as if the next engineer is a maniac who knows where you live (citation needed).
Remember that sequence diagrams represent possible interaction scenarios. Therefore, you should draw a different sequence diagram for each relevant scenario. The meaning of "relevant" is up to you. It may be just one if you feel that for a specific use case there is only one relevant scenario (maybe the other scenarios are obvious and are not worth of a specific diagram) or many
精彩评论