Is there a human-readable and text-based representation of a Component diagram? - uml

I'm looking for a text-based representation of a component diagram that does these things:
A human can read and understand the diagram just by looking at the text
The text can be rendered into a diagram
Simple. No fancy features. Basically just need boxes, arrows, and labels.
Here is a great example of what I'm looking for but with sequence diagrams: http://www.websequencediagrams.com/
Does such a language/format exist for component diagrams?

You can use plantuml. It can render component diagrams from text, like you want. You will need to install Graphviz for making diagrams. Example of text to UML :
#startuml
DataAccess - [First Component]
[First Component] ..> HTTP : use
#enduml
There are other textual UML notations, you can check them here.

I use yUML most of the time. It does what you need and it's simple enough. They don't have an API per se but you can easily build diagrams with URLs or POST.
You can also host it on your own servers by buying a license.

You may try UMLet utility
"UMLet is a free, open-source UML tool with a simple user interface: draw UML diagrams fast, produce sequence and activity diagrams from plain text"
http://www.umlet.com/

Related

Regarding UML diagrams and patterns?

I have a general UML question. I am studying a course in programming and the theme is pattern. So I would like to know if UML is connected somehow with patterns?
Yes. And no. You will likely see all design patterns drawn as diagrams. For example, the GOF (which is the reference book on the topic) does not use regular UML (because it was first published in 1995) but a representation very similar to class diagrams.
This is because you can draw the blueprint (which the class diagram represents) very easily with UML. You can then use that blueprint directly for your design and transform it to any code you want.

code path on UML class diagrams

I usually document system architectures with traditional UML class diagrams, and then further document the most important/complex code paths with arrows from one method to another, and which property it updates, etc. Usually with little notes of the arguments used and values set.
something like (horrible ascii art warning)
--------------
CASE X | main class | -----------------
-------------- | util |
| count |<-+1 -----------------
-------------- | -----------------
user ---x=A-->| doStuff(x) | ---y=Z---<>| someMath(x,y) |
| other() | -----------------
--------------
is there a name for such a thing? note how i'm pointing to individual methods/properties, not to whole classes as a traditional UML diagram would.
I use graphviz/dot for all my other graphs. but i can easily move to something else that allows me to do that... i just rather it be programatical like graphviz, not a drawing tool like visio if possible.
Please, feel free to edit to add tags if you think some other graph engine may provide this.
No, there is no name for such thing in the UML world. Although in UML you can draw diagrams combining various drawing elements nearly at will and thus producing a new inventions it, your drawing does not fall into the UML standard.
A very big advantage of using standard is that other people can understand what you mean without the need to provide them some reading instructions.
In UML there is whole set of "traditional UML diagrams" categorized as "Behavior Diagram". You may want to go through the examples in Kirill Fakhroutdinov's online book http://www.uml-diagrams.org/index-examples.html
UML Sequence Diagram (in your case) seems to be the first thing to play with.
In UML using drawing tools to produce some picture may be the poor-man's choice, but you'd have to study hard to make sure that you put the picture right.
Instead of using a picture drawing tools, we rather use UML Modeling tools which support the drawing-right and they sort of "know" what the picture shows and can generate code from the UML model (e.g. hierarchical state machines) or can reverse engineer a source code into an UML model.
Furthermore the UML model format was standardized as XML Metadata Interchange (*.XMI) and once you have model in this format you can use various tools to round-trip and produce artifacts (generated documentation, generated code, ...) that you need
As xmojmr has said, you ought to look at sequence diagrams. UML breaks itself into structural and behavioral diagrams. You probably shouldn't add behavioral elements into a structural diagram (which is what you are doing). Your explanation of why you are doing what you are doing is exactly the sort of explanation that people give for the use of sequence diagrams: they're a way of documenting paths through your code.
You'll also find that they are used to document paths through use cases (a "use case scenario" is a path through a use case), so keep in mind that class diagrams represent the structure of use cases. In other words, they all go together, but you're likely to see a lot of sequence diagrams that have been worked out from use cases rather than class diagrams. I wanted to point this out so you don't get confused by the apparent orientation of sequence diagrams and use case diagrams.

Modelling uml diagrams Use case -> Sequence?

After having my use case diagrams, i can't found the logique to follow to implement the sequence diagram, how can i go from analysis the what to design the how from the actors and uses cases to a sequence diagram with many stereotype without thinking about the class diagram (to respect the order).
Or should i have to implement others diagrams to passe from the use case one to the sequence?
I've always created class diagrams and sequence diagrams together (and, at least, the UML modeller Sparx Enterprise Architect is compatible with that point of view), but I was never educated in the proper order if such a thing exist.

How to represent repository pattern in UML?

How to represent Repository pattern in UML?
Is there any stereotype that can be used to describe repository pattern? I am using Enterprise Architect to create diagrams. I specifically looking for class diagram representation.
According to Martin Fowler, P of EAA, p. 322:
(However, you must have already found this since it's the first hit on Google.)
Based on this example (and the text from P of EAA), this roughly translates to the following DCD:
jensgram has already provided an answer on how to represent the pattern as classes.
When it comes to using patterns in EA, you can quite easily create them yourself using Save UML Pattern under the Diagram - Advanced menu. This saves an XML representation of the pattern.
You import the pattern for use in your project either using the Resources window or by creating an MDG Technology (more complex, but a much better alternative for medium and large-scale deployments).
Unfortunately, the one UML diagram type where EA does not support pattern creation is the sequence diagram.

Do you know of any good UML sample?

I need some sample UML diagrams for some project of medium complexity. Do you know of anywhere where I can find some? I don't need them for learning UML, but rather to test my application that I work on and that should be able to process UML diagrams.
It would suffice to have Class diagram, Package diagram and Component diagram, but those should all model the same system and should be consistent.
Here's an Oracle paper which contains the design of a Web Store application. This paper has all kinds of UML diagrams that one may want - Class, Component, Sequence, Data Model etc. It may not have package diagrams but, those are trivial.
Look at this site, they have nice examples in the product tutorials:
Enterprise Architect
Maybe you should be more concrete about what format you need... Also, it might be interesting to try out some reverse engineering from existing code.

Resources