UML Tutorial.doc

  • Upload
    rajpj

  • View
    233

  • Download
    0

Embed Size (px)

Citation preview

  • 8/8/2019 UML Tutorial.doc

    1/99

    UML Tutorial:

    Before You Start

    Welcome to the Unified Modeling Language Tutorial in 7 days. The goal of this courseis to give you the basic knowledge about UML diagrams. It consists of 7 days, dayshave theory material, and ! days are "ractical using of learned theory. The material isdivided into "arts fitting into one day.

    #everal lessons were introduced every day. $fter that a list of answered %uestionsare given to you, and a list of %uestions and e&ercises to do by yourself, tostrengthen your understanding and "ut your newfound knowledge in use.

    'ay ( gives you an UML basics, introduces you with )*$++L and shortly e&"lainesevery UML diagram.

    '$- , '$- ! and '$- "resents ways of creating /lass diagrams and Use /asediagrams, #tate diagrams, #e%uence diagrams and /ollaboration diagrams, $ctivitydiagrams, /om"onent diagrams and 'e"loyment diagrams res"ectively. 0or all of thediagrams a sim"le e&am"le is "rovided, which will guide you through the "rocess ofcreating learned diagram.

    '$- 1 and '$- 2 dives into "ractical use of the UML diagram during the "rocess ofmodeling a system 3 the 'igital Library. 'uring these two days you4ll meet with all theste"s in "rocess of modeling a business sytem. +arts of diagrams given in theselessons are not develo"ed com"letely. This gives you a way of com"leting them and"ut you into a "rocess of develo"ing a model for a 'igital Library.

    In '$- 7 you4ll browse the Internet to see what others made about UML teaching.-ou4ll visit some sites that we recommends you, and you may search for new sites.

    Learning the lessons, you4ll meet with several symbols that have different meaning5

    This symbol a""ears in "laces where new therm or an UMLdefinition is introduced. Te&t that follows is colored with a%uamarinecolor.This icon highlights something which is very im"ortant and you mustmake attention to these "aragra"hs. Te&t that a""ear after thissymbol is dark red and bold.

     $n e&am"le icon. $fter this one an e&am"le is given to you.

     $fter almost every lesson, this symbol stands for most im"ortantthings that you have learned in that lesson.

    When something may be very dificult or com"le& for solution, thisicon a""ears. If you get the solution for the given "roblem be surethat you4ve a strong knowledge of that area.This is symbol for the answer. It a""ear in the 6uestions $nswers

    1

  • 8/8/2019 UML Tutorial.doc

    2/99

    "arts of the day.

    Lets4get started with our work8

    DAY 1

    Introducing the UML

    Modeling of systems, old way vs. new way

    RAD 9*a"id $""lication 'evelo"ment:

    UML Component

    6uestions $nswers

    Worksho"

    DAY 1: In thi da!" !ou#ll learn a$out:

    What is Unified Modeling LanguageModeling of #ystems)uidelines for *a"id $++Lication ngineering 9)*$++L:/om"onents of the UML

    Introducing the UML %Unified Modeling Language&

     $s the world becomes more com"le&, the com"uter3based systems that inhabit theworld also must increase in com"le&ity. They often involve multi"le "ieces of hardwareand software, networked across great distances, linked to databases that containmountains of information. If you want to make systems that deal with this, how do youget your hands around the com"le&ity;

    The key is to organi

  • 8/8/2019 UML Tutorial.doc

    3/99

    by far the most e&citing thing to ha""en to the software industry in recent years. veryother engineering disci"line has a standard method of documentation. lectronicengineers have schematic diagrams, architects and mechanical engineers haveblue"rints and mechanical diagrams. The software industry now has UML.

    >efore we move on ne&t lesson consider some of the benefits of UML5

    1 -our software system is "rofessionally designed and documented before it is coded.-ou will know e&actly what you are getting, in advance.

    ' #ince system design comes first, reusable code is easily s"otted and coded with thehighest efficiency. -ou will have lower develo"ment costs.

    ( Logic 4holes4 can be s"otted in the design drawings. -our software will behave as youe&"ect it to. There are fewer sur"rises.

    ) The overall system design will dictate the way the software is develo"ed. The rightdecisions are made before you are married to "oorly written code. $gain, your overallcosts will be less.

    * UML lets us see the big "icture. We can develo" more memory and "rocessorefficient systems.

    + When we come back to make modifications to your system, it is much easier to workon a system that has UML documentation. Much less 4relearning4 takes "lace. -oursystem maintenance costs will be lower.

    , If you should find the need to work with another develo"er, the UML diagrams willallow them to get u" to s"eed %uickly in your custom system. Think of it as aschematic to a radio. Bow could a tech fi& it without it;

    - If we need to communicate with outside contractors or even your own "rogrammers, itis much more efficient.

    Uing The Unified Modeling Language .ill reult in lo.er o/erall cot" morerelia$le and efficient oft.are" and a $etter relationhip .ith all partie in/ol/ed0Soft.are documented .ith UML can $e modified much more efficientl!0 Youroft.are .ill ha/e a future0

    Modeling of !tem" old .a! /0 ne. .a!

    'uring this course we will deal with systems, or "arts of some larger systems.

    #ystem is a combination of software and hardware that "rovides a solution for a bussines "roblem.

    +rocess of develo"ing that system involves a lot of "eo"le. 0irst of all is the client , the "erson who has the "roblem to be solved. $n analyst  documents the client4s "roblem and relays it to developers, "rogrammers who build the software that solves the"roblem, test it and de"loy i t on com"uter hardware. This is necessary because systems today are so com"le&, knowledge hasbecome so s"eciali

  • 8/8/2019 UML Tutorial.doc

    4/99

    The waterfall method for modeling of systems

    The old way of system modeling, known as the waterfall method , s"ecifies that analysis, design, coding and de"loymentfollow one another. Cnly when one is com"lete can the ne&t one begin. If an analyst hands off analysis to a designer, whohands off a design to a develo"er, chances are that the three team members will rarely work together and share im"ortantinsights. Usually the adherents of the waterfall method give coding a big amount of "roAect time, it takes a valuable timeaway from analysis and design.

    In the new way, contem"orary software engineering stress continuing inter"lay among the stages of develo"ment. $nalystsand designers, for e&am"le, go back and forth to envolve a solid foundation for the "rogrammers. +rogrammers, in turn,interact with analysts and designers to share their insights, modify designs, and strenghten their code. The advantage is thatas understanding grows, the team incor"orates new ideas and builds a stronger system.

    RAD %Rapid Application De/elopment&

    *$' consists of five segments5

    1 *e%uirements gathering

    '  $nalysis

    ( 'esign

    ) 'evelo"ment

    * 'e"loyment

    Reuirement gatheringThis segment consists of a several actions. >efore moving on to actions, it is im"ortantto know that if you don4t understand what the client wants, you4ll never build the rightsystem.

    Dico/er Buine 2rocee5 Bere analysts gain an understanding of the client4sbusiness "rocesses, by interviewing the client or a knowledgeable client3designated"erson and asks the interviewee to go through the relevant "rocess3es ste"3by3ste".Product 5 $ctivity diagram9s:.

    2erform Domain Anal!i5 The analyst interviews the client with the goal ofunderstanding the maAor entities in the client4s domain. 'uring the conversation betweenthe client and the analyst, another team member takes notes. The obAect modeler listensfor nouns and starts by making each noun a class. Ultimately, some nouns will become

    4

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#req%23reqhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#ana%23anahttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#des%23deshttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#dev%23devhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#dep%23dephttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#67561%2367561http://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#req%23reqhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#ana%23anahttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#des%23deshttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#dev%23devhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#dep%23dep

  • 8/8/2019 UML Tutorial.doc

    5/99

    attributes. Be or she also listens for verbs, which will become o"erations of the classes.Product 5 Bigh3level class diagram and a set of meeting notes.

    Identif! Cooperating S!tem5 arly in the "rocess the develo"ment team finds oute&actly which systems the new system will de"end on, and which systems will de"endon it. $ system engineer takes care of this action.

    Product 5 'e"loyment diagram.

    Dico/er S!tem Reuirement5 In this action team goes through its first ?oint $""lication 'evelo"ment 9?$': session. This session brings together decision makersfrom client4s organi

  • 8/8/2019 UML Tutorial.doc

    6/99

    Anal!5e Integration .ith Cooperating S!tem5 The system engineer, "roceeding in"arallel with all the "receding ste"s, uncovers s"ecific details of the integration with thecoo"erating systems. What ty"e of communication is involved; What is the networkarchitecture; If the system has to access databases, and if which are the ty"es ofdatabases.Product 5 'etailed de"loyment diagram and if necessary data models.

    DeignIn this segment, the team works with the results of the $nalysis segment to design thesolution. 'esign and $nalysis should go back and forth until the design is com"lete.

    De/elop and Refine 4$6ect Diagram5 +rogrammers take the class diagram andgenerate any necessary obAect diagrams by e&aming each o"eration and develo"ing acorres"onding activity diagram. This activity diagrams will serve as the basis for much of the coding in the 'evelo"ment segment.Product 5 $ctivity diagrams.

    De/elop Component Diagram5 In this action "rogrammers also "lay a maAor role. Thetask here is to visuali

  • 8/8/2019 UML Tutorial.doc

    7/99

    Tet Code5 This action feeds back into the "receding action and vice versa, until code"asses all levels of testing, develo"ed in "revious segment 9'esign Tests:.Product 5 Test results.

    Contruct Uer Interface" Connect to Code and Tet5 $lso and this action is aconnection between 'esign and 'evelo"ment. Bere a )UI s"ecialist construct a"roved

    interface "rototy"es and connects them to code. $lso and testing the interface ensuresthat the interfaces work correctly.Product 5 0unctioning system, com"lete with user interfaces.

    Complete Documentation5 'uring the develo"ment segment, documentation e&"ertswork in "arallel with "rogrammers to com"lete of all documentation.Product 5 #ystem documentation.

    Deplo!mentWhen develo"ment is com"lete, the system is de"loyed on the a""ro"riate hardwareand integrated with the coo"eration systems.

    2lan for Bac7up and Reco/er!5 This action can start long before the develo"mentsegment begins. The system engineer creates a "lan for ste"s to follow in case thesystem crashes.Product 5 The crash recovery "lan.

    Intall the 3inihed S!tem on Appropriate 8ard.are5 This ste" "erforms the systemengineer with any necessary hel" from the "rogrammers.Product 5 0ully de"loyed system.

    Tet the Intalled S!tem5 $fter installing the software on a""ro"riate com"uter9s:, thedevelo"ment team tests the installed system. 'oes it "erform as it4s su""osed to; 'oes

    the backu" and recovery "lan work; *esults of this tests determine whether furtherrefinement is necessary.Product 5 Test results.

    Cele$rate5 When all of the work is finished, the develo"ment team may go somewhereto celebrate for their success.

    A 7eleton of de/elopment proce i 9RA22L %9uideline for RapidA22Lication ngineering&" .hich conit of fi/e egment: Reuirementgathering" Anal!i" Deign" De/elopment and Deplo!ment0 ach egmentconit of a num$er of action" and each action reult in a .or7;product0 UMLdiagram are .or7 product for man! of the action0

    UML Component

    The UML certain number of gra"hical elements combined into diagrams. >ecause it is alanguage, the UML has rules for combining these elements.

    The "ur"ose of the diagrams is to "resent multi"le views of a system, and this set ofmulti"le views is caled a model.

    7

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/01day3.html#67561%2367561

  • 8/8/2019 UML Tutorial.doc

    8/99

      UML model describes what a system is su""osed to do. It doesn4t tell how to im"lementthe system.

    Let4s take a brief look of all the UML diagrams. UML consists of nine basic diagrams, butbear in mind that hybrids of these diagrams are "ossible.

    Cla DiagramThings naturally fall into categories 9com"uters, automobiles, trees...:. We refer to thesecategories as classes.

      $ class is a category or grou" of things that have similar attributes and commonbehaviors.

    /lass diagram "rovide the re"resentations used by the develo"ers.0or detailed information about /lass diagrams /lick Bere8

    4$6ect Diagram

     $n obAect is an instance of a class 3 a s"ecific thing that has s"ecific values of theattributes and behavior.

    Ue Cae Diagram $ use case is a descri"tion of a system4s behavior from a user4s stand"oint.0or system develo"ers, this is a valuable tool5 it4s a tried3and3true techni%ue forgathering system re%uirements from a user4s "oint of view. That4s im"ortant if the goal isto build a system that real "eo"le can use. In gra"hical re"resentations of use cases asymbol for the actor is used .

    The actor is the entity that initiates the use case. It can be a "erson or another system.

    0or detailed information about Use /ase diagrams /lick Bere8

    State Diagram $t any given time, an obAect is in "articular state. #tate diagrams re"resent these states,and their changes during time. very state diagram starts with symbol that re"resentsstart state, and ends with symbol for the end state. 0or e&am"le every "erson can be anewborn, infant, child, adolescent, teenager or adult.

    0or detailed informations about #tate diagrams /lick Bere8

    Seuence Diagram

    /lass diagrams and obAect diagrams re"resent static information. In a functioningsystem, however, obAects interact with one another, and these interactions occur overtime. The UML se%uence diagram shows the time3based dynamics of the interaction.

    0or detailed informations about #e%uence diagrams /lick Bere8

    Acti/it! DiagramThe activities that occur within a use case or within an obAect4s behaviour ty"ically occurin a se%uence. This se%uence is re"resented with activity diagrams.

    0or detailed informations about $ctivity diagrams /lick Bere8

    8

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day1.html

  • 8/8/2019 UML Tutorial.doc

    9/99

    Colla$oration DiagramThe elements of a system work together to accom"lish the system4s obAectives, and amodeling language must have a way of re"resenting this. The UML collaborationdiagram is designed for this "ur"ose.

    0or detailed informations about /ollaboration diagrams /lick Bere8

    Componenet DiagramToday in software engineering we have team3based develo"ment efforts, whereeveryone has to work on diferent com"onent. That4s im"ortant to have a com"onentdiagram in modeling "rocess of the system.

    0or detailed informations about /om"onent diagrams /lick Bere8

    Deplo!ment DiagramThe UML de"loyment diagram shows the "hysical architecture of a com"uter3basedsystem. It can de"ict the com"uters and devices, show their connections with oneanother, and show the software that sits on each machine.

    0or detailed informations about 'e"loyment diagrams /lick Bere8

    S!tem de/elopment i a human acti/it!0 An.er

    >efore reading an answer of every %uestion, try answer it by yourself.

  • 8/8/2019 UML Tutorial.doc

    10/99

    'Dame the actions in $nalysis segment of )*$++L, and give their work3"roducts.

    ( In which "art9s: of *$' "rogrammers take turn;

    ) Why is it necessary to have a variety of diagrams in a model of a system;

    * Which diagrams "rovide a static view of a system;

    + Which diagrams "rovide a dynamic view 9show change over time:;

    DAY '

    Cla Diagram

    Eisualising a /lass

     $ssociations

    Inheritance )enerali

  • 8/8/2019 UML Tutorial.doc

    11/99

    De&t lessons will deal with class diagrams. Bow to e&tract classes, their attributes andmethods from interviewing a client, and then bind the classes with relationshi"s to formthe class diagram. -ou4ll learn more about5

    1 Eisualising a /lass 9attributes and o"erations:'  $ssociations

    ( Inheritance )enerali

  • 8/8/2019 UML Tutorial.doc

    12/99

     !lso operations may have some additional information In

    the parentheses that follow an operation name, you canshow the parameter that the operation wor"s on, along withthe parameter's type If the operation is function, then wemust specify the type of the returned value

    Cther additional features that can be attached to attributes of the class are constraintsand notes.Contraint are free form te&t enclosed in braces. The backeted te&t s"ecifies one ormore rules the class follows.ote usually are attached to attributes as well as o"erations, and they give additionalinformation to a class. $ note can contain a gra"hic as well as te&t.

    Bow can we derives classes from interviewing the clients;

    In con/eration .ith client" $e alert to the noun the! ue to decri$e theentitie in their $uine0 Thoe noun .ill $ecome the clae in !our model0 Bealert alo to the /er$ that !ou hear" $ecaue thee .ill contitute the operationin thoe clae0 The attri$ute .ill emerge a noun related to the cla noun0

     

    Aociation

    When classes are connected together conce"tually, that connection is called anassociation.

    -ou visuali

  • 8/8/2019 UML Tutorial.doc

    13/99

    &ust li"e a class, anassociation can have

    attributes and operations Inthis case we have anassociation class

    -ou visuali

  • 8/8/2019 UML Tutorial.doc

    14/99

    If you know something about a category of things, you automatically know some thingsyou can transfer to other categories.

    If you know something is an animal, you take for granted that it eats, slee"s, has a wayof being born, has a way of getting from one "lace to another... >ut imagine thatmammals, am"hibians and re"tiles are all animals. $lso cows, dogs, cats... are grou"ed

    in category mammals. CbAect3orientation refers to this as inheritance.

     !n inheritance hierarchy in theanimal "ingdom

    Cne class 9the child class or subclass: can inherit attributes and o"erations from another 9the "arent class or su"erclass:. The "arent class is more general then the child class.In generali

  • 8/8/2019 UML Tutorial.doc

    15/99

    #ometimes a class consists of a number of com"onent classes. This is a s"ecial ty"e ofrelationshi" called aggregation. The com"onents and the class they constitute are in a"art3whole association.

     $ggregation is re"resented as a hierarchy with the FwholeF class at the to", and thecom"onent below. $ line Aoins a whole to a com"onent with an o"en diamond on the line

    near the whole.

    Let4s take a look at the "arts consisting a TE set. very TE has a TE bo&, screen,s"eaker9s:, resistors, ca"atitors, transistors, I/s... and "ossibly a remote control.*emote control can have these "arts5 resistors, ca"atitors, transistors, I/s, battery,keyboard and remote lights.

     !n aggregationassociation in theT et system

    #ometimes the set of "ossible com"onents in an aggregation falls into an C*relationshi". To model this, you would use a constraint 3 the word C* within braces on adotted line that connects the two "art3whole lines.

     $ com"osite is a strong ty"e of aggregation. ach com"onent in a com"osite can belongto Aust one whole. The symbol for a com"osite is the same as the symbol for anaggregation e&ce"t the diamond is filled.

    If you e&amine the human4s outside you4ll find out that every "erson has5 head, body,arms and legs. This is shown on this "icture.

     ! composite association In thisassociation each componentbelongs to e%actly one whole

    An aggregation pecifie a part;.hole aociation0 A E.holeE cla i made up ofcomponent clae0 A compoite i a trong form of aggregation" and acomponent in a compoite can $e part of onl! one .hole0 Aggregation andcompoite are repreented a line 6oining the .hole and the component .ithopen and filled diamond" repecti/el!" on the .hole ide0

    15

  • 8/8/2019 UML Tutorial.doc

    16/99

    Interface and Reali5ation

    In "revious lessons we learned how to refine classes from the interview with client, andrelate them with different relationshi"s between them. >ut it4s "ossible that some ofclasses are not related to a "articular "arent, but their behaviors might include some ofthe same o"erations with the same signatures. -ou can code the o"erations for one ofthe classes and reuse them in the others.

     $n interface is a set of o"erations that s"ecifies some as"ect of a class behaviour, andit4s a set of o"erations a class "resents to other classes.-ou model an interface the same way you model a class, with the rectangle icon, butinterface has no attributes, only o"erations. $nother way is with a small circle Aoined withline to a class.

    The com"uter4s keyboard is a reusable interface. Its keystroke o"eration has beenreused from the ty"ewriter. The "lacement of keys is the same as on a ty"ewriter, butthe main "oint is that the keystroke o"eration has been transfered from one system toanother. $lso on com"uter4s keyboard you4ll find a number of o"erations that you won4tfind on a ty"ewriter 9/trl, $lt, +ageU", +age'own...:

     !n interface is a collection of operations that aclass carries out 

    To distinguish interfaces from classes, in stereoty"e construct we "ut **interface++ or I  at the begining of the name of any interface.

    The relationshi" between a class and an interface is called reali

  • 8/8/2019 UML Tutorial.doc

    17/99

    protected le/el usability is o"en only to classes that inherit from original class Gpri/ate le/el only the original class can use the attribute or o"eration ;

    Public and private operations in a ardis" 

    Cla Diagram ; ample

    Bere is a brief descri"tion for writing a te&t document5

    #u""ose that you4re writing a document in some of famous te&t "rocessing tools, like

    MicrosoftWord for e&am"le. -ou can start ty"eing a new document, or o"en an e&istingone. -ou ty"e a te&t by using your keyboard.

    very document consists of several "ages, and every "age consists of header,document4s body orGand footer. In header and footer you may add date, time, "agenumber, file location e.t.c.

    'ocument4s body has sentences. #entences are made u" of words and "unctual signs.Words consists of letters, numbers andGor s"ecial characters. $lso in the te&t you mayinsert "ictures and tables. Table consists of rows and columns. very cell from table mayhold u" te&t or "ictures.

     $fter finishing the document, user can choose to save or to "rint the document.

    This is sim"lified e&"lanation of creating a te&t document. If we e&tract the list of nounsform "revious te&t, a following list can be achieved5

    document" tet proceing tool" Microoft

  • 8/8/2019 UML Tutorial.doc

    18/99

    The ocument class

    The 2age cla will hold pageNumber  as an attribute, and o"erations allowed here canbe5 newPage(), hideHeader() and hideFooter(). C"erations for the header and footertells us that the Beader and The 0ooter can be also a classes.

    The Page class

    The 8eader cla and the 3ooter cla has common attributes5 date, time, pageNumber  and fileLocation. These attributes are o"tional for every header or footerand user may configure them. This will guide us that a common class can be introduced.This will be a good time to make an inheritance. +arent class will be BottomUp 9thisname is chosen because headers and footer a""ear in u""er and bottom "arts of every"age: and will hold common attributes for header and footer, and these o"erations5display(), hide() and change(). Beader and 0ooter classes 9children of this class: willhave only o"erations5 newHeader() and newFooter().

    The .ottom/p class and it's children

    >efore e&amining the document4s body or te&t, lets take a look at the makeing of te&tactions. 'ocument4s te&t is made u" of sentences. #entences are made u" of words andwords are made u" of characters. If words are array of characters and sentence is arrayof words, then a sentence is also an array of characters. Therefore a document4s bodycan be an array of characters. 0or this "ur"ose to make a document4s te&t we4ll use the/haracter class with its children. The Character cla wil have A!""code and type asattributes 9ty"e tells the ty"e of the character 3 normal, italic, bold or underline:, and

    18

  • 8/8/2019 UML Tutorial.doc

    19/99

    normal(), bold(), italic() and underline() as o"erations. The /haracter class childrenswill be5 Letter , 2unctualSign, SpecialCharacter  and um$er . $lso in the document4sbody can be found tables and "ictures. These are new classes in our class diagram.

    The character hierarchy 

    The Ta$le cla has numb#ows and numb!olumns as attributes and new#ow(),new!olumn() and new$able() as o"erations. very table consists of one or more cells.

     $nd in every cell, te&t or "ictures can be "laced.

    The Table class and the Picture class

    Baveing all this classes in front of us we can draw out the associations between themand gain the com"leted class diagram for this "roblem.

    The class diagram for the ma"eing of te%tdocument 

    )iven class diagram is not finished in detail. If you know more about ty"eing adocument, then add information you know to the given diagram. This model can growand grow, and makeing all the necessary ste"s of analysis and design you may reachthe "oint, where a new te&t "rocessing tool is modeled.

    19

  • 8/8/2019 UML Tutorial.doc

    20/99

    Ue Cae Diagram

    /lass diagrams "rovide a static view of the classes in a system. De&t diagrams "rovidea dynamic view and show how the system and its classes change over time.

    The tatic /ie. help an anal!t communicate .ith a client0 The d!namic /ie."help an anal!t communicate .ith a team of de/eloper" and help thede/eloper create program0

    ?ust as the class diagram is a great way to stimulate a client to talk about a system fromhis or her view"oint, the use case is an e&cellent tool for stimulating "otential users totalk about a system from their own view"oints. It4s not always easy for users to articulatehow they intend to use a system. It4s a fact of life that users often know more than theycan articulate5 The use case hel"s break the ice.

    Interviews with users begin in the terminology of the domain, but should then shift intothe terminology of the users. The initial results of the interviews should reveal actors and

    high3level use cases that describe functional re%uirement in general terms. thisinformation "rovides the boundaries and sco"e of the system.

    Later interviews with users delve into these re%uirement more closely, resulting in usecase models that show the scenarios and se%uences in detail. This might result inadditional use cases that satisfy inclusion and e&tension relationshi"s. In this "hase it isim"ortant to your understanding of the domain, because if you don4t understand it wellyou may create too much use cases and that could im"ede the analysis "rocess.

    Use case are collection of scenarios about system use. ach scenario describes ase%uence of events. ach se%uence is initiated by a "erson, another system, a "iece ofhardware, or by the "assage of time. ntities that initiate se%uences are called actors.

    The result of the se%uence has to be something of use either to the actor who initiated itor to another actor.

    It4s "ossible to reuse use cases. Cne way 3 incluion, is to use the ste"s from one usecase as "art of the se%uence of ste"s in another use case. $nother way 3 etenion, isto create a new use case by adding ste"s to an e&isting use case.

    De&t lessons will guide you through re"resenting a use case model and visuali

  • 8/8/2019 UML Tutorial.doc

    21/99

    /se Case model 

     $n elli"se re"resents a use case, a stick figure re"resents an actor. The initiating actor ison the left of the use case, and the receiving actor is on the right. The actor4s namea""ears Aust below the actor. The name of the use case a""ears either inside the elli"seor Aust below it. $n association line connects an actor to the use case, and re"resentscommunication between the actor and the use case. The association line is solid, likethe line that connects associated classes.

    ach use case is a list of scenarios, and each scenario is a se%uence of ste"s. achscenario of each use case will also have its own "age, listing in te&t from the5

     $ctor who initiates the use case+reconditions for the use case#te"s in the scenario+ostconditions when the scenario is com"lete

     $ctor who benefits from the use case

    Ue cae diagram add more po.er to the reuirement gathering0 The! /iuali5eue cae" the! facilitate communication $et.een anal!t and uer and$et.een anal!t and client0 In a ue cae diagram" !m$ol for the ue cae i anellipe" actor ha a tic7 figure a a !m$ol" and aociation line 6oin an actor toa ue cae0 The ue cae are uuall! inide a rectangle that repreent the!tem $oundar!0

    Relationhip Among Ue CaeIn lesson Use case diagrams, we mentioned that it is "ossible to reuse use casediagrams. Cne way was inclusion, another was e&tension. These are relationshi"samong use cases, and there are two other kinds of relationshi"s5 generali

  • 8/8/2019 UML Tutorial.doc

    22/99

    9enerali5ation/lasses can inherit from one another and so can use cases. In use case inheritance, thechild use case inherits behavior and meaning from the "arent, and adds its ownbehavior. -ou can a""ly the child wherever you a""ly the "arent.

    )enerali

  • 8/8/2019 UML Tutorial.doc

    23/99

    case it4s "referable to "resent a message to the customer that machine is out of brandand allow him or her to make another selection or return money back. If incorrect3ammount3of3money scenario has ha"enned, then self3service machine is su""osed toreturn original ammount of money to the customer.The "recondition here is hungry or thirsty customer, and "ostcondition is either "roductfrom the machine or the returned money.

    This is use case scenario from one user4s view"oint 9the customer:. >ut there are otherusers too. $ su""lier has to restock the machine, and a collector has to collect theaccumulated money from the machine. This tells us to create at least two more usecases5 F*estockF and F/ollect moneyF. Let4s look closely at both of them, by interviewingboth su""liers and collectors.

    The ERetoc7E ue cae

     $ctions that su""lier must do every time interval 9say, one or two weeks: are5 #u""lierunsecures the machine, o"ens the front of the machine, and fills each brand4scom"artment to ca"acity. 9The su""lier may fill each brand according to consuming ofarticle:. Then heG she closes the front of the machine and secures it.The "recondition is the "assage of the interval, and the "ostcondition is that the su""lierhas a new set of "otential sales.This use case diagram is "resented on the following "icture5

    The #estoc%  use case diagram

    The ECollect Mone!E ue cae

    *es"onsible for this use case is collector. /ollector may be the same "erson as thesu""lier. The ste"s that collector must do are same as the ste"s of su""lier, but thecollector don4t deal with "roducts, heG she deals with money. When the time interval has"assed this "erson collects the necessary ammount of money from the machine.The "ostcondition here is the money in hands of the collector./ollect money use case diagram is following5

    The !ollect 'oney  use case diagram

    The ste"s of unsecuring the machine, front o"ening, closing and securing the machineare the same that su""lier and collector must do. This is a good "lace to include a usecase. Let4s combine the FunsecureF and F"ull o"enF ste"s into use case called F&"osethe insideF and the Fclose machineF and FsecureF with use case FUne&"ose the insideF.>y including a use case *estock and /ollect use cases may look as this5

    23

  • 8/8/2019 UML Tutorial.doc

    24/99

    The inclusion process in estoc" and Collect0oney use cases

    The *estock use case could be basis of another use case5 F*estock according to salesF.Bere su""lier may fill u" brands with new "roducts according of sale of that "roducts.This is an e&tension of a use case.

     $fter inclusion and e&tension the *estock use case can be5

    The e%tension process in estoc"use case

     $lso and generali

  • 8/8/2019 UML Tutorial.doc

    25/99

    This is com"lete diagram.

    =uetion > An.er

    If you learned all the lessons included in this day, now is the "erfect time to test andstrengthen your knowledge about class and use case diagrams as a "art of the UML.

    1  8o. do !ou repreent a cla in the UML?  /lick for the

  • 8/8/2019 UML Tutorial.doc

    26/99

    ' Bow do you discover inheritance;

    (What is a difference between an aggregation and a com"osite; )ive an e&am"lefor both of them.

    ) Dame the three levels of visibility and describe what each one means.

    * Is a use case the same as a scenario;

    + #ketch the diagram of a use case model for a E/* remote control. >e sure toinclude all the functions of the remote as use cases for your model. 9'o not usecontrols for changing the chanells:

    ,

    )ive yourself a "ossible interview with a client. Try to e&tract classes, attributesand o"erations from that conversation. $fter that try to relate them and make aclass diagram.

    DAY (

    State Diagram

    #tate 'etails and Transitions

    #tate 'iagram 3 &am"le

    Seuence Diagram

    Ways of /reating #e%uences

    #e%uence 'iagram 3 &am"le

    Colla$oration Diagram

    Writing /ollaboration 'iagrams

    /ollaboration 'iagram 3&am"le

    6uestions $nswers

    Worksho"

    In thi da!" !ou#ll learn a$out:

    State DiagramTransitions between statesSeuence DiagramWays of creating se%uencesColla$oration DiagramWriting collaboration diagrams

    26

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#03http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day5.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day6.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day7.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day8.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day11.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#03http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day5.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day6.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day7.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day8.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day11.html

  • 8/8/2019 UML Tutorial.doc

    27/99

    State Diagram

    In ne&t lessons you4ll work with elements that you haven4t worked before. That would bebehavioral elements, that show how "arts of a UML model change over time. $s thesystem interacts with users and "ossibly with other systems, the obAects that make u"

    the system go through necessary changes to acommodate the interactions. If you4regoing to model systems, you must have a mechanism to model change. Thatmechanism in UML is #tate diagrams.

    3 When you "ull a switch, a light changes its state from off to on. 3 When you make keystroke or mousemovement in screen saver mode on yourcom"uter, your com"uter leaves screen saver mode and returns to working 3 activemode.

    The UML #tate diagram "resents the states an obAect can be in along with the transitionsbetween the states, and shows the starting "oint and end"oint of a se%uence of statechanges.

    A tate diagram ho. the tate of a ingle o$6ect0

    #tates in the state diagram are re"resented with a rounded rectangle, and the symbol for the transition is a solid arrowhead line. $ solid circle stands for starting "oint of ase%uence of states, and bull4s eye re"resents the end"oint.

    The /02 symbols in a state diagram The top area standsfor the state's name, middle area is for state variables, and

    the bottom is for activities Transitions are represented withsolid arrowhead lines, and circles are for starting and ending state

     $lso you can add details to a state icon by dividing it to a three areas. The to" areaholds the name of the state 9this name you must su""ly whatever the class is divided ornot:, the middle area hold state variables 9timers, counters, dates...:, and the bottomarea hold activities 9entry 3what ha""enes when the system enters the state, eit 3whatha""enes when the system leaves the state, do3what ha""enes when the system is inthe state:.

    State Detail and Tranition

    -ou can indicate an event that causes a transition to occur 9a trigger event : and thecom"utation 9the action: that e&ecutes and makes the state change ha""en.

    To add events and actions you write them near the transition line, using a slash tose"arate a triggering event from an action.

    27

  • 8/8/2019 UML Tutorial.doc

    28/99

    #ometimes an event causes a transition without an associated action, and sometimes atransition occurs because a state com"letes an activity 9rather than because of anevent:. This ty"e of transition is caled triggerless transition.

     $lso "ossible is a guard condition. When it4s met, the transition takes "lace. 90ore&am"le screen saving mode is activated when time interval of n idle minutes has"assed:.

    #ome of the states may be more com"le& that is re"resented with a rounded rectangle.It is "ossible to have states inside one state. These states are called substates 9se%uential and concurrent:.

    #e%uential substates come in se%uences of states which occur one after another./oncurrent substates must consist of two or more se%uential substates which occur atthe same time. This is re"resented with dotted line between the concurent states.

    If you have any "roblems understanding these conce"ts "lease refer to the #tate'iagram 3 &am"le lesson.

    The UML su""lies a symbol that shows that a com"osite state remembers its active

    substate when the obAect transitions out of the com"osite state. The symbol isconnected by a solid line to the remembered substate, with an arrowhead that "oints tothe substate.

     $ message that triggers a transition in the receiving obAect4s state diagram is called asignal . In the obAect3oriented world, sending a signal is the same as creating a signalobAect and transmitting it to the receiving obAect. The signal obAect has "ro"erties that arere"resented as attributes. >ecause a signal is an obAect, it4s "ossible to createinheritance hierarchies of signals.

     

    State Diagram ; ample

    #u""ose you4re designing a toaster. -ou would build a "lenty of UML diagrams, but hereonly state diagrams will be of our interest.

    3 What are the ste"s of making a toast;

    0irst of all we must turn on the toaster, "ut in the bread and wait for several minutes tobake it. The initial state diagram is shown below5

    The initial state diagram for ma"ing a toast 

    28

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day3.html

  • 8/8/2019 UML Tutorial.doc

    29/99

    >ut this is not the final state diagram. To "revent burning out the bread, heater of thetoaster must "roduce heat in tem"erature interval 9u""er and lower tem"erature limits:.0or this "ur"ose thermometer measures the tem"erature of heater, and when the u""erlimit of tem"erature is reached then heater must go into idle state. This state resists untilheater4s tem"erature decreases to lower limit, and then working state is again aimed.With this new state, e&tended state diagram will be5

    The e%tended state diagram for ma"ing a toast 

    Transition between working and idle state is not "resented in details. To do thissubstates must be added.

    ubstates in or%ing  and "dle states

    #ubstates in working and idle states are very similar. both had measure and com"arestates, but differentiates in "rocess of tem"erature com"arison. Working state mustcom"are current tem"erature with u""er tem"erature limit 9if it is reached, working stategoes into idle state:, and idle state com"ares current tem"erature with lowertem"erature limit 9idle state is re"laced with working state when tem"erature falls underlower limit:.

    29

  • 8/8/2019 UML Tutorial.doc

    30/99

    It# necear! to ha/e tate diagram $ecaue the! help anal!t" deigner andde/eloper undertand the $eha/ior of the o$6ect in a !tem0 De/eloper" inparticular" ha/e to 7no. ho. o$6ect are uppoed to $eha/e $ecaue the! ha/eto implement thee $eha/ior in oft.are0 It# not enough to implement an o$6ect:De/eloper ha/e to ma7e that o$6ect do omething0

    Seuence Diagram

    In "revious lesson we learned state diagrams, which focus on the states of na obAect.>ut it4s necessary to have communication between obAects. The UML se%uence diagramgoes the ne&t ste" and shows how obAects communicate with one another over time. Inthis e&"anded field of view, you4ll include an im"ortant dimension5 time. The key ideahere is that interactions among obAects take "lace in a s"ecified se%uence, and these%uence takes time to go from beginning to end.

    The se%uence diagram consists of ob*ects re"resented in the usual way 3 as namedrectangles 9with the name underlined:, messages re"resented as solid3line arrows, and

    time re"resented as a vertical "rogression.

    Let4s take a close look at this "arts of se%uence diagrams.

    4$6ect

    The obAects are laid out near the to" of the diagram from left to right. They4re arranged inany order that sim"lifies the diagram. &tending downforward from each obAect is adashed line called the obAect4s lifeline. $long the lifeline is narrow rectangle called anactivation. The activation re"resents an e&ecution of an o"eration the obAect carries out.The length of the rectangle signifies the activation4s duration. This is shown on ne&t"icture.

    epresenting an ob3ect in a se4uence diagram

    Meage

     $ message that goes from one obAect to another goes from one obAect4s lifeline to theother obAect4s lifeline. $n obAect can send a message to itself3that is, from its lifeline backto its own lifeline. This is called recursion. #ee recursion e&am"le.

    0ollowing table lists all of "ossible messages e&isting in the UML se%uence diagrams,with their gra"hical re"resentations5

    simple This is a transfer of control from one obAect to another.

    synchronousIf an obAect sends a synchronous message, it waits for ananswer to that message before it "roceeds with its business.

    30

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day5.html#recurhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day5.html#recur

  • 8/8/2019 UML Tutorial.doc

    31/99

    asynchronousIf an obAect sends an asynchronous message, it doesn4t waitfor an answer before it "roceeds.

    Time

    The diagram re"resents time in the vertical direction. Time starts at the to" and"rogresses toward the bottom. $ message that4s closer to the to" occurs earlier in timethan a message that4s closer to the bottom.

    The essential symbol set of the se4uence diagram, with thesymbols wor"ing together 

    The actor3symbol initiates the se%uence, but the stick figure isn4t "art of the se%uencediagram symbol set.

    In a euence diagram" the o$6ect are laid out from left to right acro the top0ach o$6ect# lifeline i a dahed line etending do.n.ard from the o$6ect0 A olidline .ith an arro.head connect one lifeline to another" and repreent a meagefrom one o$6ect to another0 Time tart at the top an proceed do.n.ard0Although an actor t!picall! initiate the euence" the actor !m$ol in#t part ofthe euence diagram# !m$ol et0

  • 8/8/2019 UML Tutorial.doc

    32/99

    #u""ose one of the obAects in your system is a calculator, and su""ose one of itso"erations com"utes interest. In order to com"ute com"ound interest for a timeframethat encom"asses several com"ouding "eriods, the obAect4s interest3com"utationo"eration has to invoke itself a number of times. #e%uence diagram for this is following5

    epresenting recursion in a se4uence diagram

    Seuence Diagram ; ample

    In this e&am"le, a se%uence diagram for one of the "rivious e&am"les 3 #elf3servicemachine will be given. #ee Use /ase 'iagram 3 &am"le.

    Let4s assume that in the self3service machine, three obAects do the work we4re concernedwith5

    the front the interface the self3service machine "resents to the customer the mone! regiter  "art of the machine where moneys are collectedthe dipener  which delivers the selected "roduct to the customer 

    The instance se4uence diagram may be sketched by using this se%uences5

    1 The customer inserts money in the money slot

    ' The customer makes a selection( The money travels to the register ) The register checks to see whether the selected "roduct is in the dis"enser * The register u"dates its cash reserve+ The register has a dis"enser deliver the "roduct to the front of the machine

    The 5.uy a product5 scenario.ecause this is the best-casescenario, it's an instance se4uencediagram

    >ut, when use case diagrams were develo"ed, two additional scenarios were introducedto re"resent out3of3"roduct case and incorrect3amount3of3money case. If you consider allof a use case4s scenarios when you draw a se%uence diagram, you create a genericse4uence diagram.

    The out3of3"roduct scenario will "roduce this se%uences5

    32

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day12.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day12.html

  • 8/8/2019 UML Tutorial.doc

    33/99

    1  $fter selecting a sold3out brand, the F#CL' CUTF message flashes' +rom"t for another selection must be dis"layed( The customer has the o"tion of "ushing a button that returns money

    )If the customer selects an in3stock brand, everything "roceeds as in the best3case scenario if the in"ut amount is correct. If not, the machine follows theincorrect3amount3of3money scenario

    *If the customer selects another sold3out brand, the "rocess re"eats until thecustomer selects an in3stock brand or "ushes a button that returns his or hermoney

    The 56ut of product5 scenario 

    0a"e attention on 5for"5 of control in the message, caused by if conditions .ecauseeach path goes to the same ob3ect, the for" causes a 5branch5 of control in the receivingob3ect's lifeline, separating the lifeline into separate paths !t some point in these4uence, the branches in the message merge, as do the for"s in the lifeline

    0or the incorrect3amount3of3money scenario, the list of se%uences is given in thefollowing table5

    1 The register checks customer4s in"ut with the "rice of the "roduct

    'If the amount is greater then the "rice, the difference is calculated, and registerchecks its cash reserve

    (If the difference is "resent in the cash reserve, the register returns the change tothe customer and everything "roceeds as before

    )Ctherway, the register returns the in"ut amount and dis"lays a message that"rom"ts the customer for the correct amount

    *If the amount is less than the "rice, the register does nothing and the machinewaits for more money

    33

  • 8/8/2019 UML Tutorial.doc

    34/99

    The 5Incorrectamount of money5scenario

     

    Colla$oration Diagram

    /ollaboration diagrams like the se%uence diagrams, shows how obAects interact. Itshows the obAects along with the messages that travel from one to another. >ut, ifse%uence diagram does that, why UML need another diagram; 'on4t they do the samething;

    The se%uence diagram and the collaboration diagram are similar. They4re semanticallye%uivalent, that is, the "resent the same information, and you can turn a se%uence to acollaboration diagram and vice versa. The main distinction between them is that these%uence diagram is arranged according to time, the collaboration diagram according to

    s"ace.

     $ collaboration diagram is an e&tension of obAect diagram. In addition to the associationsamong obAects, collaboration diagram shows the messages the obAects send each other.

    Messages among obAects are re"resented with arrows that "oints to receiving obAect,near the association line between two obAects. $ label near the arrow shows what themessage is. The message ty"ically tells the receiving obAect to e&ecute one of itso"erations. $ "air of "arentheses ends the message. Inside the "arentheses, you "ut the"arameters the o"earation works on.

    /ollaboration diagrams can be turned into se%uence diagrams and vice versa. Thus, you

    have to be able to re"resent se%uence information in a collaboration diagram. To do thisyou must know that5

    Add a num$er to the la$el of a meage" .ith the num$er correponding to themeage# order in the euence0 A colon eparate the num$er from themeage0

    34

  • 8/8/2019 UML Tutorial.doc

    35/99

    This is the basis of collaboration diagrams. In addition ne&t two lessons will describe the"rocess of writing collaboration diagrams.

  • 8/8/2019 UML Tutorial.doc

    36/99

    In some interactions, a s"ecific obAect controls the flow. This acti/e o$6ect can sendmessages to "assive obAects and interact with other active obAects. $lso you might runinto an obAect sending a message only after several other 9"ossibly nonconsecutive:messages have been sent. That is, the obAect must inchroni5e its message with a setof other messages.

    The collaboration diagram re"resents an active obAect the same way as other, e&ce"tthat its border is thick and bold.#inchroni

  • 8/8/2019 UML Tutorial.doc

    37/99

    When you4re modeling if  statement there are two "ossible conditions. Messages forthese conditions have a same number, and you add a decimal "oint and anothernumber. This is called neting.

    In out3of3"roduct scenario, the machine has to dis"lay an out of "roduct message, and"rom"t the customer for another "roduct or return the money back. If customer makes

    another selection this "rocess must be re"eated. $lso a correct3amount3of3moneyscenario may be introduced. /ollaboration diagram for this case is shown on the "icture5

     $s you can see, from this "icture two "ossible scenarios may ha""en. 6ut-of-product  and Product-in are that two "ossibilities. If we assume that this ha""ened after message78add(input,selection) , the number for this messages will be . , and we add / for the+roduct3in and .  for the out3of3"roduct scenarios, after the decimal "oint.

    What ha""ens when the machine doesn4t have the correct change; The machine has todis"lay an out of change message, return the money, and "rom"t the customer for thecorrect change. In effect, the transaction is over. When the machine has the correctchange, it returns the change to the customer and delivers selected "roduct.Two branches that are "roduced from nesting "rocess are numbered with .0/ and .0. .

     $nd three "osibilities in condition3message ! will be510/2 10. and 101. /ollaborationdiagram is shown on the following "icture5

    Thats all for this e&am"le, and for this day. $ll you have to do now is answering the%uestions given in 6uestions $nswers and Worksho" "art from this day. De&t day willintroduce to you the last three UML diagrams.

    37

  • 8/8/2019 UML Tutorial.doc

    38/99

    =uetion > An.er

    Bere is the list of answered %uestions to see what level of knowledge, you have get thisday.

    1In .hat important .a! doe a tate diagram differ from a cla diagram" ano$6ect diagram or a ue cae diagram?  /lick for the

    'uilding an $ctivity 'iagram

     $ctivity 'iagram 3 &am"le

    More $bout Interfaces and /om"onents

    38

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#04http://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/03day10.html#74501%2374501http://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#04http://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day4.html

  • 8/8/2019 UML Tutorial.doc

    39/99

    Component Diagram

    /om"oment 'iagram 3 &am"le

    Deplo!ment Diagram

    'e"loyment 'iagram 3 &am"le

    3'L 4iagram et of ymbols

    6uestions $nswers

    Worksho"

    In thi da!" !ou#ll learn a$out:

    Acti/it! DiagramBow to create an activity diagramComponent Diagram)rou"ing com"onents of the system and creating com"onent diagramDeplo!ment Diagram+hysical organi

  • 8/8/2019 UML Tutorial.doc

    40/99

    Transition from one activity to another in the !ctivity iagram

    In ne&t lesson will be e&"lained ways of creating an activity diagram, rules betweenactivities, and at the end an e&am"le for this diagram will be given to you.

    The acti/it! diagram i an etenion of the tate diagram0 State diagram highlighttate and repreent acti/itie a arro. $et.een tate0 Acti/it! diagram put thepotlight on the acti/itie0 ach acti/it! i repreented a a rounded rectangle"more o/al in appearance than the tate icon0 The acti/it! diagram ue the ame

    !m$ol a the tate diagram for the tartpoint and the endpoint0

    Building an Acti/it! Diagram

    In this lesson will be e&"lained ways of re"resenting decisions, concurrent "aths, signalsand swimlanes in the activity diagrams.

    Deciion

    'ecision "oint can be re"resented in two ways, it4s all to you to make decision what wayto use in your activity diagrams.

    Cne way is to show the "ossible "aths coming directly out of an activity. the other is tohave the activity transition to a small diamond and have the "ossible "aths flow out ofthe diamond. ither way, you indicate the condition with a bracketed condition statementnear the a""ro"riate "ath.

    Imagine that you have to go to the work. -ou get your car, "ut the key in the ignition, andthere are two "ossible situations5 your car will start or it will not start it4s engine. These"ossible cases will "roduce two other activities5 drive a car, or go by a bus, ta&i, bike orgo walking. This scenario is shown on this "icture 9make attention of two ways showinga decision:5

    40

  • 8/8/2019 UML Tutorial.doc

    41/99

     !ctivity diagram showing two ways of decision

    Concurrent path

    When you modeling activities, very fre%uently you4ll have a occasion to se"arate atransition into two se"arate "aths that run at the same time 9concurrently:, and the cometogether.

    #"lit is re"resented by a solid bold line "er"endicular to the transition and show the"aths coming out of the line. To re"resent the merge, show the "aths "ointing at anothersolid bold line.

     !ctivity diagram representing a transition split into two paths that run concurrently and then come together 

    Signal

    'uring a se%uence of activities, it4s "ossible to send a signal. When received, the signalcauses an activity to take a "lace.

    The symbol for sending a symbol is a conve& "entagon, and the symbol for receiving asignal is a concave "olygon.

    ending and receiving a signal 

    41

  • 8/8/2019 UML Tutorial.doc

    42/99

    S.imlane

    The activity diagram adds the dimension of vi

  • 8/8/2019 UML Tutorial.doc

    43/99

    More A$out Interface and Component

    In "revious lessons, you learned about diagrams that deal with conce"tual entities. Inne&t lessons, you4re going to learn about a UML diagram that re"resent a real3worldentity5 software component .

    >ut what is a software com"onent; $ software com"onent is a "hysical "art of a system. It resides in a com"uter, not in themind of an analyst.

    What4s the relationshi" between a com"onent and a class;Thin7 of a component a the oft.are implementation of a cla0 The clarepreent an a$traction of a et of attri$ute and operation0 And onecomponent can $e implementation of more than one cla0

    -ou model com"onents and their relationshi"s so that5

    1 /lients can see the structure in the finished system

    ' 'evelo"ers have a structure to work toward( Technical writers who have to "rovide documentation and hel" files can understand

    what they4re writing about

    ) -ou4re ready for reuse

    When you deal with com"onents, you have to deal with their interfaces. Interface is theobAect4s FfaceF to the outside world, so that other obAects can ask the obAect to e&ecute itso"erations, which are hiden with enca"sulation.

     $n interface is a set of o"erations that s"ecifies something about a class4s behavior. It isa set of o"erations the a class re"resent to other classes. 0or you as a modeler, this

    means that the way you re"resent an interface for a class is the same as the way youre"resent an interface for a com"onent. $s is the case with a class and its interface, therelation between a com"onent and its interface is called reali

  • 8/8/2019 UML Tutorial.doc

    44/99

    and it interface i called reali5ation0

  • 8/8/2019 UML Tutorial.doc

    45/99

     $s you can see this UML Music +layer needs these controls5

    "laysto"eAect"ausefast forwardrewind"ower 

    These controls will be realiutton, but actions they "erform are diferent. We must obtain these actions by"rogramming them.

    Deplo!ment Diagram

    We reached the end of the UML diagrams. Dow it4s "erfect time to look at the hardware. $s you can see, we moved from items that live in analysis, to com"onents that live incom"uters, to hardware that lives in the real world.

    Bardware, of course, is a "rime to"ic in a multicom"onent system. $ solid blue"rint forhardware de"loyment is essential to system design. The UML "rovides you with symbolsfor creating a clear "icture of how the final hardware setu" should look.

    45

  • 8/8/2019 UML Tutorial.doc

    46/99

    The main hardware item is a node, a generic name for any kind of com"uting resource.Two ty"es of nodes are "ossible. $ processor  is a node that can e&ecute a com"onent,and a device that can4t e&ecute a com"onent. $ device ty"ically interfaces in some waywith the outside world.

    In the UML a cube re"resent a node. Dode has its name, and you can use a stereoty"e

    to indicate the ty"e of resource it is. If a node is a "art of "ackage, then and the name of"ackage "receeds the name of the node. $ line Aoining the two cubes re"resents aconnection between two nodes. -ou can use a stereoty"e to "rovide information aboutthe connection.

    The cube is representation of a node in the /02

     $lso every node de"loyes some of software com"onents in the system. To indicatede"loyed com"onents, you show them in de"endency relationshi"s with a node.

    Let4s build a de"loyment diagram for a home com"uter system. /om"uter consists ofthese hardware elements5 /+U, monitor, "rinter, mouse, keyboard. $nd installedsoftware com"onents5 Windows@, Cffice@, Internet&"lorer, 0ront+age, 'C#,Dorton/ommander, Turbo+ascal.

    The main node is CP/ whichconsists of all the softwarecomponents with theirrelationships 6ther hardwareelements are devices connected tothe main processor unit

    -ou may e&tend this diagram by adding a modem and connection to the Internet. Try toredraw the diagram with this e&tension.

    The UML deplo!ment diagram pro/ide a picture of ho. the ph!ical !tem .illloo7 .hen it# all put together0 A !tem conit of node %repreented $! acu$e& .ith line connecting them" called connection0 There are t.o t!pe of

    46

  • 8/8/2019 UML Tutorial.doc

    47/99

    node: a proceor %can eecute a component& and a de/ice %interface .ith thereal .orld&0 Deplo!ment diagram are ueful for modeling net.or70

    Deplo!ment Diagram ; ample

    This e&am"le will describe you the thin thernet network. If you4re familiar with com"uter networks this one will be easy to you, but if not then try to understand the followinge&"lanation5

    The thin ethernet is a "o"ular ty"e of network. It is used in local "laces eg.rooms orbuildings, where connecting cable can be "laced. There are some mathematicscalculations for the length of the cable of all the network, and length of cable fromcom"uter to com"uter. These calculation for the de"loyment diagram are not im"ortant.

    /om"uters connect to a network cable via connection devicescalled T3connectors, or sometimes vam"ire3ta"s are used. T3connector has three connecting "oints. Its form is similar with

    T3letter and thats why their name cames from. Detwork cablegoes from one end3"oint to the other end3"oint of theconnector, and the third end3"oint has a cable going to thecom"uter.

    >ecause length of the network is limited, ending "oints of the cable must have a devicescalled terminators, which gave infinite resistance to the end of cable. $lso one networksegment may Aoin another via a re"eater. The re"eater is a device which am"lifies thesignal to reduce losing of signal. The thin thernet is re"resented on the following"icture5

    When we get familiar with the thin thernet network conce"t let4s draw the de"loymentdiagram for it. This diagram wil look like5

    47

  • 8/8/2019 UML Tutorial.doc

    48/99

    eployment iagram for >thernet networ" 

    With this e&am"le all of the UML diagrams are shown to you. In this day, only that youhave to do, are the e&ercises. >ut before make some e&ercises, $ global "icture with allof the UML symbols is given to you. #ee it.

    UML Diagram Set of S!m$ol

    This is the com"lete set of symbols that UML introduces in its diagrams.

    tructural 6lements

    &ehavioral 6lements

    48

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/04day9.html

  • 8/8/2019 UML Tutorial.doc

    49/99

    #elationships

    7rouping 

    6tension

     Annotation 8 Actors

    =uetion > An.erIn this day you4ve finished the set of UML diagrams. Test your knowledge about activitydiagrams, com"onent and de"loyment diagrams.

    1

  • 8/8/2019 UML Tutorial.doc

    50/99

    1 With everything that a state diagram shows, do we really need activity diagrams;

    ' What is a swimlane; )ive an e&am"le.

    ( What is an e&"ort interface; What is an im"ort interface;

    ) Dame the ways when you can re"lace and when you can reuse a com"onent.Why is im"ortant to have a reusable com"onents;

    * Bow do you re"resent a node in the de"loyment diagram; What kind ofinformation can a""ear on a node;

    +'raw activity diagram for connecting u" a com"uter to the Internet. $fter thatdraw a de"loyment diagram for a home com"uter system connected with theInternet.

    DAY *

    $he 4igital Library 6ample

    Dico/ering Buine 2rocee/

    Dico/ering Buine 2rocee. 

    Domain Anal!i

    0orming $ssociations

    0illing Cut the /lasses

    'evelo"ing the Eision

    HAD Seion

    6uestions $nswersWorksho"

    In thi da!" !ou#ll learn a$out:

    Modeling of Digital Li$rar!'iscovering >usiness +rocesses'omain $nalysis?$' #ession

    The Digital Li$rar! ; ample

    We finished UML diagram4s theory. Dow is a "erfect time to dive into "ractice. This andne&t day are concerned with 'igital Libraries. If you4re not introduced with them, don4tworry. Things will be much clearer after these two days.

    50

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#05http://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day5.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day6.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day7.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day8.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day10.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/cont.htm#05http://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day1.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day2.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day4.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day5.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day6.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day7.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day8.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day9.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day10.html

  • 8/8/2019 UML Tutorial.doc

    51/99

    >ack in time we remember the clasical library structure in which there is a librarian with agreat deal of "a"erwork, the user must be "hysically there to get the book and knowwhich book is of hisGhers interest. If heGshe doesnt know the desired book, than is in thehands of librarian to recommend some book for himGher.

    The new wave in this direction, based on the software develo"ment and Internet is

    headed into new library entity3 the 4igital Library . This kind of library is world3wideaccessed, with a %uick review "ossibilities, digital books and a lot of multimedia files.They can recommend you a book or a Aournal, give a statistical as"ect of the recentbooks and a lot of features that are making the life easier N all of that with the comfort oflying in the sofa with remote keyboard in your hands. *emote reservation is evenmaking "ossible of getting a hard co"y of a book or Aournal using a efficient "ostalsystem connected with the library.

    'ay 1 and 'ay 2 will guide you trough the "rocess of analy

  • 8/8/2019 UML Tutorial.doc

    52/99

     A Where is your database located on;

    !  Cur database is located on a com"uter server. This server is a heart of our local areanetwork 3 all of the terminals located in our library.

     A Let4s backtrack to the data. -ou said that same data is stored in the electronic formatand in the "a"er format. De&t in our conversation we can refer to these with samename, let4s say inde&.

    !  I agree.

     A When we talk about inde&, what kind of information is necessary to "erform a search;

    !  'ata for the books and for the Aournals is very similar. >oth have I#>D3the uni%uenumber for every bookGAournal, title, "ublishing year, "ublishing house, but bookshave author and genre, and Aournals have volume and area. 0or the data search areusefull I#>Ds, titles, authors, genres, volumes and areas. *etreived results s"ecifiesthe ty"e of the books or Aournals.

     A ?ust a second. What are the kinds of books and Aournals;

    !  &ce"t "a"er books and Aournals, electronic books and Aournals are su""erted in ourlibrary.

     A lectronic books and Aournals. Bow do you manage these ty"es of items 9books G

     Aournals:;!  The server we had is used for storage of these ty"es of items. We "roduced some of

    the electronic items, but also in our database we have Internet addresses fromelectronic books or Aournals from other libraries we used to coo"erate.

     A -ou have a lot of ammount of data. Is everyone concerned with data in"ut and datamaintenance;

    !  We have em"loyees to do this.

     A -ou said em"loyees. I think that they are not "arts from this conversation for now. Wewill talk about them later. The customers are not finished yet. >efore going to the"rocess of lending let4s assume what we have at this "oint of interview, things comeclearer to me now. very customer can "erform a data search for the books or

     Aournals. lectronic formats of books retrived from the search, can be accessedimidiately. +a"er formats can be lended if there is a free sam"le.Dow you may go to the "rocess of lending.

    !  $t the begining, I4ve stress out that user who is in the library after data search can"erform a lending. Lending can be done if books or Aournals are in "a"er format, andit4s done in the lending area in the library. #earched books or Aournals can be given tothe user if free sam"les of them are in the library.

     A Let4s look at the both cases 3 "resent and not "resent sam"le of the bookGAournal.What is the flow of events;

    !  When sam"le is not "resent, the user can make a reservation for it. $fter that librarymust inform the user for a free sam"le, when one is set free. User, than should go thethe library and make a lending for that sam"le. I must say that free sam"le is ke"t for

    the user few weeks after informing it. A What if there is a free sam"le;

    !  In that case emloyee who is concerned with lending 9let4s say 3 lender:, must checkthe users data to see if user is a library member or not. If the user is a librarymember, he or she takes the I#>D of lended books or Aournals and "ersonal data forthe user, and writes them in the lending record. $lso a date is writen in this record,which is stored in the lending database. very user has a limit of booksGAournals tolend, and also there is a limit for time kee"ing of booksGAournals.

    52

  • 8/8/2019 UML Tutorial.doc

    53/99

     A 'o you allow em"loyees to lend books or Aournals;

    !  -es we do. very em"loyee in our library has the same record as members. That wehave lending records for em"loyees too.

     A -ou said that lending records are stored in a lending database. Is this a work ofFlenderF or someone else do this;

    !  Cur local network doesn4t consists only from searh terminals. $ FlenderF also has aterminal from which he or she can check for user data and free sam"les. $lso a %uickre"orts can be done to see which users have books to return.

     A Wait a minute. Cur conversation gone in other direction. We started to talk aboutem"loyee4s duties, we didn4t finished with the customers. Let4s see to made a lendinga free sam"le of the book or Aournal can be "resent in the library, and a lendingrecord is "roduced after it.

    !  That4s it. I4ll stress again that only "a"er formats can be lended, because they have asam"les. lectonic formats of books and Aournal doesn4t have a sam"les. In otherwords they have infinite number of sam"les, or they are "resent in the libraryeverytime.

     A Is it "ossible to have no "resent sam"les of books or Aournals from searched user4s

    list; /an users ask a lender to recommend them a book or Aournal;!  /ertainly lender can take a brief look at the user4s history of lended books and

     Aournals, and if he or she had read a books or Aournals from the user4s interest areas,then he or she can recommend something to the user. User can acce"t that or not.

     A This will be all for now. I think that user4s diagram is done, and we can take a look atit5

    53

  • 8/8/2019 UML Tutorial.doc

    54/99

    0ember !ctivitydiagramcorresponding 

    to the previousinterview 

    Dico/ering Buine 2rocee

  • 8/8/2019 UML Tutorial.doc

    55/99

    This lesson is e&tension of "revious one. Dow we4ll give you the interview with the client3 e&"lanation of work of the em"loyees in the library. Let4s see at all given details andanalyooks and Aournals have a "lenty of attributes in common. That are I#>D, title, yearof "ublishing and "ublishing house. $lso every item has a number of sam"les.#ometimes a multimedia data are su""orted with the item. If that is a "ro"agandamaterial in "a"er form we convert it into electric form and "ut it into the database.

     A 'o you su""ort multimedia data only for electronic items, or "a"er items hasmultimedia too;

    !  The form of the bookGAournal is not im"ortant. >oth for "a"er and electronic formatswe su""ort multimedia data. +o"ular books in the world, can be more "o"ular if amultimedia is su""orted for them. very user is curious to meet with these ty"es ofinformation.

     A If I "erform a data search, can I browse the multimedia data su""orted for the item; $nd what kind of multimedia is su""orted;

    !  It4s true. 'uring com"uter4s searching in returned results if an item has a multimediadata, user can browse that data. Ty"es of multimedia which are su""orted are Te&t,

     $udio, Eideo and +icture.

     A Bow do you enters a data for the book4s author;

    !  I4m sorry. I forgot to tell you that authors are entered se"arately. 0or the authors nameand last name, year and "lace of birth are in"uted. 'uring the "rocess of book4s in"utif the book4s author is in the entered list of authors, then he or she is chosen from thatlist. Ctherway we used an author creation "rocess. $lso for books their genre is

    55

  • 8/8/2019 UML Tutorial.doc

    56/99

    in"uted.

     A What about a Aournals;

    !  0or the Aournals volume and area are entered.

     A -ou said that a "arallel evidence is made 9"a"er and electronic:. Bow do youre"resent multimedia data in your "a"er cards;

    !  Multimedia data is entered only in electronic format. I said that "a"er cards are"rinted from electonic records, but only necessary information for cards is "rinted.

     A We e&amined a work of lenders, em"loyees who enters a data for authors, books, Aournals and members. >ut I don4t see here a sam"le in"ut. In lending "rocess yousaid that free sam"les can be lended. Bow do you "erform sam"le in"ut;

    !  I notioned when we talk about book entering, that "rocess of book4s in"ut alsoconsists of in"uting a number of new sam"les. >ut it is "ossible new sam"les toarrive in library, and a record for the book to e&ist in database. In that case onlysam"le data is entered. This data consists of sam"le4s signature, which only concernsthe lenders 9information about stored "lace of sam"le in the storage room:.

     A 'o you think that we have finished the em"loyee4s analysis;

    !  #ure. We reached the end. I ho"e that all my s"elling out all the ste"s in library work,

    makes clearer view to you about libraries like ours.

    56

  • 8/8/2019 UML Tutorial.doc

    57/99

     

    The 2ender's !ctivitydiagram gained from

     previous interview 

    57

  • 8/8/2019 UML Tutorial.doc

    58/99

    The ata >ntry Cler"'s !ctivity diagram e%tracted from the interview 

    Domain Anal!i

    >efore haveing additional interviews, the develo"ment team first must work within theconte&t of the business3"rocess interview. This is the Aob of an ob*ect modeler . TheobAective is to "roduce initial class diagram.

    The obAect modeler looks for nouns, verbs and verb "hrases. #ome of the nouns willbecome classes in the model, some will become attributes. The verb and verb "hrasescan become o"erations or the labels of associations.

    Let4s "ut ourselves in the role of the modeler and start develo"ing the class diagram.0rom the client4s interview we can filtered out these nouns5

    58

  • 8/8/2019 UML Tutorial.doc

    59/99

    Move your mouse over the word list and you4ll see what nouns from the list can be eliminated as an attributes, synonyms withother nouns, and nouns that re"resent classes out of the domain4s sco"e.

     $nd these verbs5

    go" earch" lend" ta7e" ort" print" put" do" ha" ha/e" con/ert" .rite" manage"acce" read" pre/ie." ta7e a ample" reer/e" gi/e" inform" ma7e" et free" chec7

    the data" recommend" pot" $u!" operate" maintain" conclude" $ro.e" input

    Dow we4ll try to form some meaningful grou"s of nouns.Cne grou" consists of people5 member, author, em"loyee, lender, 'atabase#"ecialist,'atantry clerk. This grou" could stand some subdivision because everyone e&ce"t themember and author are em"loyees.

     $nother grou" consists of library9s items like books, Aournals, sam"les, reservation,lending.Third grou" consists of areas within the library 5 corridor, lending area, rece"tion "lace.

    In forth grou" may be these nouns5 member4s card, data record, "a"er card, multimediadata, lending record.

    59

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/05day4.html#klikni1%23klikni1

  • 8/8/2019 UML Tutorial.doc

    60/99

     !bstract classes partition the classdiagram into meaningful groups

    This is the initial class diagram, ne&t we4ll discover associations between classes and"roduce more descri"tive class diagram tha this one.

    3orming Aociation

    Dow we4ll create and label associations between some of the classes. The verbs andverb "hrases can hel" us with the labeling, but we won4t limit ourselves to the ones fromthe interview.

    Labels that are somewhat more descri"tive might suggest themselves.

    Let4s start with the member first. Let4s label the associations by generating "hrases thatcharacteri

  • 8/8/2019 UML Tutorial.doc

    61/99

    The member class with includedmultiplicities in the associations

    The associations for the item4s 9here item is standing for both book and Aournal: classmight be the "hrases from the following list5

    The item can be recommended to the member.The item is reserved by a member.The item 9electronic: is "rintet by a member.The items are sorted al"habeticaly in "a"er cards and data records.The item has sam"le9s:.The item has multimedia data.

     $fter filling out associations names and multi"licities, the item4s class will be5

    61

  • 8/8/2019 UML Tutorial.doc

    62/99

     !ssociations with the items (boo"s and 3ournals)

    Interesting, also is the "rocess of forming associations and multi"licities for theem"lyee4s class. >ear in mind that em"loyees are also a members of the library, thus allthe member4s class associations can be "utted into the em"lyee4s class, but some of theem"loyees "erform some actions that members are not allowed5

    The lender "roduces a lending record.The lender lends an item to the member.The 'atantry clerk enters data for the books.The 'atantry clerk enters data for the Aournals.

    The 'atantry clerk enters data for the authors.The 'atantry clerk enters data for the members.The 'atantry clerk enters data for the sam"les.

     $fter filling out associations names and multi"licities, the lender4s and 'atantry clerk4sclasses will be5

     !ssociations with the lender 

    62

  • 8/8/2019 UML Tutorial.doc

    63/99

     !ssociations with the ata>ntry cler" 

    Try drawing out the associations with the $uthor4s class and #am"le4s class. This will bealso an e&ercise for you given in the worksho" for this day.

    We4ve been forming and naming abstract classes and associations, and anotherorganiook, ?ournal, and #am"le.

    The Mem$er 

    In nouns list some of the nouns are a""ro"riate to be used as member4s attributes. $ndfrom vers list we can chose some of the "ossible o"erations for the member. These two

    lists are given in the following table5

    Lit of attri$ute Lit of operationname

    new0ember()lastnameaddress

    search()date of birdth

     place of living lend()

    Personalegistration?umber 

    63

    http://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day5.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day3.htmlhttp://odl-skopje.etf.ukim.edu.mk/uml-help/html/02day5.html

  • 8/8/2019 UML Tutorial.doc

    64/99

    telephonereserve()e-mail 

    memberI

    The member class now will look as5

    The 0ember class

    The Author 

    Lists of attributes and o"erations for the author will be5

    Lit of attri$ute Lit of operationname create!uthor()

    lastnameboo"eference()

    date of birdth

    The !uthor class

    The mplo!ee

    Lender and the 'atantry clerk are childern of the abstract class m"loyee. 0irst we4llassign attributes to the m"loyee class and the children classes will inherits them. $lsowe must bear in mind that every em"loyee has a member record. This will guide us that

    in the m"loyee class list of member4s attributes may a""ear, "lus an attribute to differsem"loyees from members. $lso 'atantry clerk class will have new attribute whichdetermines the ty"e of data entry "erforming that clerk. List of attributes and o"erations9for Lender and 'atantry clerk: are given in fillowing table5

    Lit of attri$ute for themplo!ee cla

    Lit of operation for theLender cla

    Lit of operation for theDatantr!Cler7 cla

    64

  • 8/8/2019 UML Tutorial.doc

    65/99

    namema"e2ending()

    new0ember()

    lastnameaddress

    new.oo"()date of birdth

    return2ending() place of living 

    new&ournal()Personalegistration?umber telephone

    sendeport()newample()

    e-mail memberI

    new0ultimedia()employee

    The structure of the m"loyee class with its subclasses is given on the following "icture5

    The >mployee class and its children

    Try finding out an attributes and o"erations for the >ook class. This class will be verysimmilar with ne&t 3 the ?ournal class.

    The Hournal

    List of attributes and o"erations for the ?ournal class are following5

    Lit of attri$ute Lit of operationtitle

    freeamples()volume

    areanew&ournal()

     publishing year  publishing house

    ma"e2ending()I.? status

    ma"eeservation()number6famples

    65

  • 8/8/2019 UML Tutorial.doc

    66/99

    The FstatusF attribute indicates the ty"e of the Aournal5 electronic or "a"er. The ?ournalclass will be5

    The &ournal class

    The Sample

    The lending "rocess may "roduce lended book or Aournal only if a free sam"le of thatbook or Aournal is "resent in the library. 0or that "ur"ose a #am"le class must be"resent. The sam"le class will have only two attributes 9in this moment: 3 signature andstatus 9lended or free:, and one o"eration newample(). The #am"le class is "resent onne&t "icture5

    The ample class

  • 8/8/2019 UML Tutorial.doc

    67/99

    co"ies of the business "rocess diagrams develo"ed in "revious lessons.#ee 'iscovering business "rocesses (, and 'iscovering business "rocesses .

    This conversation is about information movement. #ome of the "rocesses in the librarybusiness de"ends on the movement of the information. If we can s"eed that movementalong 3 something technology is really good at 3 we4ll meet our goal. 0rom this

    conversation was concluded that information movement takes "lace when5

    The member lends a book4s sam"leThe member lends a Aournal4s sam"leThe lender recommends a book to the member The lender recommends a Aournal to the member The member contracts the membershi" with the 'atantry clerk

    De&t will be given a "art from this conversation. Bere modeler has some interestingideas about adding new attributes in the class diagram. Let4s see what is ha""ening5

    Anal!t Let4s go to the "rocess of lending. It was mentioned that members has timelimit and co"ies limit for a lending. Bow the lender knows how many books or

     Aournals to give to the member;Lender  0irst of all I take a look at member4s lending record, and count how many

    items he or she has lended. $lso I check the lending date to see if there is abooks or Aournals with overloaded time limit.

    Modeler  I4ve been working on my class diagrams while I4ve been listening to all of you. $nd I have some %uestions to ask. In the Member class, we may add newattributes like timeLimit and co"iesLimit which are common for every member.

     $lso an attribute that holds the number of lended sam"les 3 sam"lesLendedmay be introduced, and a derived attribute 3 numberToLend, which is thedifference between co"iesLimit and sam"lesLended.

    Lender  That4s a nice idea. Then I4d know the