Introduction to UML
In this tutorial we will learn how to design/document our projects using UML.
What is UML and why I use it?

UML (Unified Modeling Language) is a language used to design/document/visualize software systems (Embedded or not). It's represents a collection of software engineering practises used for modeling large systems. UML uses graphical symbols to express software components. UML based on oriented object programming, but can also be with structured languages like C or Pascal.
UML is used in order to reduce code design/maintenance costs and "time-to-market", by using tools to automate code generation and reverse engineering.
UML defines notation and semantics in these domains:
- User interaction (User interface with the system)
- Comunication (How inner objects will interface with each other)
- States ( States or conditions that classes assume over time )
- Class model (Classes and objects of the system)
- Physical model (Hardware components of the system)
- Deployment Model ( Describes physical architecture and the deployment of components)
Software used in this tutorial
In order to learn all UML concepts and also to train our new skills we're going to use the StarUML tool wich can be downloaded here.

Our UML project
We're going to learn UML with our Hexapod project, it will be nice to learn from there because this will be our documentation, so let's begin!
Use case model
This model describes the functionality of the system. It represents the interaction between the user(human or machine) and the system. In this model diagram we can see:
- Actors (Operator or machine)
- Use case (Actions made by actors)
Let's see our hexapod Use case....
In this diagram we can see that our "actor" operator can do the following actions:
- Search for avaible spiders
- connect with some spider
- Monitor global position
- Send comands
- Get Picture
Another thing that we can see is the "dependency" lines (those dotted lines) this means for example that to "Get a Picture" the operator must be "connect with avaible spider"
Sequence Diagram
The sequence diagram represents the objects interations in time. This tipically show the actors and the objects interaction in the execution of the "Use case".
The diagrams are read from left to right descending, for example in the case bellow class 1 pass a message (method) to class 2, after that the message is passed to class 3 wich returns the "answer" message back to class 1

The dashed vertical lines indicates the object "life-time"

Bellow we got our "sequence diagram" of the hexapod project
Observe that until now we're not even talking about how this project will be implemented, and that's the idea we need first to map out all requirements before thinking how will be the implementation.
Class Diagrams
Now that we have an idea of how the users will interact with the system and the order of how things will flow we can start to build our class diagram, a class is a compilation of attributes (properties of the object) and behaviors (methods, features) encapsulated on an entity. Every time that an object sends data or asks for data, a message has to be passed, this message is the method call.

The class diagram show all classes and the relationship betweeen them here is a list of those relations:
- Association: Show the instance relationship betweeen two or more classes
- Generalization: Used to indicate inheritance between classes
In the picture bellow we show an example of Association, the "order" is associated with the "customer" class, an "order" can only be associated with one "customer", but a "customer" can have many orders.

Now we in the generalization case we can see that "THexapod" inherits characteristics and behavior of "TRobot"
Bellow is our class diagram
State diagrams
This diagrams describes all possible states that an object can have. Normally you will have a State diagram for each class. Thera are some interesting tools to generate code form State diagrams, so it's very important to cover all possible states from each object.
The state diagrams has a few elements the rounded box indicate the state name, the arrows indicate the transition to the next state, the activity indicates what the system will be doing while in that state.

We can also have a "condition" that will chage the current state to another.

Let's see the state diagram of class "TLogin"
Physical and deployment diagram
Those diagrams are related in how the software components gonna be deployed across the system infrastructure. It details network capabilities, server specifications, hardware requirements and other information related to deploying the proposed system.