How to properly depict external object on UML diagram? - uml

Suppose you have a Parser class that reads the file and does something with the data it contains. On a diagram how to you show that it gets data from some entity that is not represented by a class, but rather exists separately as, in this example - file.

Assuming you want to show the structure. Use a class or interface, as UML does not have to mean a Java class, you can also use an artifact which is more part of the deployment notation, but is fine to use elsewhere. If you think about it a file is a fairly concrete concept, especially if it has a name.
From the OMG UML spec:
10.3.1 Artifact (from Artifacts, Nodes)
An artifact is the specification of a physical piece of information
that is used or produced by a software development process, or by
deployment and operation of a system. Examples of artifacts include
model files, source files, scripts, and binary executable files, a
table in a database system, a development deliverable, or a
word-processing document, a mail message.

Related

Meaning of Part and Port?

I have a .lib file containing internal C++ classes and a few C++ classes are interfaces to the functionality that software library provides.
How should I illustrate this with UML?
Using Enterprise Architect, I tried type 'Component' (pasted to the component diagram as simple link) and then dragged and dropped the internal classes of that library from the model tree to that component rectangle as element type Composite part, and the interface classes of that library as Port. Now the weird thing is what happened the model tree contains kind of object instances of that classes called Part1 and Port1 of UML type 'class', which is nonsense since a software library don't instantiate, it just provides its classes via .lib file, like a pool. I think UML element type 'component' is not the right thing here, is it?
The same happens if I use 'Package', also here parts and ports become things like object instances although classes in a library are not.
Following my comment to the O/P, I'd do something like the below. Please note that I'd probably not depict all of this on the same diagram, the class content of the package for example I might present on a separate diagram so that this is not so cluttered. But the logic is the same.
Update: Following commentary below I've added the this diagram which illustrates an alternative way of representing this. I think in some cases I've seen the delegation represented as a dependency rather than a reference association too. But hey ho. Internally, components are represented as interacting between each other via required/provided interfaces (though this is not shown as in the model below we only have one internal component illustrated).
It's not weird. You happened to drop a class as Part (in EA terms).
That's actually a Property. Just open its properties:
See UML 2.5 on p. 147:
9.9.17 Property [Class]
9.9.17.1 Description
A Property is a StructuralFeature. A Property related by ownedAttribute to a Classifier (other than an association) represents an attribute and might also represent an association end. ...
I'd probably just drop them as link to appear as class inside the enlarged component, YMMV
A class dropped as port will show as what the name said. So no confusion here. Anyway, I'd also drop it consistently as link to show just the contents. Further I'd probably stereotype the component itself with <<lib>> or the like. That's because you actually use a lib during compile time to extract the needed parts and it does not work as component by itself. A library though has an interface, namely to extract the compiled class modules it has inside.
Ah, and as #muszeo said: use ctrl-drag to show the above dialog.

How to describe file structure?

At the current point of time, I am modeling the project and I have a really serious question: how to describe the structure of the file(archive)?
What I mean: in this project, we will have our custom file extension, let's call it "anlib", it will be a rar archive with a pre-defined structure like jar.
But how to describe it in UML? Neither component diagram nor deployment diagram support aggregation or composition.
UML diagram describe the system structure (components, classes) and its behaviors (interactions, activities, states). UML doesn't represent files or other system resources. But you can represent these indirectly:
a class that represents the data that is contained by such a file (class diagram)
a class that acts as proxy for a certain category of files and that can manage such files (class diagram)
an object that instantiates an existing file as a file stream class (e.g. lifeline on a sequence diagram)
If the file is part of the system configuration and needs to be deployed to make the system usable, then you can represent it as an artifact in a deployment diagram

can Classifier that realize a Componet be shared?

In UML 2.5, it is written : A component acts like a Package for all model elements that are involved in or related to its definition, which should be
either owned or imported explicitly. Typically the Classifiers that realize a Component are owned by it.
So if we need to modeled that a set of classes are used to realize two different components, we have to use something like a packageMerge ?
For example, how to model two components, one dedicated to CRUD operations, the other dedicated to reports, and that these two components use the same set of classes to check access rights ?
I found two solutions, which one is the best for you ?
model three components, one for the CRUD, one for the reports, one for the access rights and model dependencies between each one. But the classes used to check rights are not a component as UML defines a component.
model two components and a package rights containing the classes and model that the two components depend of this package
I wouldn't be too dogmatic in such a case:
The String class is used in both components. Whether you merge it or not is sort of a question for configuration management. So would you link a binary or do you have sources that are being compiled where you can use either component independently. The question should be: who is the reader for this construct? If you have a clear picture you could detail it. Else just leave it open as shown above.

How do I represent a component that is comprised of several files in a component diagram?

Since a single component could be manifested by multiple artifacts, I'd like to know how a component's multiple artifacts are represented in a component diagram. Or in other words if I have a component which is comprised by several files where the code of the whole component is implemented how can I draw the component diagram to make it clear the different files that comprise it?
Can I use a notation similar to a package where you can put the package symbol and inside the objects that the package contain? I mean, some sort of clickable component symbol where I double click and it opens showing the comprising files?
I use Enterprise Architect so examples using this will be even more helpful.
Regards!!
In Enterprise Architect, go to Component's properties (double click on the component box in the diagram) and go to files. That's the place to put the file list in Enterprise Architect.
Still, it's possible to model it in a way that a single file is represented as a separate component and thus "master" component is clickable so it is possible to navigate to another diagram, but when the model gets big and consists of many files it won't serve the purpose and it will get too complicated.
If for any reason, it is necessary to clearly mark the file list on the diagram, the note with textual description is sufficient.
Note that primarily a model (i.e. Component Diagram) is to show the parts of which the system is build and as opposite to the design, the file list is specific to the implementation.

Formatting XSD scheme for peer review

I designed a data model which is represented by an XSD scheme.
The data model also provides the types that are being used as web service parameters in a WSDL descriptor.
I would like to send the XSD scheme around and ask the people involved to peer review the data model.
What tool or presentation method would you suggest to be used as a basis for peer reviews? The data model should be readable for non-skilled people, at least when it comes to the semantic meanings of the parameters
Edit:
To be more specific: Of course, syntactically, the scheme validates. Actually I'm already working on code which is based on JAXB generated classes. My goal is
to freeze the data model and thus
the input parameters
to make sure
nothing got lost or forgotten from a
semantic (in the meaning of
business-relevant) point of view.
Edit 2
I've been thinking about how it probably would be best to spread a datamodel around. I'm thinking of something like a JavaDoc for XSD schemas. Anyone knows if something like that exists? Basically it would be done with a set of XSLTs, right?
I know the following tools that generate documentation from XML Schema files (XSD):
xs3p
XSLT stylesheet that generates single XHTML from XSD
xsddoc
free / LGPL
mainly XSLT based
JavaDoc like output
see xsddoc examples
xnsdoc
improved commercial version of xsddoc
free for personal/educational use
JavaDoc like output
XSDdoc 2.0
commercial
JavaDoc like output
For small a XML schema, I would probably suggest using the xs3p XSLT stylesheet. For more a complex schema, I suggest using xsddoc.
I recommend using the XSD for something. Specifically, show some actual applications, with examples as real code.
Actual applications are what make a schema interesting. The examples don't have to be big, sophisticated or completely realistic. They just have to compile. Other people will want to copy and paste the code samples.
These examples are the "hello world" of the schema. And they act as a kind of unit test for the schema.
The closest thing to Javadoc for an XML schema that I've seen is running the Javadoc tool on source generated from the schema. This requires two things: 1) That your schema has internal annotation elements documenting it, and that 2) your source generator uses those annotations as Javadoc elements.
The very useful Oxygen XML developer also supports generating documentation, see
http://www.oxygenxml.com/xml_schema_documentation.html
(commercial, but there's a fully functional 30 day trial available)
I'll try it out now, need a simple way to generate a document with all types and available xsd:documentation description as a simple interface description...
** Disclosure : I work for Innovasys, the producer of the documentation tool mentioned below *
You could take a look at Innovasys Document! X. As well as automatically generating a structured and linked page for every element, simple type, complex type, group and attribute group it will also generate linked XSD diagrams (including sequences/choice etc.) and structure tables that include the annotations from your XSDs and make sense of the relationships between the elements in your schemas. The output is template based so you can adapt it to your preferred style and structure. It will build output to web ready html or compiled help files.
Uniquely it also includes a WYSIWYG editor that allows you author additional content to supplement the stuff that's automatically generated and the annotations from the XSD source - so you can provide additional contextual information for your peer review. There is also a Community Extensions feature that allows people viewing the generated output to record comments and feedback and that can be viewed and actioned directly from within Document! X.

Resources