class diagram singi

18
® IBM Software Group © 2007 IBM Corporation DEV396: Essentials of IBM Rational Software Architect, V7 Vežba 10: Class Diagram

Upload: dulle-tips

Post on 06-Apr-2016

8 views

Category:

Documents


1 download

DESCRIPTION

Class diagrams

TRANSCRIPT

Page 1: Class Diagram SINGI

®

IBM Software Group

© 2007 IBM Corporation

DEV396: Essentials of IBM Rational Software Architect, V7

Vežba 10: Class Diagram

Page 2: Class Diagram SINGI

2

Class DiagramsKlasni dijagrami prikazuju klase sistema, njihove međusobne veze, kao i operacije i atribute svake klase.

Presenter
Presentation Notes
A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. A class is an abstraction in that it: Emphasizes relevant characteristics. Suppresses other characteristics
Page 3: Class Diagram SINGI

3

Class Icon

Template Class ParameterClass Name

Private: -PrivatePublic: +PublicProtected: #ProtectedPackage: ~PackageAttribute

Presenter
Presentation Notes
The class Icon provides compartments for name, attributes, and operations. These compartments can be removed from a diagram if desired. A number of standard stereotyped classes are available in Rational Software Architect: Type: A class that specifies a domain of objects ImplementationClass: The implementation of a class in a programming language Utility: A class that has no instances, but rather a collection of non-member attributes and operations that are class scoped Metaclass: A class whose instances are also classes Realization: A classifier that specifies a domain of objects, and its physical implementation Specification: A classifier that specifies a domain of objects, without defining a physical implementation Focus: A class that specifies the core logic or control flow for one or more auxiliary classes Auxiliary: A class that supports a central or fundamental class
Page 4: Class Diagram SINGI

4

Class Relationships

Dijagrami klasa mogu sadržati sledeće veze:

Asocijacija

Agregacija

Kompozicija

Generalizacija

Zavisnost

Realizacija

ILI

ILI

ILI

Presenter
Presentation Notes
In Unified Modeling Language (UML) class diagrams, a relationship is the connection between classes.
Page 5: Class Diagram SINGI

5

AsocijacijaAsocijacija je strukturna veza kojom se određuje da je objekat jedne klase povezan sa objektom druge ili iste klase.Asocijacija može biti dvosmerna or jednosmerna.

OR

Presenter
Presentation Notes
Association relationships imply that instances of one class connect to instances of another class. Association is a relationship that is realized as a property of the class.
Page 6: Class Diagram SINGI

6

Asocijacija - PridruživanjeOna kaže da jedan objekt ima za atribut primerak drugog ili su ti objekti povezani u smislu posedovanja (ali ne i odnosa sastojati se od).Npr. prodavac je vezan pridruživanjem sa svojim kupcima, ali prodavac se ne sastoji od kupaca.

Page 7: Class Diagram SINGI

7

Mnogostrukost

Mnogostrukost asocijacije određuje broj primeraka jedne klase u odnosu na drugu klasu

Page 8: Class Diagram SINGI

8

AgregacijaJači oblik asocijacije, koja označava povezanost celine sa nekim njenim delom

Povezuje deo sa celinom tako da se deo može izostaviti iz celinepokazuje da klasa sadrži drugeklase tj. da je deo druge klase

OR

Presenter
Presentation Notes
Aggregation is used to gain understanding of and insight into what makes up a class. The parts have their own data and behavior, but are still part of the whole. This is known in the modeling world as a “has a” relationship (For example,the beacon has a carrier).
Page 9: Class Diagram SINGI

9

Agregacija, gomilanjeNpr. putovanje vozom se sastoji od niza putovanja između stanica.Prodavnica agregira više odeljenja, tj. prodavnica se sastoji od odeljenja.

Page 10: Class Diagram SINGI

10

KompozicijaAgregacija sa jakom vezom

povezuje deo sa celinom tako da se deo ne može izostaviti iz celine

OR

Presenter
Presentation Notes
Composition is a further refinement of aggregation in that they have coincident life spans. Create the whole and the parts are created as well. Destroy the whole and the parts are destroyed. In straight aggregation, on the other hand, the parts do not have to have coincident life spans.
Page 11: Class Diagram SINGI

11

GeneralizacijaVeza između nadklase i njenih podklasa. Opisuje hijerarhijski odnos među klasama.Klase mogu naslediti atribute i ponašanje od nadklasa koje mogu biti podklase drugih klasa.

Page 12: Class Diagram SINGI

12

ZavisnostRelacija gde jedna klasa zavisi od druge.

Presenter
Presentation Notes
Following is a list of UML dependency stereotype relationships: Binding: Used with template elements to identify that the contents of the template would be copied into the target element Usage: A usage relationship in which one element requires another element for its implementation or operation Abstraction: An abstraction relationship relates two elements that represent the same concept at two different levels of abstraction Derive: Specifies a derivation relationship among model elements that are usually, but not necessarily, of the same type Refine: Specifies a refinement relationship between the two elements or sets of elements. Used in the transformations from analysis to design and other such changes Trace: Specifies a trace relationship between model elements or sets of model elements that represent the same concept in different models Instantiate: A usage dependency among classifiers indicating that operations on the client create instances of the supplier Package Import: A directed relationship that identifies a package whose members are to be imported into by a namespace Element Import: A directed relationship that identifies an element to be imported into by a namespace
Page 13: Class Diagram SINGI

13

Realizacija

realizacija je slična nasleđivanju samo što se kod realizacije nasleđuju samo operacije sa parametrima, a bez implementacije

Page 14: Class Diagram SINGI

14

KLASE – ŠTA RADE I KAKO IH NAĆIU vašem razgovoru sa klijentima, obratite pažnju na imenice koje koriste da bi opisali entitete u svom poslu. Te imenice će biti klase u vašem modelu.Takođe obratite pažnju na glagole koje čujete jer će oni stvarati metode unutar klasa. Atributi će izaći kao imenice koje su u vezi sa imenicama koje određuju klasu.

Page 15: Class Diagram SINGI

15

Pretpostavimo da ste vi analitičar koji gradi model za košarku, i intervjuišete trenera u cilju da shvatite igru.

Analitičar: “Treneru, u čemu je cilj košarke?”Trener: “Cilj igre je da ubacite loptu u koš i da postignete više bodova od vašeg protivnika. Svaki tim se sastoji od 5 igrača: dva odbrambena, dva napadača i centar. Svaki tim krene u napad sa krajnjim ciljem da pogodi koš.”Analitičar: “Kako oni vode napad?”Trener: “Driblanjem i dodavanjem. Tim mora pucati pre nego što istekne vreme za napad.”Analitičar: “Vreme za napad?”Trener: “Da. To je 24 sekunde. Nakon toga druga ekipa dobija loptu.”

Page 16: Class Diagram SINGI

16

Analitičar: “Kako se broje bodovi?”Trener: “Svaki koš se broji kao dva boda, osim ako nije gađano sa linije za tri boda. U tom slučaju, koš se broji kao tri boda. Slobodno bacanje se broji kao jedan bod. Usput, slobodno bacanje je kazna za tim koji je načinio prekršaj. Ako igrač “faulira” protivnika, igra se zaustavlja i protivnik ima pravo na slobodna bacanja.”Analitičar: “Recite mi malo više što svaki igrač radi.”Trener: “Odrambeni uglavnom izvode većinu driblanja i dodavanja. Najčešće su niži od napadača, a napadači niži od centra. Svi igrači moraju biti sposobni driblati, dodavati, pucati i braniti. Napadači većinu puta pucaju, dok centar stoji blizu koša i puca iz veće blizine. ”Analitičar: “Kakve su dimenzije terena? Koliko dugo traje igra?”Trener: “U internacionalnim utakmicama teren je dug 28 i 15 metara širok. Koš je 3,4 m iznad poda. U Americi igra traje 48 minuta i podeljena je na četvrtine po 12 minuta.U univerzitetskoj i internacionalnoj košarci igra traje 40 minuta podeljena na dva dela po 20 minuta. Sat pokazuje koliko je vremena ostalo.”...

Page 17: Class Diagram SINGI

17

Ovo bi moglo trajati i trajati, ali urađićemo presek da vidimo što smo saznali.

Evo imenica koje smo saznali:lopta, koš, tim, igrači, odbrana, napadači, centar, trojka, slobodno bacanje, faul, linija slobodnog bacanja, teren.

Evo i glagola:pucanje, vođenje napada, driblanje, dodavanje, fauliranje.

Imamo i neke dodatne informacije o nekim imenicama relativna visina igrača na svakoj poziciji, dimenzije terena, koliko traje napad, trajanje utakmice.

Naravno i mi sami bi se mogli setiti nekih atributa:Npr. lopta ima svoj volumen, promer.

Page 18: Class Diagram SINGI

18