开发者

Modelling the idea of throwing an exception in a UML Activity Diagram

The abilit开发者_如何学编程y to model the idea of catching an exception is pretty easy in a UML activity diagram - but what about THROWING the exception? The closest thing I can seem to find would be the throwing activity sending a signal with a stereotype of <<exception>> and then hitting a flow-final node, but I don't know that this is considered best-practice. Any thoughts?

Thanks.


UML 2.4 superstructure specification, in chapter 12.3.44 Pin (from BasicActivities, CompleteActivities), on figure 12.122 (page 416), you can see output pin for throwing exceptions. There is also an example on figure 12.129 (page 419).


UML notation exists to show exceptions. Look at Larman's book:

Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, Third Edition By Craig Larman 35.3. Handling Failure Chapter

Larman says that :

*In summary, UML notation exists to show exceptions. However, it is rarely used. *This is not a recommendation to avoid early consideration of exception handling.* Quite the opposite: At an architectural level, the basic patterns, policies, and collaborations for exception handling need to be established early, because it is awkward to insert exception handling as an afterthought. However, the low-level design of handling particular exceptions is felt by many developers to be most appropriately decided during programming or via less detailed design descriptions, rather than via detailed UML diagrams.*


Usually the throwing an exception is displayed in the sequence diagram. I would say the following example is mainly used with Java but don't really know if it could also corespond to higher level of abstraction !!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜