How do you create XOR relationship in GenMyModel? - uml

I have a task where I am supposed to create a UML class diagram. Let me paraphrase:
There are two types of storage units (A and B). An item can only be placed in a storage unit of type A or B.
The book I'm using described the use of XOR relationship, as shown bellow on this site:
i.e. for my example, an item can only be associated with storage unit of type A or B.
I quite like the tool GenMyModel. Is there way to represent this in that tool? I've searched like mad and can't find anything.
Cheers,
Delectable Tea

GenMyModel is a quite nice tool, but also quite limited in its UML support. The "relation" you are demanding here is called a constraint. Constraints are a quite informally handled and not really commonly used topic in UML. So there plenty of tools that have no proper support of it. Then you can draw - thought but not model - constraints, i.e., just use other model elements or free forms to get something that looks like this.

Related

Non-UML diagrams to show objects and their creation

I am trying to understand new piece of project. I am drawing UML class diagrams, but there is something missing for me in these diagrams: the creation of objects. What a traditional UML diagram can depict is how these classes are related to each other and how instances of these classes are related to other objects of other classes, but that is in the moment when they are already created. Sometimes it is not that obvious who creates who, sometimes it is totally misleading. For example objects of class A may create object of class B, but that A object just returns this B object and gives it to somebody else and doesn't hold any reference to it. And sometimes it holds (a reference or pointer). Sometimes it matters for the reader. So in fact there are two types (pieces) of information: holding and creating. I came up with my own way of visualizing this, but maybe there is something standard here? What do you think? And I don't have UML Object diagram in mind, that is not something very helpful when reading C++ or Java code and trying to understand the relation of classes and objects. And not sequence diagram also, that's a different kind of beast.
If you want to stick to class diagrams, you can use the «create» usage dependency from UML Standard Profile (chapter 22 of UML 2.5 specs).
«Create» | Usage | A usage dependency denoting that the client classifier creates instances
of the supplier classifier.
So e.g. here A creates an instance of B, and C just has a reference to B.
A type of UML diagrams show only one particular view of your system by abstracting the other aspects of a system. For example, a class diagram shows only the static aspect of the system, but not the dynamic behavior such as:
At what time an object was created
The central ideas of modeling a system is trying to deal with (or focus on) an aspect at a time, and at the same time to eliminate the complexity by forget about the other aspects of a system.
In this case, "creating an object at a particular time by who (another object)" should be dealt with behavior view, thus, we can use a sequence diagram to modeling the dynamic behavior:
You can see the Dimension of a sequence diagram in the Figure:
Horzontally, Objects Lifecycle
Vertically, Time
You might then be interested, how I can relate these models together? Will there be any inconsistencies among them? Right! if you are puzzling about this, you are in the right track!
Look! models are inter-connected each other, take an example, you can create a use case, and a use case can be detailed with a number of scenarios, then.. each scenario can be modeled by a sequence diagram, and the sequence diagram giving you the hints of what objects (and what operations and attributes in it) you need to build your systems, right?

how to use use case relations - uml

Heys guys! Im have been study UML and im trying to to design the use case diagram of a problem.
Lets supose my app consists in this:
Two Requesites:
- create teams
- create players
This is the deal:
A user can create a team, and after create a team he can create players for that team(not required).
But in this app there are multiple users, and a user can create a team and other user can create players. The only constraint is that to create players must exist alreay a team.
I research and i end up a little confuse. If i get the concepts of relations on use case diagrams right, i think i should have the folowwing two use cases:
[use case - create team] <-------extends---- [use case - create player]
I need opinions,Is this the proper solution? or should i have two not related use cases?
Thanks in advance, and im sorry my english.
Generally you do not need to model dependencies like "A must be done before doing B" in a Use Case Diagram. Use Cases should represent a set of Szenarios to group them as a common case.
The "extends" dependency is used to specify a Use Case which is more special than the extended one. So, if you would like to express that creating a player is a special form of creating a team using "extend" would be fine. Bbut this does not match the situation described above.
If you would like to express that creating a playing always means to create a team as well, you can use an "include" dependency. This could match your case but imo does not entirely.
The final option is to draw an unspecified dependency (no << >> marker) the express that the use cases have something todo with each other.
My recommendation: don't use any dependency in this case.
Some more good explanations can be found here, btw.
There is a common problem with use cases: relations. We tend to use relations to describe the sequence of use cases. But this is a misconception. Here are some words from The UML User Guide about Use Cases and Flow of Events (part 4, chapter 17):
You can specify a use cases's flow of events in a number of ways
[...] informal structured text
[...] formal structured text
[...] states machines
[...] activity diagrams
The point is that, if the guide tends to say (implicitly) that relationships should not be used to specify flow of events, it does not say what the use cases relations should be used for. I think this is the reason why use cases are an important point of UML and UP but a tool very difficult to handle.
In your model, you should perhaps change the arrow and the term (simple suggestion, you are the analyst):
This should be represented on your diagram if you want to emphasize the constraint, but not as a representation of the sequence of operations (subtle distinction).
The extends terms is usually associated to generalization / specialization. And in my opinion this is not the kind of relationship you have between a team and a user creation. The example given by the guide is the following (part 4, chapter 18):
That said, modelling the specialization of use case is most of time of limited interest. But sometimes this is needed, it depends on the use cases description: if both are equal you don't, if not you do. An advised programmer knows that specialization does not imply equal assertions.

Diagram Type for Service Connections?

Just wondering what's the correct UML Diagram type to show Service Connection? Essentially saying that "Client A needs a function GetFoo that needs to return items whose quantity is bigger than 20" and "Client B needs a function GetFoo that returns all items"?
A Component Diagram looks correct, but already very concrete in terms of types and very vague in terms of single functions. Composite Structure maybe?
Eventually this is used during planning to decide which functions a service actually needs to have (e.g., an inner GetFoo and two outer GetHeavyFoo/GetAllFoo functions)
I think the composite structure diagram will work for you. However, in my opinion you should combine it with sequence or communication diagram or both - whichever works best for you. I also suggest you check all the uml diagrams and compare them and then decide which ones are best suited for you.
Component diagram is a good solution as well as Sequence.
If you are a beginner in UML you can also just create a class diagram and add a constraints on a method. It would do the job and be easy to understand by the developer team.
It used to be OCL in UML 1.X but now with UML2 direct access to the metamodel you can just create any constraints directly in the model without any transformation. I use EclipseUML Omondo and don't want to use OCL because too complex for a very limited return on investment. My workaround is also better because I can write whatever I want and directly put it inside my class diagram without having two different models (e.g. one for UML and one for OCL).

Structure and behavior in UML

I had some questions regarding the structure and behavior of a model, using UML, and the relationship between the two :
Did you find any limitations for UML regarding the specification or understanding of the relationship between structure and behavior?
I was wondering if you have any practical ideas of how one can optimize the relationship between structure and behavior, using UML.
Do you know any UML tools that help understand better this relationship or represent it much easier?
Thanks
Yes:
A sequence diagram is readable at a high level, showing how a transaction involves a few components; but it's not good (not readable) at the detailed level, showing how a transaction involves dozens of methods (method A calls method B, which gets data from methods D and E, and then invokes method F, etc.).
Looking at a class diagram, you might see a based class with several subclasses; this tells you nearly nothing about the behaviour of the classes (it only tells you that they may have some behaviour in common, or at least a common API, plus some individual behaior that's unique to each subclass).
That's a big question. A quick answer is, "Attach text notes to the objects: diagrams aren't sufficient without descriptive text."
No, I don't really; a UML tool help you create UML diagrams (and generate code from the diagrams), but it's up to you how you use it. There was a neat product described in the book titled Real-Time Object-Oriented Modeling (1994) which was an executable model, i.e. the model itself had behaviour, but I know of no UML tool quite like that. The closest I know of is being able to "round trip" between the model and code (i.e. generate code from the model, and the model from code).
Sounds like a homework problem. Wiki can tell you all about UML.
The limitations of UML are the same as any form of communication. The simpler your language, the fewer things you can communicate and the clearer your communications will become. A shape like a square or circle identifies a structure, a line indicates relationship, an arrow indicates movement, or flow. You could enhance this by defining the meaning of other properties, like direction, boldness, color, number count, different shapes. You could incorporate multimedia layers like audio or video, motion, tooltips- but now we're not talking about UML anymore.
My favorite UML tools are a whiteboard and some dry erase markers.
I think that things have changed, regarding UML's usefulness to melculetz.
In Visual Studio 2010, I can define an association relationship, that will generate composite classes. I can specify the multiplicity and class qualifiers. I can also generate classes from the model.
Presently, I am attempting to visually model the phases of a system, in order to visually define the methods for a state-machine object. That is my attempt to integrate structure and behaviour. Check my blog to see how I get on.
Class Analyser visually expresses the behaviour of class objects. Limitation removed.
I think that the answer is to turn your development methods towards MDA. You will generate more classes, but the payoff is in terms of manageability and re-use (where you template your efforts).
I am still working through my model but, I find VS2010 promises good tools for managing the development process. I have yet to investigate UI modelling, but have heard the rumours. I may have it all wrong but I think that, by working with Lightswitch, I may be able to model the UI also.
UML allows you to specify the signature of a method, and group methods into classes, but it says nothing at all about what code you use as implementation. If that's what you mean by "behavior", I don't think UML addresses it at all at the class level.
It's even worse at the UI level. My impression of UML is that it's woefully inadequate for specifying UIs.
I think the effort required to embed everything into UML is greater than or equal to coding the application, with the added burdens of UML tools being poor IDEs and inability to prove correctness of UML the way you can with unit testing.
UML is way oversold, IMO. I consider it a convenient notation for informal communication between developers, nothing more. It has never been and never will be the object oriented equivalent of engineering drawings.

Graphically Modeling Metaprogramming

Are there any tools out there that let you model how a class (or a class hierarchy) can change at runtime? For example, if I have a given number of mixin classes that will be combined at runtime and I don't know which ones will be combined until the program runs, how do you go about diagramming that type of runtime behavior?
Here's a better example. Let's say that I have a base class called IceCream, and I have over 100 possible flavors that all derive from that one IceCream class. Let's also suppose that any instance of the IceCream class can be combined with another instance of the IceCream class to create a completely unique IceCream type altogether. Given this domain, how do you use a graphical model to actually say that any one of these types can be combined at runtime?
It would be inefficient to model all the possible combinations of IceCream types, given that there can be a virtually infinite number of permuations for these 100 IceCream types. So again, here's the question: Are there any graphical modeling languages that let you specify this sort of behavior?
Your design sounds a little disturbing. If two different ice creams have different behavior, then why is it wrong to model all the possibilities? Where are you loading the behaviors from? It very well could be the case, but if so I'd guess that you want to contain the behavior instead...
If they don't have different behaviors, then all you are talking is a class "IceCream" with a "Flavor" member. Never create a second class when the only difference is data--the code must actually differ in the two cases to warrant different classes.
If I totally missed something I apologize.
Edit: Let me be more specific about "Containing behavior". If each of your ice-cream flavors had a "Taste" (which is code) and the taste is different between Vanilla, Strawberry and Chocolate--then you have 3 "Taste" ice-cream classes that are contained in one "Cone" class.
The Cone class would be what I think you are trying to model as "IceCream". Since the cone contains all three, a "Lick" method can combine those three in any way possible. Either you can lick(bottom), lick(middle) or lick(top), or you can just lick() and allow the lick method to combine all three into a single call (to be more real-code, you might pass a single variable to lick() that would be forwarded to all contained flavors).
I wonder if the personal db approach of Bento or DabbleDB could be relevant for the actual modelling part. Then maybe the Django admin's model introspection for the logic part. Sounds like you want to create an interface to a scripting language. A kind of vpl library. So, a beefed up and more reflective Django admin might be a starting point.
In general, if you want to create UML class diagrams you can exploit Generic Types in UML. Also, there is the concept of Template Parameters in UML.
Have a look at this site: Defining Generics with UML Templates
They use the Eclipse Modeling Framework as a tool.

Resources