Is there any restriction that UML diagrams could be drawn only for systems with Object oriented approach? Can we use them for other approaches (E.g.: procedural)?
问题:
回答1:
Yes, you can definitely use UML for modeling with other approaches, for example the use case diagram or acitivity diagram are in no way bound to OOP.
回答2:
A discussion in the comments of another echange lead me to make another answer here because I think the other answer is a bit short.
In fact, the original authors of UML, Booch, Jacobson and Rumbaugh,in their books (The UML User Guide, The UML Reference Manual) describe UML in the perspective of OOP.
The OMG currently makes the evolution of the language in the perspective of the Meta-Object Facility (MOF). In the UML 2.5 beta 2 document scope section (p. 1), things become subtle. The text is quite blur on the topic.
The initial versions of UML (UML 1) originated with three leading object-oriented methods (Booch, OMT, and OOSE)
(...)
Relative to UML 1, this revision of UML has been enhanced with significantly more precise definitions of its abstract syntax rules and semantics, a more modular language structure, and a greatly improved capability for modeling large- scale systems.
(...)
The objective of UML is to provide system architects, software engineers, and software developers with tools for analysis, design, and implementation of software-based systems as well as for modeling business and similar processes.
(...)
One of the primary goals of UML is to advance the state of the industry by enabling object visual modeling tool interoperability. However, to enable meaningful exchange of model information between tools, agreement on semantics and syntax is required.
Depending on the section, OOP is mentioned or not. The "modular language structure" could induce some elements could be used outside of OOP.
I personally think the MOF is a direct link to OOP (please give me any example of a MOF outside of any object-oriented platform). In my point of view there is no doubt that UML is genetically tight to OOP.
However, some UML diagrams (state diagram, activity diagram) allow to represent software systems avoiding an obvious dependence on OOP features. This is why it is possible to use UML for any programming style, but this is not the original use of UML.
Conclusion
The purpose of UML is OOP, but you can use it for anything you want: there is no law against that.
回答3:
UML say "all is class", see MOF on OMG page. Some UML diagram have non-objets origins (like a use case diagram or activity diagram), but now is the notation based on object/classifier concept. OOP and "system of classifiers" is not the same... You can use UML for all models based on classifier and object concepts (se SysML, UML profile).