Introduction to UML

Tomas GidΓ©n
15 Nov 201522:40

Summary

TLDRIn this introduction to UML (Unified Modeling Language), Tomas Eden, a senior consultant in embedded systems from Stockholm, Sweden, provides an overview of UML's purpose and utility. UML is a visual modeling language primarily for software systems, with 14 types of diagrams to capture different aspects of a system. The video focuses on three key diagrams: Class Diagrams for structure, State Machines for behavior, and Sequence Diagrams for interactions. Eden emphasizes UML's role in system design, documentation, and code generation, and suggests starting with basic diagrams before exploring advanced ones. He also recommends tools for UML modeling, from whiteboards to specialized software like IBM Rational Rhapsody and Enterprise Architect.

Takeaways

  • πŸ˜€ UML (Unified Modeling Language) is a visual modeling language used primarily for software systems, but can also be applied to systems engineering.
  • πŸ” The goal of UML is to provide a standard way to visualize the design of a system, making it easier to understand and communicate.
  • πŸ“Š UML includes 14 different types of diagrams, each capturing different aspects of a software system, such as structure, behavior, and interactions.
  • πŸ› οΈ UML can be particularly beneficial for object-oriented programming languages, although it can be used for non-object-oriented systems as well.
  • πŸ”¨ One of the main uses of UML is in the design phase of system development, before coding begins, to help plan out the system's structure and behavior.
  • πŸ”„ UML diagrams can be used to document a system, making it easier to maintain and understand, especially in organizations with large amounts of legacy code.
  • πŸ” The Class Diagram is a key UML diagram that shows the classes in a system, their attributes, operations, and the relationships between them.
  • πŸ”„ The State Machine Diagram is used to model the behavior of a system by defining states, transitions, and actions, which can help avoid complex and hard-to-follow code.
  • πŸ”— The Sequence Diagram is an interaction diagram that shows the interactions between objects in a system over time, which is useful for modeling and testing protocols.
  • πŸ› οΈ Tools for creating UML diagrams range from simple whiteboards to sophisticated software tools like IBM Rational Rhapsody and Enterprise Architect, with various features and price points.
  • πŸ“š Learning UML can be beneficial for software designers and developers, as it provides a structured way to think about and design software systems.

Q & A

  • What is the primary goal of the UML introduction presented by Tomas Eden?

    -The primary goal is to provide an initial insight into what UML (Unified Modeling Language) is and to determine if it could be beneficial for the viewer and their organization.

  • What is UML used for according to the presentation?

    -UML is used for modeling software systems, and it can also be applied to systems engineering. It is particularly useful for designing systems before coding and for documenting the system architecture.

  • How many types of diagrams are specified in the UML standard?

    -There are 14 different types of diagrams specified in the UML standard.

  • What are the two main groups of UML diagrams?

    -The two main groups of UML diagrams are structural diagrams and behavior diagrams.

  • What is a class diagram and why is it useful?

    -A class diagram is a structural diagram that shows the classes, their attributes, methods, and the relationships between them. It is useful for providing a clear overview of the system's structure and for designing object-oriented systems.

  • How does a state machine diagram help in modeling software systems?

    -A state machine diagram helps in modeling software systems by describing the logical structure and behavior of the system through states, transitions, and actions, which can prevent the code from becoming disorganized.

  • What is the difference between a sequence diagram and a state machine diagram?

    -A sequence diagram is an interaction diagram that shows the interactions between objects in a system over time, while a state machine diagram is a behavior diagram that focuses on the states an object can be in and the transitions between those states.

  • What is the role of the 'guard' in a state machine diagram?

    -In a state machine diagram, a guard is a condition that must be true for a transition to occur. It acts as an exit statement that needs to be satisfied for the transition to be executed.

  • Why might a sequence diagram be preferred over a state machine diagram?

    -A sequence diagram might be preferred when dealing with multiple components or when the system involves complex interactions between objects, as it can better illustrate the sequence of messages and the flow of control.

  • What are some tools recommended for creating UML diagrams?

    -Some recommended tools for creating UML diagrams include whiteboards for initial design discussions, Visio for basic diagramming, and more advanced tools like IBM Rational Rhapsody or Sparx Systems Enterprise Architect for code generation and reverse engineering.

  • What is the significance of the multiplicity numbers in a class diagram?

    -The multiplicity numbers in a class diagram indicate the number of instances one class can have in relation to another class, showing the relationship's cardinality.

Outlines

00:00

πŸ“˜ Introduction to UML

The speaker, Tomas Eden, introduces the Unified Modeling Language (UML) as a visual modeling language primarily used for software systems. He clarifies that the presentation aims to provide an initial understanding of UML rather than an exhaustive tutorial. UML is used for creating diagrams that capture various aspects of a software system, and it's particularly beneficial for object-oriented programming. The presentation mentions that UML can be applied in system design before coding begins, and it can also be used for documentation and reverse engineering of legacy code. The UML standard includes 14 different types of diagrams, but the speaker focuses on three main types: structural, behavioral, and interaction diagrams.

05:01

πŸš— Class Diagrams in UML

The speaker explains class diagrams as a structural diagram in UML, using a car and its components as an example. Classes in object-oriented programming encapsulate data and functions. The class diagram shows class names, member variables (attributes), and operations (methods). Attributes can be public or private, indicated by a '+' or '-' sign, respectively. Operations are typically public and do not have a lock symbol. Associations between classes represent relationships, with multiplicity numbers indicating the number of instances. Composition and aggregation are specific types of associations, shown with a filled diamond shape, indicating that the life cycle of the associated classes is tied to the owning class. Generalizations, or inheritance, are shown with arrows, indicating that a class is a type of another class.

10:02

πŸ” State Machines in UML

The speaker discusses state machines as a type of behavioral diagram in UML, illustrating with a safe lock example. State machines describe the logical structure of code, defining states, transitions, and actions. States represent conditions, and transitions occur based on events (triggers) and conditions (guards). The example shows nested states within the 'safe closed' state, including 'lock idle' and 'waiting for more digits'. Transitions can have actions, such as sending a message or changing a state variable. The speaker also mentions special internal triggers like 'on entry' and 'on exit' for states, which are executed when entering or exiting a state.

15:02

πŸ” Sequence Diagrams in UML

The speaker introduces sequence diagrams as a type of interaction diagram in UML, focusing on a model-view-controller pattern example. Sequence diagrams show the interactions between objects over time, represented by lifelines. Messages between objects are shown as arrows, indicating communication. The example includes a user creating an account, with the view sending a 'create user request' message to the controller. The speaker discusses the use of sequence diagram references to manage complexity and combined fragments, which are used to represent conditional logic within interactions. The comparison between sequence diagrams and state machine diagrams is highlighted, with the former being more suitable for multiple components and the latter for control flows without a clear endpoint.

20:03

πŸ› οΈ UML Tools and Conclusion

The speaker concludes by discussing various UML tools, recommending starting with a whiteboard for simplicity and then progressing to digital tools for documentation. He mentions Visio as a basic tool, Microsoft's diagramming tools in Visual Studio, and IBM's Rational Rhapsody for more advanced features like code generation and reverse engineering. The speaker also highlights the Rational Modeler as a free alternative for creating UML diagrams. He encourages learning the basics of UML and using it within organizations before exploring more complex diagram types. The presentation ends with an invitation for questions and potential training courses.

Mindmap

Keywords

πŸ’‘UML (Unified Modeling Language)

UML is a standardized modeling language used in software engineering to create visual models of software systems. It is designed to provide a common language that describes the structure, behavior, and interactions of system components. In the video, UML is introduced as a tool for modeling software systems, with an emphasis on its utility for both object-oriented and non-object-oriented systems. The script mentions that UML can be used for designing systems before coding, generating code from diagrams, and documenting systems.

πŸ’‘Diagrams

In the context of UML, a diagram is a visual representation of elements and their relationships within a software system. The video discusses various types of diagrams, such as class diagrams, state machine diagrams, and sequence diagrams, each serving a different purpose in modeling different aspects of a software system. Diagrams are central to UML as they provide a way to visualize and communicate the design and behavior of systems.

πŸ’‘Class Diagram

A class diagram in UML is used to model the structure of a system by showing the system's classes, their attributes, operations, and the relationships between them. The video provides an example of a class diagram for a car and its components, illustrating how classes encapsulate data and functions, and how attributes and operations are represented. The script explains concepts like multiplicity, associations, and inheritance within the context of class diagrams.

πŸ’‘State Machine Diagram

A state machine diagram in UML is used to model the behavior of a system by representing its states, transitions, and events. The video describes how state machines help in defining the logical structure of code, avoiding spaghetti code by specifying states and transitions based on events. The script uses a safe's locking mechanism as an example to demonstrate how states and transitions are modeled.

πŸ’‘Sequence Diagram

A sequence diagram in UML is an interaction diagram that shows how objects interact with each other over time in a particular scenario. The video explains sequence diagrams by modeling a simple model-view-controller pattern, where a user interacts with a system to create a new account. The script details how sequence diagrams depict the flow of messages between objects and the order of execution over time.

πŸ’‘Object-Oriented Programming

Object-oriented programming (OOP) is a programming paradigm that uses objects and classes to design applications. The video mentions that many programming languages are object-oriented and that UML can be used to model both object-oriented and non-object-oriented systems. However, the video suggests that UML is particularly beneficial when used with OOP due to its alignment with concepts like classes and objects.

πŸ’‘Inheritance

Inheritance is a fundamental concept in object-oriented programming and UML, where a class (child class) can inherit properties and behaviors (methods) from another class (parent class). The video script uses the example of a 'Transmission' class being a base class from which 'ManualTransmission' and 'AutomaticTransmission' classes inherit, illustrating how inheritance is represented in class diagrams.

πŸ’‘Multiplicity

Multiplicity in UML refers to the number of instances one class can have with another class in an association. The video script explains this concept using the example of a 'Car' class being associated with an 'Engine' class, where the multiplicity indicates the number of engines a car can have and vice versa, which is typically '1' in this context.

πŸ’‘Association

An association in UML is a semantic relationship between two classes that specifies how instances of those classes are connected. The video script describes general associations and more specific types like composition and aggregation, using the example of a 'Car' class being composed of an 'Engine', a 'Transmission', and 'Wheels'.

πŸ’‘Tools

The video discusses various tools that can be used to create UML diagrams, ranging from simple whiteboards to specialized software tools. It mentions tools like Visio, which is a visual diagramming tool that supports UML, and IBM Rational Rhapsody, which is a more advanced tool for creating UML diagrams, code generation, and reverse engineering. The script suggests starting with simple tools like whiteboards before moving to more complex software tools.

Highlights

Introduction to UML by Tomas Eden, a senior consultant in embedded systems based in Stockholm, Sweden.

The goal of the presentation is to provide an insight into UML and its applicability for organizations, not to teach everything about UML.

UML (Unified Modeling Language) is primarily used for modeling software systems, although it can also be applied to systems engineering.

UML consists of 14 different types of diagrams, each capturing different facets of a software system.

Three main types of UML diagrams introduced: structural diagrams (like class diagrams), behavior diagrams (like state machines), and interaction diagrams (like sequence diagrams).

Class diagrams in UML show the structure of a system by representing classes, their attributes, methods, and relationships like associations and inheritance.

State machine diagrams are used to model the logical flow of a system, showing states and transitions between them based on conditions.

Sequence diagrams are used to represent interactions between objects over time, particularly useful for modeling protocols and complex interactions.

The importance of starting system design with UML diagrams to ensure a clear structure before beginning code implementation.

UML can be used to generate code from diagrams, ensuring that design and implementation are always in sync.

Reverse engineering tools are available to create UML diagrams from existing code, which is useful for documenting legacy systems.

Using UML in an organization requires a basic understanding among all team members, with further diagram types introduced as organizational maturity increases.

Recommendations on UML tools: starting with whiteboard designs, moving to tools like Microsoft Visio, IBM Rational Rhapsody, or Sparx Systems Enterprise Architect for more advanced needs.

The value of UML for documentation purposes, especially in structured organizations where maintaining up-to-date documentation is critical.

The presentation concludes with an invitation for further questions, additional presentations, and potential training courses.

Transcripts

play00:00

hello welcome to this introduction to

play00:03

UML the unified modeling language my

play00:06

name is Tomas Eden and I'm a senior

play00:07

consultant in embedded systems right

play00:10

here in Stockholm Sweden the goal of

play00:12

this introduction is not to teach you

play00:15

everything about UML but simply to give

play00:17

you a first insight into what UML is and

play00:19

if it could be something for you and

play00:21

your organization this presentation in

play00:23

just the first mysterious the

play00:25

presentation is about UML if you have

play00:28

any questions please get in touch or

play00:30

watch the upcoming presentations so

play00:33

let's dive right in so what is you know

play00:37

just as the name says it's a modeling

play00:40

lounge and it's a modeling lounge for

play00:43

most for software systems it can be used

play00:45

for systems engineering also where the

play00:47

next station causes Mel but today I am

play00:50

only going to talk about how to can be

play00:52

used for modeling software systems you -

play00:55

the visual modeling lounge and what I

play00:57

mean with that is that you're working

play00:59

with different types of diagrams you can

play01:02

do this either in just the whiteboard or

play01:04

in a modeling program specialized for

play01:07

you Mel

play01:08

I like it back to view those tools at

play01:10

the end of this presentation

play01:12

in the Yuma standard there are 14

play01:15

different types of diagrams specified

play01:17

and each and then pressed capture

play01:19

different facets of our software system

play01:21

today I'm going to introduce to you

play01:24

three of these different diagrams to

play01:27

give you a feel for what can be done

play01:28

with UML many of today's programming

play01:31

languages are object-oriented

play01:33

programming lounges and so is you know

play01:36

UML can definitely also be used to model

play01:38

non object-oriented systems but you do

play01:41

get more mileage shattered if your

play01:43

software system is also object-oriented

play01:45

now that we basically know what UML is

play01:48

the next question is what can it be used

play01:51

for I'd say that the most common way to

play01:54

use the UML is when designing systems

play01:56

and before you start tacking code if

play01:59

you're in a larger organization and you

play02:01

have different systems departments from

play02:04

the development departments the systems

play02:06

departments would draw up some UML

play02:08

diagrams showing the use cases of the

play02:10

whole system

play02:10

and the deployment of different

play02:12

subsystems and

play02:13

four components they may also specify

play02:15

the protocols between subsystems getting

play02:19

over to the engineers boom actually

play02:21

implementation they would break down

play02:23

these UML diagrams into smaller parts

play02:25

and I detailed down to the class and

play02:27

object level of the design before before

play02:30

starting to write code if you're really

play02:33

serious about using a UML you can even

play02:35

generate the actual code from the UML

play02:37

diagrams themselves the benefits here

play02:41

are that the design and the

play02:42

implementation are always in sync and by

play02:45

increasing the abstraction level you can

play02:48

potentially become more efficient every

play02:51

software designer knows that their

play02:53

system needs to be documented in the end

play02:55

but even the most structured

play02:57

organizations the state of the

play02:59

documentation is most often too little

play03:01

and too late if you have designed your

play03:04

system in UML you already have a

play03:07

high-level visual description on your

play03:09

system I had some clarifying text and

play03:12

you're done if you're having to sign

play03:15

into your system in email from the

play03:17

beginning or if you have a large amount

play03:19

of legacy code there are tools there for

play03:21

you to reverse engineer your code into

play03:25

UML diagrams or if you're guaranteeing

play03:28

your documentation from code comments in

play03:30

for example the doxygen style there are

play03:33

plugins to define UML diagrams directly

play03:35

in the comments now our two the

play03:39

different diagram types as I said before

play03:42

Humana consists of 14 different diagrams

play03:45

I'm not going to explain all of them now

play03:48

but don't worry I'm going to go through

play03:50

most of the diagrams deeply in the

play03:52

upcoming presentations but let's look a

play03:55

bit closer at the different groups of

play03:58

diagrams first of all we can see that

play04:01

the UML diagrams are divided into two

play04:03

different main groups on the Left we

play04:07

have the structural diagrams these

play04:09

diagrams are very static and most of

play04:12

them make sure the different components

play04:13

building up the systems and how they

play04:15

relate to each other the components I'm

play04:18

talking about color for example nodes

play04:20

executables classes were objects

play04:25

right we have the behavior diagrams they

play04:28

show more what is happening during a

play04:29

runtime they basically show the logic as

play04:32

it is implemented and how the system

play04:33

reacts to stimuli a subgroup of the

play04:37

behavior diagrams are the interaction

play04:39

diagrams while the other behavior

play04:42

diagrams show the behavior within a

play04:43

component interaction diagrams show

play04:46

behavior between components they could

play04:48

for example describe how the

play04:50

client-server react to each other's

play04:52

inputs over an interface I'm going to go

play04:56

through one diagram each from these

play04:58

three groups and I'm going to start with

play05:00

a scratching diagram the class diagram

play05:04

so here we have the class diagram for

play05:07

this example I have prepared a class

play05:09

diagram over a car and some of its

play05:11

components each box here is a class in

play05:15

object-oriented programming a class

play05:17

isn't an encapsulation of date and

play05:20

functions in that data this is exactly

play05:23

what we have here also first when the

play05:26

class name in this case car below that

play05:29

where that commute as do you male speak

play05:32

for member variables in this case we

play05:34

have that imbued gas that repente

play05:36

represents sandwich gas there is in the

play05:39

car then below with that we have

play05:41

operations

play05:42

let's wrote in that what so now that

play05:44

languages are called methods or memory

play05:47

functions here we have fill for filling

play05:50

out the car or the gas and start for

play05:52

starting the car you see that small

play05:55

block in the gas attribute that shows

play05:58

that the attribute is private this means

play06:01

then that rent that that would get isn't

play06:03

accessible from outside of the class the

play06:06

operation of this class don't have a

play06:08

lock and therefore are public you can

play06:11

also often see a plus sign for the

play06:13

public attributes and/or operations and

play06:15

the minus sign for those that are prior

play06:17

to then we have these lines between the

play06:21

classes that are all over the place

play06:23

these are associations an association

play06:28

signifies a relationship between two

play06:29

classes ever example we have an

play06:32

association to an engine and the

play06:34

transmission

play06:36

the number at each end is the

play06:37

multiplicity the left-hand number who

play06:39

said that each transmission knows about

play06:41

one engine and with the right-hand

play06:43

number we say that each engine knows

play06:45

about one transmission a general

play06:49

Association is a very fuzzy way to

play06:51

describe the relationship there are a

play06:54

few more specific associations one which

play06:56

is called a composition or a composition

play06:59

aggregation this signifies that if an

play07:02

object of an oni class is destroyed so

play07:05

is the owned class this filled in

play07:08

diamonds at the car class shows that it

play07:11

is composed of one engine one

play07:13

transmission and four wheels if the car

play07:16

is destroyed so is the engine of the

play07:18

transmission and the wheels now we only

play07:22

have one more things thing to explain

play07:24

here and that's the arrows you here at

play07:26

the bottom these are called

play07:28

generalizations which is the same thing

play07:31

as what is usually called inheritance in

play07:33

a programming language that is to say

play07:36

that one class is a type of another

play07:38

class in this case we have a

play07:40

transmission as a base class this base

play07:43

class is a generalization of the derived

play07:47

classes for manual transmission and

play07:49

automatic transmission or we could say

play07:53

that the manual and automatic

play07:55

transmission classes are inheriting from

play07:58

the transmission class in this example I

play08:02

shown the differences between the manual

play08:04

automatic transmission classes in that

play08:06

the shift operation is public in the

play08:08

manual class and private in the

play08:10

automatic

play08:12

class as you can see it's very easy to

play08:14

get an overview of a class diagram and

play08:16

how the different classes are related to

play08:18

each other

play08:18

for a developer it is also very much

play08:22

faster to hash out class diagrams on a

play08:24

white board than it is direct number of

play08:27

class declarations in code so we're

play08:29

starting developing a new feature I'd

play08:31

highly recommend starting with the

play08:33

growing up a class diagram to get a

play08:35

feeling for the structure so that was

play08:38

the class diagram now let's move

play08:41

directly over to behavior diagram the

play08:43

state machine a state machine is a

play08:46

classical way to describe the logical

play08:48

structure

play08:49

a great way to code in a way that

play08:51

doesn't end up looking like spaghetti

play08:53

instead of having lots of variables

play08:55

define different cases we specified

play08:57

states we move between depending on the

play09:01

state we are in we get different

play09:03

behavior so here we have a type a

play09:06

mistake machine for safe a safe can have

play09:10

two basic states it can either be locked

play09:12

or it can be open on the stake we have

play09:15

lock this safe as a numeric pad and then

play09:18

an unlock button the IDs that yeah you

play09:21

first punch in your code and then press

play09:24

the unlock button among that we can the

play09:28

state machine and have nested states

play09:30

within other states

play09:31

so when within the state safe closed we

play09:36

have two other states look idle and

play09:38

waiting for more digits to get between

play09:42

the different states we have transitions

play09:44

all conversations have a trigger that is

play09:48

the event that forces the transition

play09:50

that to be evaluated but then it also

play09:54

has a guard there this is an exit

play09:57

statement that needs to be true for the

play09:59

transition would be cared through it

play10:01

could be letter lock the variable needs

play10:03

to have a certain value for example so

play10:06

if the trigger has happened and the

play10:08

guard is true then you move from one

play10:09

state state to another a transition can

play10:13

as nay as an extra bonus also have side

play10:16

effects for example it can send a

play10:19

message to another system we call this

play10:21

side effect an action so let's try to

play10:26

see if we can move through the state

play10:27

machine each state machine has a

play10:30

starting point

play10:31

this is signified as the transition

play10:33

coming from a round ring we see that at

play10:36

the top of the screen here so you start

play10:38

in this state safe closed then because

play10:42

this state has nested states we also

play10:44

have a nested starting point we see that

play10:47

starting point go into the lock idle

play10:49

State from the lock state we have lock

play10:54

idle state we only have one outgoing

play10:55

transition and that is triggered by a

play10:58

digit being entered into the number

play11:01

but luck is that only requires a

play11:04

password a one-digit is a pretty poor

play11:06

lock so that transition takes us in the

play11:09

state where we are waiting for more

play11:11

digits this state you also see the text

play11:15

digit entered now this is an indication

play11:18

that we within this state also are

play11:21

waiting for the trigger digit entered

play11:23

but that if this trigger comes it does

play11:26

not change the state will handle it we

play11:29

call this a do action there are so two

play11:32

it there are also two more special

play11:34

internal triggers called on entry and on

play11:37

exit which are executed when entering a

play11:40

state and exiting a state but I'll talk

play11:42

more about those in an in another

play11:45

presentation anyway we stay in the

play11:49

waiting for a more deep state until

play11:51

somebody presses the open button and

play11:53

here you see that depending on the value

play11:56

of the guard in this case if the correct

play11:58

code wasn't Herman or not we follow two

play12:01

different transitions if the incorrect

play12:04

code was entered we are back in the lock

play12:05

idle state if instead of the correct

play12:08

code was entered we performed action

play12:10

Lock disengaged and move out of our

play12:13

nested state and into the safe open

play12:16

state there is only one way out of the

play12:20

safe open state and that is by pressing

play12:22

the close button under the condition

play12:24

when the door is closed this then

play12:27

performs the action of engaging in the

play12:29

lock which takes us back to the lock

play12:31

idle state since that is an initial

play12:34

state in safe closed and that's it with

play12:37

the state machines state machines with a

play12:40

lot of states going back and forth can

play12:42

look daunting but I can promise you

play12:44

they're hella luck the more difficult to

play12:46

follow in code so as you saw the state

play12:51

machine diagram didn't show any

play12:52

structure at all you can see where the

play12:55

triggers came from you can see who the

play12:57

actions affected twirl interactions

play13:01

between different objects we must of

play13:02

course to go down to the interaction

play13:04

diagrams most common on these diagrams

play13:06

is the sequence diagram let's head down

play13:10

that rabbit hole so

play13:13

what do we see here at the top we have a

play13:16

number of boxes these represents objects

play13:18

well all of them except the leftmost one

play13:21

here called env for environment

play13:24

it's basically absolute about dick

play13:27

representing all external actors outside

play13:29

of our system any way to contact

play13:32

connected with the class diagrams think

play13:35

of these objects as specific instances

play13:37

all the classes you model they're an

play13:41

example here I tried to show simple

play13:43

model view controller pattern it could

play13:46

for example be a website with a web

play13:48

pages of view and web server as a

play13:50

controller and a sequel database as a

play13:53

model the environment would then be the

play13:56

user interacting with the view and in

play13:59

this case it would be a user trying to

play14:01

create a new account when doing a little

play14:04

imitation of this of course the

play14:06

controller for example would be

play14:07

splitting a number of the classes so

play14:10

don't see it just as a class from an in

play14:14

a programming language in this case it

play14:16

is a subsystem we're talking about below

play14:20

each object we see what is called a life

play14:22

line this is a representation of the

play14:25

life of the object time here is moving

play14:27

from top to bottom then between the life

play14:31

lines we have the interactions we call

play14:34

them messages it's possible to

play14:36

differentiate between the synchronous

play14:38

messages and as in crona's messages but

play14:41

I haven't done it here I'll go more into

play14:43

that in a later presentation so first we

play14:47

see the user entering her username and

play14:50

after that her password this doesn't

play14:52

trigger any action from the view it's

play14:55

not on Felicia clicks okay that the view

play14:57

reacts by sending them a message to the

play15:01

controller in the create user request

play15:05

message we can see that it attaches to

play15:07

attributes the username and the password

play15:10

then I have this funny-looking box this

play15:14

is a reference to another sequence it

play15:17

might not look like much but it is one

play15:19

of the great additions to UML 2 done Oh

play15:22

before then you can reference other

play15:24

sequences and

play15:26

limited the size and complexity of

play15:28

systems you could model of a sequence

play15:29

diagram severely now I can build up

play15:32

Araki's are reusable sequence diagrams

play15:35

that goes deeper and deeper into the

play15:37

system it shows progressively more

play15:39

detail in this case the sequence where

play15:42

having a reference to is a sequence to

play15:44

validate the user and password for

play15:47

example it could check that the username

play15:49

is free and that the password has a high

play15:52

enough complexity then we have another

play15:55

of these funny-looking boxes this is

play15:58

also new for UML to dodo and is called a

play16:00

combined fragment there are 12 different

play16:03

combined of fragments and the one you

play16:05

see here is called alt for alternative

play16:08

this is basically a human version of an

play16:11

if-elsif statement as you can see the

play16:15

box is divided by a dashed line at the

play16:18

top of each of the boxes you see is

play16:20

something you should recognize from the

play16:22

state machine diagram and that's the

play16:24

guard within the braces if the guard is

play16:27

true this section is run so in this case

play16:31

if the username and the password is

play16:33

valid we run the top part this would

play16:36

then lead to that the controller creates

play16:38

a user in the model before returning and

play16:40

a que message to the view if the input

play16:44

wasn't valid we can see in the second

play16:46

part of the combined fragment that not

play16:48

okay was returned instead let us take a

play16:52

moment and compare them sequence diagram

play16:54

to the state machine diagram when would

play16:57

you use which diagram of course if you

play17:01

have multiple components the sequence

play17:03

diagram is usually a better fit but that

play17:06

is not enough of a reason sometimes as

play17:10

you hear from the name sequence diagrams

play17:12

are not that good at showing control

play17:14

flows that never end so if you have some

play17:17

kind of interface or protocol where

play17:19

there is a lot like a lot of logic which

play17:21

makes you go back and forth but really

play17:24

doesn't have a well-defined finishing

play17:26

point I definitely go for state machines

play17:29

you would then of course need to model

play17:32

one state machine for each object but

play17:34

then it could be worth it another option

play17:37

though is also to do

play17:40

by the protocol in two parts that are

play17:42

more linear and model each of these

play17:44

parts as their own sequence diagrams I

play17:46

think this is a really wait really good

play17:49

way to do it for example and a protocol

play17:52

you might have a handshake and procedure

play17:54

in the beginning followed with the

play17:56

different reactions depending what the

play17:58

higher layer once something has in the

play18:00

environment then I would model the

play18:03

handshaking procedure as one sequence

play18:05

diagram and the other parts as other

play18:08

sequence diagrams as a bonus the test

play18:11

work could very easily write a test case

play18:14

either each of these different sequence

play18:17

diagrams straight off this makes it

play18:20

extremely easy to verify that all

play18:21

require the required functionality is

play18:24

implemented just run the test for the

play18:27

sequences that are defined it's that

play18:29

easy and with that we wrap up to the

play18:32

sequence diagram part so now I have

play18:36

showed you one structure diagram one

play18:39

behavior diagram and one interaction

play18:42

diagram with just knowing these three

play18:45

diagram types you get very far I would

play18:48

really recommend you to learn these

play18:50

three diagram types first I start to use

play18:53

them in your work before you move on to

play18:55

learning more types you really shouldn't

play18:58

use more diagrams than the necessary

play19:00

either

play19:00

for example the communication diagram is

play19:03

basically a sequence diagram where it's

play19:05

easier to see relations between objects

play19:07

but without the possibility to show

play19:09

logic it definitely has its uses but if

play19:14

nobody else in your organization knows

play19:16

how to read it you shouldn't really use

play19:19

it so first make sure everybody in your

play19:22

organization knows the basics of UML and

play19:25

can use that then later on you can start

play19:29

them to pull in other diagram types as

play19:31

the maturity level in the organization

play19:34

increases when it comes to tools there

play19:38

really are a multitude the doula I

play19:41

always recommend you to start with is

play19:43

the whiteboard

play19:44

don't let the effort of learning a

play19:46

suffer tool standing in your way of

play19:49

learning humo just two designers in a

play19:52

calm

play19:52

with a whiteboard King at designs is

play19:55

very hard to beat but then when you feel

play19:58

ready to take the next step you really

play20:01

should start using it to to be able to

play20:02

at least save away your diagrams for

play20:04

documentation there are a number of

play20:07

different diagramming tools that can do

play20:09

a UML right out of the box or wisdom

play20:11

extra plugins vishal is one of those for

play20:15

example there you can download free

play20:18

Jamel stencils online remember though

play20:21

that with Visio it's only visual it

play20:25

doesn't understand the context of what

play20:28

you're drawing and you can totally

play20:29

forget about connecting different models

play20:32

with each other or a code or a

play20:34

generating code Microsoft isn't pushing

play20:38

for Vichy as you mount to either instead

play20:41

they are pushing a suffer designers to

play20:43

use the diagramming tools in the studio

play20:45

they only support five of the most

play20:47

common new you Mel diagram types but for

play20:50

most purposes that will take you quite

play20:52

far

play20:53

it's graciously enough of those state

play20:55

diagram is not one of the types they

play20:57

support anyway IBM though is a very

play21:03

serious play in the UML field with their

play21:06

rational Rhapsody product depending on

play21:09

what you want to do you can spend

play21:10

anything from a few hundred dollars to

play21:12

well over ten thousand dollars for a

play21:15

license if you want to do code

play21:16

generation and reverse engineering if

play21:19

you're only interested in creating human

play21:21

diagrams though they do have a free

play21:23

version called rational modeler that's

play21:26

what I have been using it to create to

play21:28

the models in this presentation oh I do

play21:32

have a bit of a crush on IBM rational

play21:35

suite of a suffer with the rational

play21:37

purified being a favorite in mind for

play21:39

finding memory leaks and if you are from

play21:42

an enterprise and where to costs aren't

play21:44

as big an issue as the highest quality

play21:47

and the best support I can very much

play21:50

recommend all their products if you do

play21:53

both care about code generation

play21:56

reverse engineering and your financial

play21:59

sanity I can highly recommend a spark

play22:02

systems enterprise architect though

play22:04

there - costs a few hundred bucks and

play22:07

has a great reputation for being good

play22:09

value for the money and with that we are

play22:14

pretty much done I hope you have gotten

play22:16

a better understanding for what UML is

play22:18

and what it can do for you if you have

play22:21

any questions please leave them in the

play22:23

comments below and I'll do my best to

play22:25

answer you if you're interested in me

play22:27

holding a course at your premises for

play22:28

your colleagues to kickstart your

play22:30

organization just get in touch with me

play22:32

directly otherwise subscribe and you'll

play22:35

be the first to know when my next

play22:37

presentation is out

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
UML IntroductionSoftware SystemsModeling LanguageEmbedded SystemsSystem DesignObject-OrientedClass DiagramsState MachinesSequence DiagramsSoftware Engineering