1 / 76

Topics in Object-Oriented Methodology

Topics in Object-Oriented Methodology. Takuya Katayama JAIST. Hi !. Myself Prof. at Japan Advanced Institute of Science and Technology Working on formal and mathematical aspect of software engineering, especially Object-Oriented Methodology Software evolution Fault-tolerant software

karis
Download Presentation

Topics in Object-Oriented Methodology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Topics in Object-Oriented Methodology Takuya Katayama JAIST

  2. Hi ! • Myself • Prof. at Japan Advanced Institute of Science and Technology • Working on formal and mathematical aspect of software engineering, especially • Object-Oriented Methodology • Software evolution • Fault-tolerant software • My family One dog, One wife and two daughters

  3. Agenda • Fundamental Concepts in Object-Oriented Methodologies • UML • Topics in OO Methodologies • Constraints and OCL • Proving Constraints

  4. Fundamental Concepts inObject-Oriented Methodology

  5. What is Object-Oriented Methodology ? • Software developing methodology based on Object-Oriented Paradigm • Our world is a collection of collaborating agents/objects • Software has to be organized according to the structure of our world • It increases understandability and evolvability of the software

  6. Object-Oriented Paradigm(1) • Our Word is a collection of collaborating agents President Sales dept. Factory Factory workers Engineers Scientists

  7. Object-Oriented Paradigm(2) • Organize software according to the structure of the world Management Information Object Factory Management Object Sales Dept. Object Worker Object Laboratory Object Design Object

  8. Computationally, Objects are… • Elements of the world to be described • Autonomous behavioral elements • Object=Attributes+Operations+Behavior • Attributes:Local data of object • Operations:For changing/referencing the attributes • Behavior:Upon receiving stimulus(event), perform operations, changes its states and sends out events • Usually, modeled as statecharts or event-driven program • Object is encapsulated.

  9. Communication via events,… Attribute: a,b,c Operation: draw, paint, move,.... Behavior e/move, e’

  10. Description of the World • How do we describe the world? • Class concept + Relations among classes • Class as a set of “similar objects” in the world • Abstraction :{professor Shinoda, professor Tan, …}  class “professor” • Instantiation : “professor”  professor Shinoda • Class concepts provides economy and reuse of thought and description.

  11. Objects and Classes object: Chula Yangon abstraction U. Laos instantiation class: university Tan Shinoda Working-at class: professor

  12. Relationships Among Classes • Class Hierarchy, Inheritance, “is a” • Generalization/Specialization • Mammal < Monkey < Human • Composition, Aggregation, “has a” • Automobile=Body+Wheels+Steering+Engine • Association, a general relation between classes Employ―(works at)―Company • Dependency, Realization,...

  13. Too Major Issues in Object-Oriented Methodology • Object-Oriented Analysis/Design • BOOCH, OMT, UML, Catalysys methods • Constraints, Formal Approach, Analysis Patterns,Unified Process, … • Object-Oriented Programming • OO langugages :Smalltalk, C++, Java • Design Patterns, Frameworks , Class Libraries …

  14. Typical Object-Oriented Development Process Architecture design Choice of impl. strategy Object design Analyzing requirement Object model Reqmnts Design Analysis Coding Dynamic model Coding in OO language ・・・ Analysis models

  15. Multiple Analysis Models • Description of a single model from multiple views which are almost independent • Eight Models + One Language in UML division company section Object Model for classes in the world and their relationship e1/e2, u=f(v) s2 s1 employee main x sub1 z Dynamic Model for behavior description of each object sub3 y sub2 Functional Model for data flow in the world

  16. UML • Notations to describe every aspects of software development • From business systems to industrial embedded systems • Becoming a standard notation • Unified notations in Booch method, OMT method(Rumbaugh), OOSE method (Jacobson) • Becoming a standard language or culture of software engineer

  17. UML- Eight Diagrams and One Language • Use Case Diagram • Class Diagram/Object Diagram • State Diagram • Sequence Diagram • Collaboration Diagram • Activity Diagram • Component Diagram • Deployment Diagram • OCL(Object Constraint Language)

  18. Use Case Diagram • Use Cases describe a rough sketch of functions or “usage” of the system looked from the actors outside the system. • System functions are described by a set of use cases.

  19. Use Case Diagram Use cases : specifies functions of system Actor : human, machine,… interacting with the system Sign an insurance policy Process sales statistics Process customer statistics Customer Insurance Salesperson Insurance System

  20. Description of Use Case • By sentences or activity diagrams • Purpose of use case • How the use case is initiated • Message flow between actors and use case • Alternative flow • conditional/exceptional flow • do not go into too much details • Utilizing of other use cases : use case call • How the use case is terminated

  21. Activity chart used to describe actors and the use cases if they are well-defined. Insert coins Enough coins inserted? Show that drink can be chosen Show that drink is not available Choose drink drink not available Drink customer drink available Deliver drink

  22. In OO development, use cases are used to find objects. Functions represented by the use cases are realized as collaborations among the objects. <<realizes>> collaboration use case U <<implements>> use case description 1.the actor depresses an button 2.action 1 is executed 3.a message is sent to the actor 4. … class B op1 op2 class C op1 op2 op3  class A op1 op2 op3  dicover classes

  23. Class Diagrams • Classes in the system + Relations • Relations among classes • Inheritance • Aggregation • Association • Dependency • Realization

  24. Class and Object Employee Employee Employee name:String name=‘Smith’ name=‘Sharp’ age=24 age=52 age:Integer Class Employee Objects instantiated from the class Employee

  25. Association and Multiplicity 0..* 2..* Line name Point name Intersect Line L1 Point P1 Line L2 Point P1 L2 Line L3 P1 P2 L3 Line L4 L1 L4 L5 Line L5

  26. Inheritance Equipment name manufacturer weight cost Attributes and operations are inherited from super classes Heat exchanger Pump Tank suction pressure discharge pressure flow rate surface area tube diameter …. volume pressure Diaphragm pump name=P101 manufacture=Simplex … suct pressure=1.1 atm … diaph material=Teflon Diaphragm pump Plunger pump Floating roof tank diameter height diaphragm material

  27. Aggregation Computer 1..* System box Monitor Mouse Keyboard 1..* 0..1 Fan CPU RAM Chassis

  28. Dependency • Utilize class A in class B • B has A as a parameter • B accesses data in A • B uses operations A • Change of A affects B class A class B

  29. Realization • Class B is a realization of A • B is more concrete • A is more abstract • R: mapping B  A R class A class B

  30. Interface and Realization • Interface is a special class with abstract operation. It is used with classes which realize/implement them. <<interface>> ChoiceBlock setDefault(choice:Choice) getChoice():Choice PopupMenu setDefault(choice:String) getChoice():String 1..* choice 1..* choice realization <<interface>> Choice String specifier implementation

  31. Dynamical Views • State Diagram/Statechart • Specify dynamics of individual object • Sequence Diagram • Event sequence observed in collaborating objects • Collaboration Diagram • Different notation of sequence diagram • Activity Diagram • Action + Control structure • Flowchart

  32. Telephone System Event Caller Phone line Callee caller-lifts-receiver dial-tone-begins dial(5) dial(1) callee-hangs-up connection-broken connectin-broken caller-hangs-up

  33. State Diagram for “Phone line” caller-hangs-up Idle caller-lifts-receiver time-out Time-out Dial tone dial(n) dial(n) time-out Dialing callee-hangs-up Disconnected Connected

  34. Generalized State push R Transmission Neutral Reverse push N push N push F Forward stop upshift upshift First Second Third downshift downshift

  35. Aggregation and Concurrent State Diagram Car Ignition Transmission Brake Accelerator Accelerator push R Transmission Neutral Reverse On push N push N push F release depress Forward upshift upshift 停止 Off First Second Third downshift downshift Brake Off turn key to start if Transmission in Neutral Ignition … … Off Starting On release key On turn key off

  36. Sequence Diagram Print(file) :Computer :PrinterServer :Printer :Queue Print(file) [printer free] Print(file) [printer busy] Store(file) ・Shows possible sequence(s) of messages among objects ・Inter-object behavior

  37. Collaboration Diagram Computer Queue 1:Print(file) [printer busy] 1.2: Store(file) PrinterServer Printer [printer Free] 1.1: Print(file)

  38. Activity Diagram • Shows relationship among actions • Intra-object actions • Inter-object actions CustomerWindow: PrintAllCustomers Show MessageBoxe “Printing” onScreen Create postscript file Remove MessageBox Send postscript file to printer

  39. Component Diagram • Software components(source, binary and executable) and their relationship Window Handler (whnd.cpp) Window Handler (whnd.obj) Graphics lib (graphics.dll) Comm Handler (comhnd.cpp) Comm Handler (comhnd.obj) Client Program (client.exe) Main Class (main.cpp) Main Class (main.obj)

  40. Deployment Diagram • Machines, programs and connections MachineA    :Gateway MachineB    :Fujitsu NetC Client Program (client.exe) Graphics lib (graphics.dll)

  41. Topics in OO Methodologies • Object Constraint Language OCL • Formal Approach to OO Analysis

  42. Constraints and OCL • Constraints • Description of systems and services using their properties • Usually, constraints are described by the results of the services rather than the procedure to realize them. What rather than How. “Any letter posted until 6:00 pm has to be delivered in the next working day”

  43. Constraints in UML • Constraints on attribute values in class diagram • Definition of operations in classes by pre/post-conditions • Benefit of constraints • Provide means to attach semantic information to UML class diagrams • Allow declarative definition of behavior • OCL : standard constraint language in UML • Based on first order predicate logic

  44. “Royal Loyal” Company • Mileage Handling company • LoyaltyProgram • Bonus point • Air flight mileage • Deduction • ProgramParner: a company offering its customer a membership in a loyalty program • Customer owns CustomerCard

  45. Customer name:String title:String isMale:Boolean dateOfBirth:Date age:Integer LoyaltyProgram enroll(c:Customer) 0..* 0..* 1..* program partners 1..* ProgramPartner numberOfCustomers:Integer owner 0..* Membership 0..* cards 1..* {ordered} CustomerCard valid:Boolean validFrom:Date goodThru:Date color:enum{silver,gold} printedName:String ServiceLevel actual Level 0..1 delivered Services card LoyaltyAccount points:Integer earn(i:Integer) burn(i:Integer) isEmpty():Boolean 0..* Service condition:Boolean pointsEarned:Integer pointsBurned:Integer description:String card 0..* available Services transactions 0..* Transaction points:Integer date:Date program():LoyaltyProgram 0..* 0..* transactions transactions Date $now:Date isBefore(t:Date):Boolean isAfter(t:Date):Boolean =(t:Bate):Boolean Burning Earning

  46. Customer name:String title:String isMale:Boolean dateOfBirth:Date age:Integer Customer age>=18 LoyaltyProgram enroll(c:Customer) 0..* 0..* 1..* program partners 1..* ProgramPartner numberOfCustomers:Integer owner 0..* Membership 0..* cards 1..* {ordered} CustomerCard validFrom.isBefore(goodThru) CustomerCard valid:Boolean validFrom:Date goodThru:Date color:enum{silver,gold} printedName:String ServiceLevel actual Level 0..1 delivered Services card LoyaltyAccount points:Integer earn(i:Integer) burn(i:Integer) isEmpty():Boolean 0..* Service condition:Boolean pointsEarned:Integer pointsBurned:Integer description:String card 0..* available Services transactions 0..* Transaction points:Integer date:Date program():LoyaltyProgram 0..* 0..* transactions transactions Date $now:Date isBefore(t:Date):Boolean isAfter(t:Date):Boolean =(t:Date):Boolean Burning Earning

  47. Customer name:String title:String isMale:Boolean dateOfBirth:Date age:Integer LoyaltyProgram enroll(c:Customer) 0..* 0..* 1..* program partners 1..* ProgramPartner numberOfCustomers:Integer owner 0..* Membership 0..* cards 1..* {ordered} CustomerCard valid:Boolean validFrom:Date goodThru:Date color:enum{silver,gold} printedName:String ServiceLevel actual Level 0..1 delivered Services card LoyaltyAccount points:Integer earn(i:Integer) burn(i:Integer) isEmpty():Boolean 0..* Service condition:Boolean pointsEarned:Integer pointsBurned:Integer description:String card 0..* available Services printName in CustomerCard is the concatenation of name and title of Cutomer which holds it. CustomerCard printedName=customer.title.concat(customer.name) transactions 0..* Transaction points:Integer date:Date program():LoyaltyProgram 0..* 0..* transactions transactions Date $now:Date isBefore(t:Date):Boolean isAfter(t:Date):Boolean =(t:Bate):Boolean Burning Earning

  48. Customer name:String title:String isMale:Boolean dateOfBirth:Date age():Integer LoyaltyProgram enroll(c:Customer) 0..* 0..* 1..* program partners 1..* ProgramPartner numberOfCustomers:Integer owner 0..* Membership Program partner wants to restrict total points is less than 10000 points. LoyaltyProgram partners.deliveredServices.transaction ->select(oclType=Burning) ->collect(points)->sum<10000 0..* cards 1..* {ordered} CustomerCard valid:Boolean validFrom:Date goodThru:Date color:enum{silver,gold} printedName:String ServiceLevel actual Level 0..1 delivered Services card LoyaltyAccount points:Integer earn(i:Integer) burn(i:Integer) isEmpty():Boolean 0..* Service condition:Boolean pointsEarned:Integer pointsBurned:Integer description:String card 0..* availble Services transactions 0..* Transaction points:Integer date:Date program():LoyaltyProgram 0..* 0..* transactions transactions Date $now:Date isBefore(t:Date):Boolean isAfter(t:Date):Boolean =(t:Bate):Boolean Burning Earning

  49. Defining operations by Pre-, Postcondition • precondition:specifies condition when the operation could be triggered. • postcondition: specifies condition which holds after the operation. precondition P postcondition

  50. Customer name:String title:String isMale:Boolean dateOfBirth:Date age():Integer LoyaltyProgram enroll(c:Customer) 0..* 0..* 1..* program partners 1..* LoyaltyAccount::isEmpty() pre : -- none post : result = (points=0) ProgramPartner numberOfCustomers:Integer owner 0..* Membership 0..* cards 1..* {ordered} CustomerCard valid:Boolean validFrom:Date goodThru:Date color:enum{silver,gold} printedName:String ServiceLevel actual Level 0..1 delivered Services card LoyaltyAccount points:Integer earn(i:Integer) burn(i:Integer) isEmpty():Boolean 0..* Service condition:Boolean pointsEarned:Integer pointsBurned:Integer description:String card 0..* availble Services transactions 0..* Transaction points:Integer date:Date program():LoyaltyProgram 0..* 0..* transactions transactions Date $now:Date isBefore(t:Date):Boolean isAfter(t:Date):Boolean =(t:Bate):Boolean Burning Earning

More Related