private/protected functions in sequence diagrams
What are the UML 2.0 rules regarding private/protected functions on sequence diagrams? Do we show 开发者_StackOverflowthem (those functions) on those diagrams? Are they marked in any special way to indicate that they aren't public?
Read this:
http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/
Search for "visibility".
Table 4: Marks for UML-supported visibility types
Mark Visibility type
+ Public
# Protected
- Private
~ Package
Generally, this is only for class diagrams.
In a sequence diagram you have a choice.
Show private function calls because you are documenting the implementation. You do this so the developer knows what code to write.
Do not show private function calls because you are documenting the interface. You do this so everyone knows how the classes collaborate to get work done.
To add to S.Lotts answer above specifically the point about including non - public behavior in a Sequence Diagram, in general , i would say No. However, it depends on exactly what you are going to be using these UML diagrams for.
If you are using these UML diagrams for communicating your API's to external users, then definitely it does not make sense to expose the internals of your system to them.
However, if you are using these diagrams to communicate internally amongst your team, then sometimes, i have found it useful to communicate low level design by depicting it in a sequence diagram as it gives a clear indication to the developers as to what the implementation is supposed to be like. Again, this need for doing this is greatly dependent on the skill level of the person doing the implementation.
精彩评论