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
Related
up until now, I always ignored the UML Metamodel, but now that I've taken a closer look at it, I have a question which isn't answered by the standard books which I have at hand.
The Metamodel describes elements and their associations per diagram. So, it defines for instance what kind of relationship an actor can have with a use case in a use case diagram.
But does it also describe the relationships / associations between diagrams? Or maybe better expressed between elements of different diagrams?
Example:
In a class diagram, I define how I structure my code. This is defined by the metamodel
In a deployment diagram, I specify how I deploy artifacts to execution nodes. Also defined by the metamodel
But does the metamodel also define relationships with which I can specify how I derive the artifact (which I deploy, maybe a .jar file) from my code?
Diagrams are only a view onto the model. So you can show any arbitrary part of your model. Preferably you create a number of different structural diagrams to explain your model structure. Those are later augmented with behavioral diagrams which show how certain elements collaborate.
tl;dr UML is not about diagramming.
Yes, metamodel explains how various elements of a model can be connected. Diagrams itself represent poets puff the model and it is also described in a metamodel. While it's not always clearly shown how to actually represent that, for example each behavioral model represent behavior of something. What can have this type of behaviour is part of metamodel.
Let's look at specific example.
Consider State Machine. Metamodel defines which elements can have State Machines (e.g. A class). So if you have a certain class you can draw a diagram of State Machine owned by this class. How to show that this SM is owned by that class is a different story but that is also possible with UML.
Then on a state machine you can have activities which according to metamodel have to be owned by the same class etc.
One remark - it's spread over the whole specification. But look at definitions of elements like classifier, behaviour, state machine etc. That's where your answer is.
is it allowed to draw a sequence diagram with classes and systems as lifelines.
For example:
I want to model a part of the domain logic with a sequence diagram. Can I model a the lifeline once as a class and once as a whole system (remote system or a whole layer/jar file)?
Example-1:
There is the Class Scheduler which invokes the FileDownloader class which calls a FileServer? So I have the "Scheduler" (Class) the "FileDownloader" (Class) and the "FileServer"(remote System) as a lifeline.
Example-2:
Or I have a Class called Scheduler which invokes the "AccountingService" which calls the "Persistence Layer" which calls the "Database"
So I have the "Scheduler" (Class) the "AccountingService"(Class) the "PersistenceyLayer" (Whole Layer or .jar File) and the "Database" (System).
Is it allowed to mix these up in a sequence diagram. In some descriptions about sequence diagrams there would only modelled classes that call classes or systems that call systems.
Thanks.
What do you mean by "System" ? In UML there is not definition of system. You probably mean System as a name of Class or Component, or is it a stereotype? If yes, you can mix it.
Jar file is artifact. Artifact is Classifier as well. If artifact plays role in internal or communication structure, it can be represented by lifeline as well.
Lifeline represents instance of specific type which participate in interaction. Referenced type could be any connectable element from classifier owning interaction (sequence diagram, for example Class, Component or other types of classifiers).
To learn more about UML, I recommend you to read UML superstructure specification document.
Dowload it for free from omg.. UML Superstructure
Lifeline usually represents a role (it can be what you call system or even a human being), or an object. Notice, not class but its instance! Lifeline represents any thing with some behaviour. Classes mostly describe not their own behaviour, but behaviour of their instances. You'll have a class as a timeline only when you are modelling its static fields and functions. Or when you are in JS or similar language and your class is really a prototype
So, mixing of large and small objects, components or roles is absolutely OK. It is a part of standard UML usage. But do not mix instances and classes if you are modelling for "traditional" languages! Are you sure that it is the class "Sheduler" that invokes something, and not an instance myBestSheduler of this class?
In sequence diagrams, displaying a class means "when I make an instance / object of this class, this activities occur".
And, other external stuff, that interact with your program, like the users ("actors"), Shared Libraries /DLLs, Web Services, Operating System, Network, whatever ...
... are considered objects ("instance of a class").
A Sequence Diagram, is composed by several objects, each one, with its own "Lifeline" or "TimeLine", that interact among them, (several "Lifeline (s)").
i'm php developer using MVC architecture that i'm new to UML
i know use-case , class , object , activity, sequence diagrams but i don't know for modeling a application where i should start.
i know use-case and class diagrams are structural diagrams and activity and sequence are behavior diagrams
but my questions are:
1. for modeling a app when i should use use-case diagram and when i should use class diagram?
2. does class diagram has abstract concept? because when i'm developing web app i have some controller and model or view also several classes that i use for different purpose (like insert data to database - validate form inputs and so on) but they don't look like to examples of class diagram that i'v seen until now so my question is class diagram is used for show concept of our system and it doesn't need to generate real class code form it ?
for example modeling a ticket reservation that may have some classes like this:
but we don't write class codes like this and it can be different in programming but for view the concept we are using class diagrams . is it true ?
Use-case diagram is usually used for representing the business of the project, indicate who(actor) are going to utilize the system and what services(cases) does program provide?
The class-diagram is used for specifying the whole system structure, but there no code and exact behavior will be provided by the class, generally developers don't specify the exact behavior with each module in-detail.
for example, consider a simple login module. in use-case diagram, we just mention that user logins into the system.
In class diagram we specify the possible base classes are needed, in other word we apply the architecture (we are planning) basis.
In sequence diagram we focus more on what is going on each method(while this is not necessary).
In fact UMl is used for representing the system as abstract, not the exact(in-detail) functionality.
for example I pass the above class-diagram to a developer, and tell him about the detail login process as a separated document.
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.
What's the best way to represent a networked connection in a UML class diagram?
UML class diagrams are not appropriate to describe a topological notion as a "network"; they are better suited for hierarchies and interdependencies between objects. Or are you talking about a Connection class?
The Class Diagram is the wrong place to be trying to show network connections. A Class diagram will show only the classes in your software and how they relate to each other. You should use a Deployment Diagram to show how the elements of your software are going deployed across the network.
You could also include a Communication Diagram to show how the different parts of the software communicate with each other without regard to the deployment model.
Graph or a network is a structure in which any element (Class or object here in UM) may be connected to any other element. The "connection" can be any association other than "is a" in UML. As such, it is possible to represent the structure of graph or network using a set of classes and associations.
For example, consider a class of Places, an association "is connected by" and a class of Roads. With this any complex netwrok of Places and Roads can be represented by associating an instance of Place with another instance of Place and an instance of Road. RDF Tripples thus represent a semantic network.
Is there any other (special or specific) convention of representing a graph or network in OOAD / UML?
You should use a Deployment Diagram to show how the elements of your software are going deployed across the network.
Deployment diagrams are used to visualize the topology of the physical components of a system where the software components are deployed.
Deployment diagram: describes the hardware used in system implementations and the execution environments and artifacts deployed on the hardware.
http://search.aol.com/aol/image?s_it=topsearchbox.imageDetails&v_t=client_searchbox&imgsz=&imgtype=&imgc=&q=deployment+diagrama+uml
And You use the tool Rational Rose for get that.
All is for documentation, when something is changing in the network, and every know that you used Rational Rose and Deployment Diagram.
Structure diagrams emphasize the things that must be present in the system being modeled, and every Diagram has a function.
As mentioned above already UML is serving other purposes than representing physical infrastructure of a network or components.
Some examples of network diagrams can be found on creatley -> https://creately.com/diagram/example/hfgz8ekz/Network%20Architecture%20Diagram
I personally like to use https://www.draw.io/ to generate diagrams - it's web-based, very intuitive and has many features and a large library of image-sets.