0% found this document useful (0 votes)
38 views59 pages

Oomd

Uploaded by

Ananya Shetty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
38 views59 pages

Oomd

Uploaded by

Ananya Shetty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 59
INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING UNIT Syllabus: a Chapter 2: Introduction What is object oriestation? ‘What is OO development? 0 themes. Evidence for usefulnéss of OO development. (00 modeling history. ‘Chapter Ib: Modeling As Design Technique on + Modeling, * Absaction & + The three models. Chapter Ic: Class Modelling Objects and class concepts Link and association concepts. Generalization and inheritance. ‘Assample class model. Navigation of class models. Practical Sips. m7 hours ins wien onder “note” can be dipped] ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY 45,5 Venkoteshwara Xerox Center” Contect: Venkatesh Mob: 9448926729 Scanned with CamScanner UNIT: INTRODUCTION, MODELLING CONCEPTS, CLASS . Syllabus: = Chapter Ia: Introduction What is object oriftation? What is OO development? 00 themes. ; Evidence for usefulness of OO development. 00 modeling history. Copter tb: dein As Dsen Techie ws: Fong Moswacton. e Tretiree model Chapter 1c Class Modeling ‘Objects and class concepts. Link and association concepts. Generalization and inhesitance. Assample class model Navigation of class models. Practical ips = Thours [ins wait onder "wane can Be ped} ASHOK KUMAR K_ \VIVEKANANDA INSTITUTE OF TECHNOLOGY 515 Vonkateshwora Xerox Center” Contact: Venkatesh Mob: 9448926729 Scanned with CamScanner pennant ta SEES Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING CHAPTER 1A: INTRODUCTION Note I: 5 Intention of this subject (object oriented modeling and design) isto learn how to apply object - oriented concepts to all the stages of the software development life cycle. =~ Note 2: Object-oriented modeling and design is a way of thinking about problems using models organized around real world concepts. ‘The fondamental construct is the object, which combines both data structure and behavior. WHATS OBJECT JAIENTATION? Defirition: OO means that we organize software as a collection of discrete objects (that incorporate both data structure and behavior). ‘There are four aspects (characteristics) required by an OO approach- ©. Kdentity. (© Classification, © Inheritance. (0. Polymorphism. 2 Wenticy: 10 Identity means that data is quantized into discrete, istinguishable entities called objects © xg for objects: personal computer, bicycle, queen in thess ete © Objects can be concrete (such a5 2 fle in a file system) or conceptual (such as scheduling policy ina multiprocessing OS). Each object has its own inherent entity (¥eewo objects are Sstinct even if all their attribute vas are identical), fo In programming languages, an objectis referenced by a unique handle. Classifica (O. Classifeation- means that object withthe same data structure (attribute) and behavior operations) are grouped into a cass. co Eg. paragraph, monitor chess piece. (© Each object is said to be an instance ofits class. Fig below shows objects and classes: Each dass describes a possibly infinite set of individual objects. R ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING Potyzon clas OO & e + Inheritance: (© lis the sharing of attributes and operations (features) among classes based on a hierarchical relationship. A super class has general information that sub classes refine and elaborate. © Eg, Scrolling window and fixed window are sub chstes of window. + Polymorphi © Polymorphism means that the same operation may behave differently for different classes, © For Eg. move operation behaves differently for a pawn than for the queen in a chess game. ‘Note: An operation is a procedure/transformation that an object performs or is subjected to. An eS implementation of an operation by 2 specific chassis called a method. WHAT IS OO DEVELOPMENT + Development refers to the sofware life cycle: Analjsis, Design and Implementation. e@ The essence of OO Development is the identification and erganization of application concepts, rather than their inl representation in a programming language. + lesa conceptual process independent of programming langunges. OO development is fundamentally way of thinking and not a programming technique. 20 methodology 4+ Here we present a process for OO development anda graphical notation for representing OO concepts. “The process consists of building mode! of an application amd then a¢ design. + The methodology has the following stages- © System conception: Sofware development begins with business analysis or users conceiving an application and formulating tentative requirements, xdding details to it during ASHOK KUMAR K h VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING ‘© Analysis: The analyst scrutinizes and rigorously restates the requirements from the system conception by constructing models. The analysis model is a concise; precise abstraction of what the desired system must do, not how it will be done. ‘The analysis model has two parts- Domain Model- a description of real world objects reflected ‘within the systern. 7 = Application Model- a description of parts of the application system itself that are Visible to the user. Eg. In case of stock broker application- ‘Domain objects may include- stock, bond, trade & commission. Application objects might control the execution of trades and present the results. ‘System Design: The development teams devise a high-level strategy- The System Acchitecture- for solving the application problem. The system designer should decide what performance characteristics to optimize, chose a strategy of attacking the problem, and make tentative resource allocations. © Class Design: The chss designer adds details to the analysis mode in accordance with the system design strategy. His focus ithe data structures and algorithms needed to implement each class. J ‘© Implementation: implementers translate the classes and relationships developed doring e class design into a particular programming nguage, database or hardware. During implementavon, itis important to follow good sofeware engineering practice. f ‘Three models 4 Weuse three kinds of modes to describe aspen from diferent view pois. 1 “Class Modelo the objects in the stem & their relationships Ie describes the sate structure ofthe jets inthe system and their efationships. Chass node! consis cass diagrams a graph whose nodes are dates and arcs are _ rebtionships among the classes. 2 State model forthe life history of object. I describes the aspects ofan objec that ange overtime. species and implements control rit stte dagramiss prph whose nodes are States and whose arcsare transition between Sates cused by event. 3, Interaction Model for the interacion ong objects. It descabes how the objects in the system co-operate to achieve broader results. This model thane with use cases that are then eborated with sequence and actviy diagrams. Use case focuses on fnctonty ofa system ~ Le what 2 ystem does for users Sequence diagrams shows the object that interact andthe time sequence of ther interactions. [Retivity dlagrarns — ehborates important processing steps 20 THEMES Several themes pervade OO technology. Few are— ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING <4 1. Abstras ‘© Abstraction lets you focus on essential aspects of an application while ignoring details i.e focusing on what an object is and does, before deciding how to implement it. © Its the most important skill required for OO development. . 2. Encapsulation (information hi © Itseparates the external aspects of an object (that are accessible.to other objects) {from the interval implementation details (that are hidden from other objects) ‘©. Encapsulation prevents portions of a program from becoming so interdependent that 2 small change has massive ripple effets. 3. Combining data and behavior © Caller ofan operation rieed not consider how many implementations exist. © In OO system the data structure hierarchy matches the operation inheritance Fierarchy (iz). aR a / pa eae 4. Sharing 2°00 eigies provide harng trent ees © lnheesee of bth dat soucire and blur las ab dase hare common code © OO devlpment sot ons you sare rmaton nie se pean ae Ofer he pronpct of sulig Sage andcace on ae ina 5. Einphasison the casence ofan eect OO weinsogy siresies nat an cet ther tn how its wed S © © deerme a preteen on hse nese empha on proctire srctire en nedorh cope hsmeg esien methodologies en, cssiction,polmerphism and nheritnce arc rte darctrize OO langage. © Each of these concepts can be used in isolation, but together. they cor a other synergistically. ao ine ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING ‘CHARTER Ib: MODELLING AS A DESIGN TECHNIQUE {or the purpose of understanding it before building, MODELLING + Desgers build many kinds of models for various purpotesbeloe constructing tin Models serve several purposes — ee ; © ‘Testing a physical entity before building i: Madea tule sale modes of Goshic Caanedets to tent the forces on te structures Enger test seale model of planes, crs Sd bones to improve der dani 0 Communication with curonners: Architects and roduc designers buld modesto show e@ Fer mrsars fue modkaps are demonstration oducts dat nate some of he ternal behavior of 23st) o Meats Sone ef nove, TV sow naveriemen ws hon cide Now 6 Reduction of complexity Models reduce comply o understand directly by separating buch sal purer ef porn tings to dona ne. ABSTRACTION 1+ Abstraction is the selective examination of certain aspects of a problem. ‘6 The goal of abstraction is to isolate those aspects that are important for some purpose and suppress those aspects that are unimportant. ‘THETHREE MODELS: ® i. Class Model: represents the static, structural, “dat” aspects of a system. o Te describes the serucrure of objects in a system their Wentty, cher relationships to other ‘objects, their aeributes, and their operations. + Gea in constructing lass mode! is to capture those concepts from the real world thatare important to an application, = "Chass diagrams express the dass model. 2. State Model: represents the temporal, behavioral, “control” aspects of a system. + State model describes those aspects of objects concerned with time and the sequencing of Sperations — events that mark changes, states that deine the context for events and the ‘organization of events and states. + Sate dagram express the state model. 1 Each state diagram shows the state and event sequences permitted ina system for one cass of objects. - + State diagram refer tothe other models. ASHOK KUMAR K \YVIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ‘i neem cements Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING -6 * Actions and events in a state diagram become operations on objects in the class model, References between state diagrams become interactions in the interaction model. 3. Interaction model ~ represents the collaboration of individual objects, the “interaction” aspects of a system. * Interaction model describes interactions between objects — how individual objects collaborate to achieve the behavior of the system asa whole. = ‘The state and interaction models describe different aspects of behavior, and you need both t0 describe behavior fully. Use cases, sequence diagrams and activity diagrams document the interaction model. ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING ‘CHAPTER 1c. CLASS MODELLING. i ‘Acclass model captures thet static structure of a system by characterizing the objects in the. systim, the relationships between the objects, and the attributes and operations for each cass of objects. QBIECT.AND CLASS CONCEPT. Objects Purpose of class modeling is to describe objects. An object is a concept, abstraction or thing with identity that has meaning for an application. Ex Joe Smith, Infosys Company, process number 7648 and top window are objects. Classes : ‘An object is an instance or occurrence of a cls. A class describes a group of objects with the same properties (attributes), behavior (operations), kinds of-relationships and semantics, Ec Person, company, process and window are classes. ‘texture are sullndividual apples: a person can eat one and then he other. The term identity means that the objects are distinguished by their inherent existence and not by descriptive properties that they may have. Note: All objects have identity and are distinguishable. Two apples with same color, shape and Glass diagrams ‘Class diagrams provide a graphic notation for modeling lasses and their relationships, thereby describing possible objects. Note: An object diagram shows individual objects and their relationships. Useful for documenting test cases and discussing examples. ® ‘Class diagrams are useful both for abstract modeling and for desing actual programs. Note: A chss diagram corresponds to infinite sat of object diagrams. Figure below shows a class (left) and instances (right) described by it.- [_Poteos feifth:Pavdon } | Mieystienerebon Lo geees f Cass, Seale Bea + Conventions used (UML): © UML symbof for both classes and objects is box. (© Objects are modeled using box with object name followed by colon followed by chss © Use boldface to list class name, center the name in the box and capitalize the first letter. Usesingular nouns for names of classes. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner oe dea seernanaiene ne Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING 0 Torun together mukiword names (such as JoeSmith), separate the words with infervening capital letter. See gta ta dah by hie ec » Siem + Eg. Attributes: Name, bdate, weight. ‘tan Set Fer. Orpen + mearectiagun fp Pabche —iestiine Person: ate RS, | - [EEA soos || Bieta oto) ® erent: Y Clase vite dieibaies . Djects with Values + Conventions used (UML): © List auibutes in the 2” comparunent.of dhe clas box. Optional detail (ike default value) may follow each attribute. ‘© Acolon precedes the type, an equal sign precedes defile value. © Show attribute name in Fepubr face, lefe align dhe name in the box and use small ease for the First lercer. ‘Similarly we may also include attribute values in the 2° compartment of object boxes with same conventions, ‘Note: Do not list object identifiers; hey are implicit in models = Eg : aa ES es @ + An operation isa function or procedure that maybe applied to or by objects in Ee Fie, ire and py divided are persons on Clas Company 7 PTS CASE Open, dose, hide and recisplay are operations on cass window. + Armethod isthe implementation of an operation for case Eg In dass fle, pric san operation you could implement diferent + Note: Same operation may aply to many diferent classes. Si + Fig shows modeling notation. ‘methods to print files. ich an operation is polymorphic. ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING Pergo rae SEO Ta, Fever, aes : on ein Pion . ehangeJob = - move (delta = eee. is ‘changeAddress" Zaleet (p : Pointy: Bootestty [rato dh ance eat= 00) UML conventions used ~ (6 List operations in 3 compartment of lass box." =. 1b List operation name in regular face, left align and use lower case for first letter. © Opdional devil ke argument list and return sype may follow each operation nme. ° aecadhesis enclose anargument lst commas Separate the arguments. A colon precedes the result type. Note: We do not list operations for objects, because they do not vary among objects of same cuss. ‘Summary of Notation for classes = ClassName —atributeNamey suatdType? = detaulivaniey auebuneNams2: dalatype2 = wofauttvaive2 . Fira RST GREER ERT aH . Sara oeReSE MME ra Sveun soe Fg: Suminary of modeling notation for classes ype = defaultValue direction eruimenttiarss Fig Notation for an argument of an operation LINK AND ASSOCIATION CONCEPTS Note: Links and associations are the means for establishing relationsh asses. inks and associations ‘Alink is a physical or conceptual connection among objects. Eg, JoeSmith WerksFor Simplex Company. Mathematically we define ani as 2 tuple —thatis, alist of objects. ~ ‘Alink isan instance of an association. ‘An association isa description of a grouy E-g.2 person WorksFor a company. f ips among objects and 1p of links with common structure and common ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING = 10- + Anassoctation describes a set of potential links in the same way that a dass describes a set of potential objects. + Fig shows many-to-many association (model for a financial application). {ewer | renon t Yohmbeaon amie=Johe" + Conventions used (UML): © Link isa line between objects: aline may consist of several line segments. © If the link has the name, itis undertined. > Association connects related classes and is also denoted by a fine. © Show link and association rames in + Note: ‘> Association name is optional, if the model is unambiguous. Ambiguity arises when a model has ‘ations in programming languages as references from one object to another. A refere ice is an attribute in one object that refers to"sniother object. ‘+ “Multiplicity species the number of instances of one class that may relate to a single instance of an associated dass. Multiplicity constrains the number of related objects. UML conventions: (© UML diagrams explicitly lists multiplicity at the ends of association lines, (© UML specifies multiplicity with an interval, i” (eacly one). “1-"fone oF more) 5{nee to five, iclisive). = (many, be zero oF more) + Previous figure Slsrates many-to-many mult such as icity. Below figure illustrates one-to-one multiplicity ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING -He tise ane, eae com | ES & CanadsiGounine | tiaataoitat [ Otawaicanaicy.| ane! oa | oe | a Francktounty | Haccaciial [PatleiGapialcie mated names France” name="Pads ame—Senedar name Dake Bes lige rater eo-or-one mupely. ° - [Workstation ‘Window + Note Asoeitgn ws nc a {a} STG z — a TE ga = apd Gre ; “reini340 Musa ye ile septic ent peer etioncraociation (excep for bags and sequences). =, ene 5 seroma | Tatar Sea Eset diagram (Object iagrink “ili BN AssoctationvscThax. Yous ee'moltple associations eee ANA Mecll mule inks betwesm te same object, : Note 2: Hulipiiy vs Cardinalny © Mukiplicy a constraint on the size of a collection. © Cardmaty isa count of elements that are actually ina callection. “Therefore, mutpiciy i= a constraint on cardinality. +) Note 3: The literature often describes multiplicity 35 being “one” or “many”, but more generally it isa subset of the non negative numbers. : Association end names . alii pty ‘refers to the ends of associations. For Eg. A one-to-many association has wo ends — ‘9 an end with a muldplicity of““one” © an end with a multiplicity of "mam ‘You can not only assign a multiplicity to an association end, but you can give ita name as well. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner a EPTS, CLASS MODELLING a 1. Unit 1: INTRODUCTION, MODELLING CONC! a Ses even] erson fe WorksFor- * ‘emiployeo ‘ ernployer ' WEY Blown SimBiox : m Sir E Noat Smit United widgets . 1 Assocthtion enilyiames. Each end of an association cap havea name. Inthe above figure, person and company participate in association worksFor. Apperson is ari employee with respect to company. A company is an employer with respect to a person. ° Note I: Association end names are optional. Note 2: Association end rames are necessary for associations between two objects of the same class. They can also distingssh multiple associations between a pair of classes. 7 ‘ omer »|__ ol User [ Directory auienzedOEer|* = R]contents Note 3: Association end names fet you unify multiple references to the same clss. When constructing class dagrams you should properly use sssocttion end rome sed gs separate class foreach reference as below hy vows, nae and eox roduc Parent pssociationsasses + An association class is an association thats also-a cass. Like the links ofan association, the instances of an association class derive identity from instances of the constinvent dbsses Lice a class an association class can have atribotes and operations and participate in associations. + Be fercnaaneas (eis toon 4 UML notation for ssodaton clas sa box attached to the association by a dashed ne, - + Note: Auorbutes for susocation css unmistakably belong tothe nk and cannot be ascribed to either object. @_—_intneabove gure, acessPermision saint property of File and user cannot be attached to ther file oF user sone without losing information. + Below figure presente strbutes fr two one-to-many rlasnship. Each person working for 2 company receives sabry and has ob tte aera ree tnotes the performance ofeach worker. Attributes may also oceur for one-to-one ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ON Unit 1: INTRODUCTION, MODELLING Manages aT] + Note 1: Figure shows how is posse to fo associations into the class opposite “one” en ‘Asa rule, you should not fold such atibutes int -epTS, CLASS MODELLING Ic boss! Company. | address. *{ Workstatior station Bee | senso Be feet Dea] cass vs ordinary cas, ito a cass because the multiplicity of the ass oh 1d attributes for one-to-one and one-to-many 1. This is not possible for many-to-many associ Ociaion . ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLO! Scanned with CamScanner Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING = 15 poate ale ‘A Qualified Association isan association in which an ateribute called the qualifier disambiguates, the objects for a “many” association ends. Ieis possible to define qualfers for one-to-many and many-to-many associations A qualifier selects among the target objects, reducing the effective muhiplicity from * any” to Ex I: qualifier for associations with one to many multiplicity. A bank services multiple accounts.,An account belongs to single bank. Within the context ofa Bank, the ‘AccountNiumber species a unique account. Bank and account are classes, and ‘AccountNumber isa qualifier. Qualification reduces effective mulilcity ofthis association {fom one-to-many to one-to-one. eel el ‘Not qualified — ea athe Rema een ot i ere ecek ce Br a Ee GENERALIZATION AND INHERITANCE Generalization isthe reasonship betwen class (the zuperdass) and one or more variations of the dass (the subchsses), Generalvation organizes classes by their smite and differences, structuring the description of objects. “The superclass holds commen attributes, operations and associations the subcsses add specific areributes, operations and asodations. Each subclass is said to inherit the features ofits superclass “There can be multiple levels of generalization. Fig) and Fig() (given in the following page) shows examples of generation, Fig(a) ~ Example of generalization for equipment. ach object inher features from one class at each level of generalization. UML convention used: Use lange hollow arrowhead ta denote generalization. The arrowhead points to superdass Fig(b) ~ inheritance for graphic figures. Te ord waiten nex to the generalization fine inthe diagram (ie dimensionality is generalization et rame. Seoenerallaton set mae isan enumerated atribute that indicates which aspect of an objec being abstracted by particular generalization. It's optional ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ‘MODELLING Unit 4: INTRODUCTION, MODELLING CONCEPTS, CLASS: 7 tee ese, Sehr). [“Riyean_| (eve SSS Sey [Seer | FSS” Fig) : ‘move, ‘select, rotate’, and dspay ae operations Tai ipstnemanl ata erate, “FW applies only to wo-dimensional figures colts ASHOK KUMARE VIVEKANANDA INSTITUTE OF TECHNOLO i Scanned with CamScanner ssc CNR OT Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING 17 + Use of generalization: Generalization has three purposes — 1 "To support polymorphism: You can call an operation atthe superclass level, and the 00 tanguage complior automatically resolves the all tothe method that matches the aaling abject’s class. 2. To structure the description of objects: ie to framea taxonomy and organizing objects on the bass of ther similarities and differences. oa 3. To enable reuse of code: Reuse is more productive than repeatedly writing code from seratch. a ¢ Note: The terms generalization, specialization and inheritance all refer to aspects of the same idea. Qverriding features + A subclass may override a supercass feature by defining a feature with the same name. The ‘overriding feature (subclass feature) refines and replaces the overridden feature (superclass feature) © Why override feature? ‘© To'specify behavior that depends on subdass.. (© To tighten the specification of a feature. ©. To improve performance. In fig(b) (previous page) each leaf subchsses had overridden ‘display’ feature. + Note: You may override methods and default values of attributes. You should never override the signature, or form of a feature. ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner unit : INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING =I NAYIGATION.OF.CLASS MODELS ticular, navigation of class . codels are useful for more than just data structure In par i 5 Uneovers hidden flaws and omission, which you can then repairs 7 + UstLincorporates a language that can be used for navigation, the object constrair Tanguage(OCL). OCl constructs for traversing classmodels - 4 OCLaan traverse the constructs in class models. |. Attributes: You can traverse from an object to an attribute value. ‘Syncac source object followed by dot and then attribute name. Exc aCreditCardAccountmaximumeredit 2 Operations: You can ako invoke an operation for an object or collection of objects. ‘Symtax: source object or object collection, followed by dot and then the dperation followed @ by parenthesis even ift has no arguments. GCL has special operaons that operate on entre collections (as opposed to operating on ‘each object in a collection). ‘Syntax for collection operation i: source object collection followed by ">", followed by the operation. 3. Simple associations: Do notation is also used to traverse an association toa target end. Tanger end maybe indicated by an association end mame, oF class mame if there is no ambiguity). Be refer fig in next page. = aCustomer.MaiingAdiress yields a set of addresses for a customer {the target end has “many” multiply). = aCredisCardAccouncMailingAddress yields a single address{ te target end has ‘mulupiciy of “one. 4. Qualified associations: The expression aCreditCardAccount Stat lovember {oom fins the satomen fr 9 edt ard acount wth he Soxcmen an ef November 1999. The syntax sto encote the qualifier value in brackets. 5. Associations classes: Given a link of an association class, you can find the constituent e ‘objects and vice versa. a 6 Generalization: Traveral of a generalization hierarchy is impli forthe i 1 Biker Mon concn herls sc operon NOT OCL norton Exe Statement Tramacion->selecr(amount>$100) ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner panes ucts eraR RANA RUNNER RETRO Unit 1: INTRODUCTION, MODELLING CONCEPTS, CLASS MODELLING +19. Tnatnaton Tame Bhenalumiber Examples of OCL expressions ‘aainapms Fs CraTaRTONKER oo | pReEOeR Shosehtambée ‘Rratons [Cwatasdion | [waseacitoniyraber|—~" | ransactionDale explanation Feo. Rapmmeat feat Werehant + Write an OCL expression for - . 1. What erammactions occurred fora credit card account within atime interval? sow ae redheardaccount SetementTrnscton > sect StatDwes=TransactonDateand “FeasactionDatec-anendD3t) 2, Whnt volumes of transactions were handled by an nstetion in the lst year? soi annsttodon GrednCardAccoune Semen Transaction “> ete putecsTrarencuenDae and Tansacdontte<=anndD3t@amount->s0{) 3, What custemers patronized a merchant inthe last year by any Kind of 8 carat Sol: steschanePurdase > selec StanDme<=TranscionDate and 8 Sr ecantodDse) SaremencredicardAccoun MaingA dress Cuscomer > assee() 4. How many credit card accounts does a customer currently have? ‘Soin, aCustomer-MaingAddress.CreditCardAccount -> size() '., What is the total maximum credit for a customer for all accounts? Soins acustomer MalingAddress.CreditCardAccount Maximumcredit > sum) ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner his nese enero secsceranesstuesmaiii OLA MAACO intB el UNIT 2: ADVANCED CLASS MODELING, STATE MODELING Syllabus ‘Chapter 2a: Advanced Class modeling 4 Advanced Object and Class Concepts Association Ends Neary Associations Aggregation Abstract Classes Multiple Inheritance Metadata Reifcation Constraints Derived Dita: 8 Packages Practical Tips (Chapter 2b: Sete Modeling Events States Transitions and Conditions 7 State Diagrams : State Diagram Behavior Ss ™ bhours ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY “Sri Venkoleshwere Xerox Center” Contact: Venkatesh ‘Mob: 9448926729 Scanned with CamScanner_ ina RIE AA esa ee ee RR ESTEE, Unit 2: ADVANCED CLASS MODELING, STATE MODELING ‘CHAPTER 28: ADVANCED CLASS MODELING ADYANCED O1 ce . Ey , + A dhta type is a description of values. Includes numbers, strin (At Enameration ira aca type tat has a fnitrsctofvalues. Fig shows some ‘examples of enumerations Figure gerType = ———— Dwodinibomatjliype @_* YWscontrutin.a mad we shout cael ot ererains, bee hey often ‘occur and are important tousers, + Ponor use a generalization to capture the values of an Enumerated axribute. An on is merely a Fist of values; generalization is a means for strung the description of objects: ‘You should introduce generalization only when at least one subclass has giant atuibutes, operations, or assacations trat do not apply to the superclass. wrong . [ soasee] | - r EEO . i | corres) Cea) Ferm ® BATE. | | nonao f + Inthe UML, ‘ - © We cam declare an enumeration by listing the keyword enumeration in uilemets, (<<>>) above the enumeration name in the top section of a box. The second i | ‘An enumeration data pe: | secon Tats the enumeration values. 4 Multiplicity isa constraint on the cardinality ofa set. Multipicity also applies to attributes (database application) “5 Muldpicity of an attribute specs thie numberof possible values foreach instantiation of an attribute. - ‘The most common specifications are ASHOK KUMAR K, \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ee aq Unit 2: ADVANCED CLASS MODELING, STATE MODELING (0A mandatory single value [1]. ‘¢ An optional single value [0.1]. 0 Many [*}. Parsoh mar ari Beads RAI Oy e Bites germ (0. slisibutes. Lou con specify whether ae sibote rietiineal mandatory or opens. ‘aitigai Intingie or mul * ulipticiy aso indicates whether an atribute is single valued or can be 2 collection. not specified, an attribute is assumed to be amandatory single valve (1). Scope + Scope indicates ifa feature aplies to an object o a cass. ‘+ Anunderline distinguishes feature with class scope (static) from those with object ( scope. Our convention isto fist attributes and operations with class scope at the top of the attribute and operation boxes, respectively. + Icisaeceptable to use an attribute with class scope to hold the extent of 2 cass (the set of objects for a class} this is common with OO databases. Otherwise, you should {void attributes with class scope because they can lead to an inferior model. Ieis better to model groups explicitly and assign attributes to them, * In contrast to attributes it is acceptable to define operations of class scope. The most onimon use of class-scoped operations is to create new instances ofa css, sometimes for summary data as wel. Fig attributes scope: instead of assigning atrbutes to cases, model groups expiily. — Misibiliey + Wisibifty refers to the ability of a method to reference a feature from another class and tas the possible vales of publ, protected, privet, and package. © Any method can frely access public features. © Only methods of the containing class and is descendants via inheritance can access protected features. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 2: ADVANCED CLASS MODELING, STATE MODELING © Only methods ofthe containing css can access private features pipe torso third yo agenda gegen package fentures The UML devotes witty witha pre ' pci paeernee daceaig sin pocedes private fetes : Ao peed aii rea (0 “"~” precedes package features, © Lack ofa prefix reveals no information about visibility ¢ Issues to consider when choosing visibility, > Comprehension: We mut undersand al public atures to understand the capabilities of a class. in contrast, we can ignore private, protected, package [norma thrid pnts atone o Extensibility: Many esses can depend on public methods, so canbe Nighy @ Glare wo change thet sipaure Since fewer classes depend on privat protected aod pachage metic are sare ltade to change them o Geter prt, ge ody operon state information created by abet medvods nthe asfAppied ove of context 3 Piha fetes acacia sree cae or ee coger ASSOCIATIONS ENDS 4 As the name implies, an Association End is an end of association, 4 Abinary association has 2 ends, a temary association has 3 ends, and so forth. ‘Association ends properties: (© Aggregation: The association end car be an aggregate or constituent part, Onkpa =" binary association can be an aggregation. ‘© Changeability: This property specifies the update status of an association end: » ‘The possibilities are changeable (can be updated) and readonly (can only be inidalized).. Navigabitity: Conceptually, an assodation may be traversed in either direction. However, an implementation may support only one direction, 6 Visibility Sinilar 10 attributes and operations, an assodation ends may be publi... protected, privote, or pockoge. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ‘A nonionic wiry ested $Pereon OPES EET ‘Purchase. Leh pow Fig Restating an mary association: we can decompose most ary associations into binary associations. 7 7 The UML symbol for. mary associations i a diamond with ines corihecting to related 4 classes. f the association has a name, it's writen in talics next to the diamond The OCL does not define notation Tor traversing mary associations. Figure shows a ternary association: A professor teaches a isted course during a semester. The resulting delivered course has a room number and any number of textbooks. Pa & [Denveredcourse |e — roamNumbar Fig: ternary association: nary associations are full edged associations and ean have association classes. A gpical programming language cannot express-a-ary associations. Thus, if we are Programming, we will need to promote n-ary associations to classes as below fig does for DereredCloss. Be aware that we change the meaning of a model, when you promote nary associations to classes, An nary association enforces that there is at most one link for each combination —for each combination of professor, Semester, and UstedCourse in above fig there is one DeliveredCourse. {mn contfast, a promoted class permits any number of finks—for each combination of Professor, Semester, and ListedCourse in below fig there can be many DelveredCourses, ‘Textbook iz ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY. Scanned with CamScanner Unit 2: ADVANCED CLASS MODELING, STATE MODELING os _-— AGGREGATION + Aggregation isa strong form of association in which an aggregate object made of comsn: prs, Consens re the gars of apeze- The septa : fan extended objecE thats treated a5 a unt many operations, although physical eis ‘nade of several Tesser objects. dead oe 4+ Weedefine an aggregation as relating an assembly class to one constievent part dass. An assembly with many kinds of constituent pars corresponds to many aregtions. + We define each individual pairing as an apgreation so that we can spec the muliplicity of each constiguent pare within the assembly. This definition emphasizes that aegregation is 3 special form of binary association. : +The most significant property of aggregation i transitivity (I Ais parcof Band Bis ECCI, hen Al prec) and rinromere UA par the BL Asgregation versus Association : + Aggregation is a special form of association, not an independent concept Aggregation ‘adds semantic connotations. 4 ftwo objests are tightly bound by a part-whoe relationship, itis an opgregotion. the wo objects are unl conde as independent even though they may often be 4+ Aggregation is drawn like association, except a small di end, jond indicates the assembly, ich an aggregate object is made of constiquent iv isa kind of association in whi ‘Ageregation versus Compesi + TROUMML heed forms of part whole relationships a ganeral form called Agregain and Sree netsh Bite cled compostion. Seer ition ia fom of agreqon with wo adional constraints. rao erent cn belong wo inert one acm S Once a constitute part has been assigned an assembly, it has a coincident ifetime with the assembly. 4 Thus composition implies for peopramming: Deletion tiyec vn composition. + Reson for composition is smal sfd damon ‘ownership of the parts by the whole. This can be convenient ‘of an assembly object triggers deletion of all constituent 1d next to the assembly dass. ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner TATE MODELING INCED CLASS MODELING, S' Unit 2: ADVAL a . event pare belongs to at mast one assembly and has 3 Fig, composi: with composition 2 con coincident Heme with the assembly Propagation of Operations awa Propagation (also called triggering) is the autormatic application ofan opesus e ineework of objects when the operation is applied to some starting object. For example, tnovingan aggregate moves its parts; the move operation propagates to the Parts Propagation of operations to parts is often a good indicator of aggregation. Fig below shows an example of propagation. ra Pe a Peharectee P 2 an Fig promenion you can propagate operations across aggregations a compositions. 'o A person ovine multiple documents. & Each doucumene consists of paragraphs that, in turn, conssts of characters. © The copy operation propagates from documents to paragraphs to characters. © Copying a paragraph copies all he characters int. © The operation does not propagate in the reverse direction. Propagation provides concise and powerfl way for specifying a continuum of behavior. Propagation is possible for other operations including saelrestore, destroy. print, lock, play. ‘You can indicate propagation on class models with a small arrow indicating the direction and operation name next to the affected association. Note: This notation is not part of the UML ands a apecial notation. ABSTRACT CLASSES Abstract class isa class that has no direct instances but whose descendant classes have direct instances. A concert class is a class that is insatiable; that i, it can have direct instances. A concrete dass may have abstract subclass. Only concrete classes may be leaf classes in an inheritance tree. Example: dass Employee in below fig is an example of an abstract class. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner So Unit 2: ADVANCED CLASS MODELING, STATE MODELING YaarTeDatozamings. ‘Gaiitimampinyes. | [Parctimeemployee. SweeriyFiate: ‘houriyRate™ = ‘cSimputePay ‘compulsPay, : + Inthe UML notation, an abstract lass name is listed in an falc (or place the keyword {abstract} below or after the name). : + We can use abstract classes to define the methods that can be inherited by subclasses. ‘Alternatively, an abstract class can define the signature for an operation with out > supplying a corresponding method, We call this an abstract operation. + Abstract operation defines the signature of an operation for which each concrete subclass must provide its own implementation. + Acconerete class may not contain abstract operations, because objects of the concrete class would have undefined operations. ERITANCE + Multiple inheritance permits a css to have more than one superclass and to inherit feacures from al parents. Then we can mix information from ‘wo oF more Sources. This fea more complicated from of generalization than singe inheritance, which restricts the dass hierarchy to a ree. + Advantage: Greater power in specifying classes and an increased opportunity for “Disadvantage: Loss of conceptual and implementation simpiiccy. Kinds of Ptuttiple Inheritance + Two kinds of multiple inheritance: ‘o Mutiple Inheritance from disjoie classes. © Muliple inheritance from overlapping classes. + Multiple Inheritance from disjoint "= most common form of multiple inheritance is from sets of disjoint classes. Each subclass inherits from one class in each set (Inthe fig Below, FulllimelndvidvolContributor is both FullTimeEmployee and IndividualContributor and combines their features. © FullimeEmployee and PartTimetmployee are disjoint; similarly, Monoger and IndividvalContributor are also disjoint. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY - Scanned with CamScanner ASS MODELING, STATE MODELING unit 2: ADVANCED Cl Fuirfireeindiviavelorbator «© Conilicts among parallel definitions create arbiguities that implementations must resolve: in pracee, avoid such confics nodes or sep cele them, oven ia particular language provides a priority rue for resolving conficts. Fore. suppose ha fllimeE ployee ad nvotConrbuor both have an attribute called Nome. in principle, thére is no obyious way to resolve such clashes. The best solutions to try to avoid them by restating the attributes as FullfrneEmpeyee Nome] and InvdvolEmplaee Named. i + Muliple Inheritarice rom overlapping classes! ‘© Mubtiple Inheritance can also occur wit overtipping classes. 0 Eg, In below fig, AmphibiousVehicle is both LandVehide and WoaterVehide. LandVehicle and WoterVehide overlap, because some vehicles travel on both land and water. ETS A, ; ide Epes indie nt Tovinspi onelsy — — Tandvanicio | { wotervenicte } UML uses a constraint to indicate an overlapping generalization set: the notation isa dotted fine cutting across the afected generalization with Keywords in braces. ‘In this example, oxopping means that n individual vehicle may belon nd le 1gt0 more than one of te subclasses, Incomplete means that all possibie subchsses of vehicle hhave not been expiily named. 4 Aniistanc of dss inherently an instance ofa ancestors ofthe cs Fax example, an instructor could be both fel and student Bu what shout a Harvard Presson king ss MT? There ocho ear the conn ae txample of mpl dasitaton, in hich one instance happens to partoeen i vas overlapping classes. ee eee ASHOK KUMAR K \VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Workarounds ~ Dealing with lack of multiple inheritanceis really an implementation issue, but early restructuring of a model is often the easiest way to work around its absence. Here we list some restructuring techniques. Two of the approach make use of Delegation, which is an implementation mechanism by which an object forwards an operation to another object for execution. 1. Delegation using composition of parts: Here we can recast a superclass ‘with multiple independent generalization as a composition in which each constiment part replaces a generalization. This is similar to multiple classification. ‘This approach replaces a single object having a unique ID by a group of related objects that compose an extended object. Inheritance of operations across the composition is not automatic, The composite must catch operations and delegate them to the appropriate part In this approach; we need not create the various combinations as explicit classes. All combinations of subclasses from the different generalization are possible. 2. Inherit the most important dass and delegate the rest: Fig below preserves identity and inheritance across the most important generalization. We degrade the remaining generalization to composition and delegate their operations 2s in previous alternative. 3. Nested generalization: this approach multiplies outall possible combinations. ‘This preserves inheritance but duplicates declarations and code and violets the spiric of OO programm 4. Superclasses of equal importance: if a subclass has several superdlasses, alt of equal importance, it may be best to use delegation and preserve symmetry in the model 5. Dominant superclass: if one superclass clearly dominates and the others are less important, preserve inheritance through this path. 6. Few subclasses: if the number of combinations is small, consider nested generakzation. Ifthe number of combinations is large, avoid it. 7. Sequencing generalization sets: if we use generalization, factor on the most important criterion first, the next most important second, and so forth. Large quantities of code: try to avoid nested generalization if we must dopiate large quantities of code. 9. Identity: consider the importance of maintaining strict identity. Only nested generalization preserves this. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner -10- unit 2; ADVANCED CLASS MODELING, STATE MODELING METADATA ‘Metadata is data that describes other data. metadata. : For example, a class definition is a Mod are inhereriy meta, doce they describe the things being modeled (shor than Being the things). Many realworld applications have metadata, such 25 PAS catalogs, blueprints, and dictionaries. Computer languages implementation 2 scent es Aor mt tet ho oo armnosset.. eet ce” | * Desenbes ‘[Eeemnaror We ean also consider classes as objects, but classes are meta-objects and not reakworld objects. Class descriptor object have features, and they in turn have their own classes, ‘which are called metaclasses. “REIEICATION Reiffeation is the promotion of something that is not an object into an object. Reifcation is a helpful technique for Meta applications because it lets you shift the level of abstraction. On occasion ic is useful to promote attributes, methods, constraints, and ‘control information into objects so you can describe and manipulate them as data. Example of reification: ‘© Consider a database manager. A developer could write code for each application so that it can read and write from files. co Instead, for inany appfications, it is better idea to reify the notion of data services and use a database manager. (A database: manager has abstract functionality that provides a general-purpose solution to accessing data reiably and quickly for multiple users. Fig below promotes the substanceNome attribute to a class to capture the many-to-many. relationship between Substonce and SubstonceNome. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY a Scanned with CamScanner ae Unit 2: ADVANCED CLASS MODELING, STATE MODELING He SONSTRAINTS : ——+-A Constraint isa Boolean condition involving model elements, suchas Bbie@, asses, aterbutes links, associations, and generation sets + AConstraint restricts the valies'that elements con assume + You can express constraints with natural language ora formal language such asthe oc. a (lescieagiowiahers) —— sroehtmiverieansy No employes's salary can exceed the salary of the employee's boss (a constraint between two things atthe same time) No window can have an aspect ratio (lengtiwidth) of less than 08 or greater than _ 1.5 (@ constraint between attributes ofa single object). © The priority of job may not increase (constrzine on the same object over time). ‘Constraints on generalization sets + Class miodels capture many Constraints through their very structure. + For example, the semantics of generalization imply cértain structural constraints. + With single inheritance the subclasses are mutually exclusive. Furthermore, each instance of an abstract supercass corresponds to-exaciy one ' subchss instance. Each instance of a Concrete superclass corresponds to at most one subclass instance. + The UML defines the following keyword s for generalization, © Disjoint: The subclasses are mutually excsive. Each object belongs to exactly one of the subclasses. © Overtapping: The subclasses can share some objects. An object may belong to. ‘more than one subchss. ‘© Complete: The generalization lists all the possible subclasses, © Incomplete: The generalization may be missing some subclasses, ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner IG Unit 2; ADVANCED CLASS MODELING, ‘STATE MODELIN( Constraints on Links iplicy isa constraint on the cardinality of 3 Set i ee of cj reed ge Species the numberof vais that are possible Fox ifetin also constraints an association. A qualifier atribute¢ Sen cn ocndon bu ako signe rie association end. seaniceas Hi grin Anan dose sin se i ‘ramet an hive aibute and operations. partidpate in associations, and paricipate in generalization But an association class has a constraint that an ordinary class does nots it derives identity feom instances of the relaced classes. fd ‘An ortinary association presumes no particular order on the object ofa “many” end. “The constraint fordered} indicates that the elements ofa “many” association end have an explicit order that must be preserved. Fig shows an explicit constraint shat is not part of the modes structure. 1 Muliplicty for an associ ject. Multiplicity for an attribute each instant an attribute. for attribute does not merely “many” objects Fig subeet conseraine between associations. We favor expressing constraints in a declarative manner. Declaration lets you express 2 constraint’ ten without supposing an implementation. “Typical. we need to convert constants to procedural form before we can implement them in a programming lnginge bu this conversion i usualy straightforward. Constants provide one criterion for measuring the quality ofa css model a “good” class model eprres many constrains through its structure. often requires several iterations to ge the structure of mode right from the prospective of constraints In practice, we should Enforce only the important constrains witha model's structure. “The Uti has two aleernative nations for constraints: ether deta constraint with braces or plceit ina “dog-eared" comment box. DERIVED DATS A derived element is a function of one or more elements, which in turn may be derived. A derived element is redundant, because the other elements completely determine it Ubimatel, the derivation tree terminates with base elements, Classes, associations, and attributes may be derived. ‘The notation for a derived element i.a slash in front of the element name. you may also show the constraint that determines the derivation. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 2: ADVANCED CLASS MODELING, STATE MODELING +1 Figbdlow shows a derived attribute. Age ean be derived from birthdate and the current ae, —L. tna cietniniiiee Sates: : AA chss model should generally datinguish independent bate atvbutes from dependent derived attributes. : i PACKAGES A package is 2 group of elements (classes, association, generalization, and lesser packages) with a common theme. ‘A package partitions a model, making it easier to understand and manage. A package partitions a model, making it easier to understand and manage. Large applications may require several tiers of packages. Packages form a tree with increasing abstraction toward the root, which is the’ application, the top-level package. ‘Notation for package is a box with tab: —— ee Saees ; ‘Tips for devising packages: ‘0 Carefully deffneate each package's scope. © Define each class in a single package. © Make packages cohesive. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner Unit 2: ADVANCED CLASS MODELING, STATE MODELING 13 Fig below shows a derived attribute, Age can be derived Irom birthdate and the current dae, Eig PACKAGES Apackage is a group of elements (lasses, association, generalization, and lesser packages) with a common theme. ‘A package partitions 3 model, making fe easier to understand and manage. . A package partitions a model, making it easier to understand and manage. Large applications may require severs} ders of packages. Packages form a tree with increasing abstraction toward the root, Whi application, the top-level package. Notation for package is a box with # tab: isthe ‘Tips for devising packages: ‘0 Carefully delineate each package’s scope. © Define each class in a single package. (0 Make packages cohesive. ASHOK KUMAR K. VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner “i (ODELING, STATE MODELING Unit 2: ADVANCED CLASS: mM (HAPTER 2B: STATE MODELING snodel deeb the sequence of peas a cin refs to a th operon de vat ey Pe OF how ‘external stimuli, 2 opposed to what the opera they are implemented. Si ora The state model consists of multiple state diagrams, one foreach class with temporal ichavior that is important to an application. . Tema dard cn iphical representation The state diagram isa standard computer science concept ( 2 Fa} of finite state machines) that relates events and states. (© Events represent external stimuli. (© States represent values of objects. EVENTS Deffnitfon: An event's an occurrence at a point in time. Exc User depresses lle button. Fight 123 deparss from Chicago. Events often correspond to verbs in the past eense orto the onset of some condition. By defnition, 3m event Rappens instantaneously vr.t me scale ofan application. OF course, nothing is realy instantaneous; an event is simply an ocaurrence that an application considers atomic and Meeting. ‘The time at which an event occurs is an implicit ateibute of the ie event may logically precede or follow anther, oF the two events maybe unrelated. Tho events tht areas unrelated are adobe concurrent thy have no eect Events include error conditions as well as normal occurrences. Eg, motor jammed, transaction aborted and time-out are typical error events Kinds of events: © Sigal event. (© Change event. © Time event. ‘Signal event A signals an exp one-way transmission ofalormation from one object to another. ‘An object sending a signal to another object may expecta reph, but the reply ka Separate signal under the control of the second objec which may or may hot choose to Asignal event ith event of sending or recshinga sia. Dilference beten sal and signal event ©. signal isa message between objets. © signal evetis an occurrencein time 2 unique occurrence, but we group them int signal doses 3 name to indicate common structure and behavior. ASHOK KUMAR K VIVEKANANDA INSTITUTE OF TECHNOLOGY Scanned with CamScanner ait ectonssessinassatnc arin Unit 2: ADVANCED CLASS MODELING, STATE MODELING - 15. Eg, UA Flight 123 departs from Chicago on Jan 10, 1991 isan instance of signal class FighDeporure, ‘The UML notation : (©. Use the keyword signal in gullemots (<< >>) above the signal class name in the top section of a box. ©. The second section lists the signal attributes. owseBvionriaiea | [susan é Sef ee pee - sash Bighpiarad 25 Fig signal chsses and attributes Ghange event ‘A change event is an event that is cused by the satisfaction of a Boolean expression. ‘The intent of the change event is that the expression is continully tested—whenever the expression changes from false to true, the event happens. UML notation for a change event is the keyword when followed by a parenthesized Boolean expression. Ep ee — 7 when( room tanparaire eating ve point) = Shen {battery power < Tower + when(Ghe pressure

You might also like