Presentation is loading. Please wait.

Presentation is loading. Please wait.

Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 12-09-2013.

Similar presentations


Presentation on theme: "Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 12-09-2013."— Presentation transcript:

1 Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 12-09-2013

2  An object is represented as rectangles with underlined names : Lecturer Class Name Only Y.Welikala : Lecturer Class and Object Name Y.Welikala Object Name Only Informatica II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

3 Intro to OO 201 Algebra 110 Electricity 100 Algorithms 202 ThermalDynamics 110 Electronics 110 English 101

4  A class is represented using a compartmented rectangle. Informatica II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2 Lecturer

5 Name save() change() delete() empID create()

6  The second and third sections may be suppressed if they need not be visible on the diagram Lecturer Name save() change() delete() empID create() Lecturer Name empID Lecturer save() change() delete() create() Lecturer Informatica II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

7 CourseOffering Intro to OO 201 Algebra 110 Algorithms 202 Electricity 101 Electronics 200 English 110 Thermo 110

8 Informatica II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2 Class Attribute CourseOffering number startTime endTime :CourseOffering Number=CS201 endTime=1230 startTime=1030 Object Attribute Value :CourseOffering Number=CS202 endTime=1500 startTime=1300

9  Attributes are in fact objects.  However, fine detail such as date, integer, etc., should not be modeled.  Sometimes it is difficult to decide whether an attribute should be an object, and vice versa, e.g. qualification as an attribute of person could be modeled as an object.

10  The same operation (e.g. +) may apply to lots of different classes (polymorphism).  The implementation of an operation is called a method.  Methods are exactly equivalent to procedures and functions in traditional languages.  Methods may have arguments.  Methods may return a result.

11 CourseOffering addStudent deleteStudent getStartTime getEndTime Class Operation Informatica II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

12  Classes are types! Types are classes!  Programming languages have built-in classes, such as Real, Integer, Array.  In an object language you can expand and extend the types available, e.g. add complex numbers to the number hierarchy.

13  Association  Aggregation  Composition  Generalization

14  A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts TrainCarriage Aggregation Whole Part Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

15  A form of aggregation with strong ownership and coincident lifetimes  The parts cannot survive the whole/aggregate Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2 ExamPaper Aggregation Whole Part

16  Multiplicity defines how many objects participate in a relationships  The number of instances of one class related to ONE instance of the other class  Specified for each end of the association  Associations and aggregations are bi- directional by default, but it is often desirable to restrict navigation to one direction  If navigation is restricted, an arrowhead is added to indicate the direction of the navigation.

17  Unspecified  Exactly one  Zero or more (many, unlimited)  One or more  Zero or one  Specified range  Multiple, disjoint ranges 1 0..* * 1..* 0..1 2..4 2,4..6

18 StudentSchedule Navigation 0..*1 Multiplicity Informática II. Facultad de Ingeniería. Universidad de Antioquia. 2013-2

19  A relationship among classes where one class shares the structure and/or behavior of one or more classes  Defines a hierarchy of abstractions in which a subclass inherits from one or more super classes  Single inheritance  Multiple inheritance  Generalization is an “is-a-kind of” relationship.

20  One class inherits from another BankAccount balance number name Withdraw() CreateStatement() Current Withdraw() Savings GetInterest() Withdraw() Subclasses Superclass (parent) Ancestor Descendents Generalization Relationship

21  A class can inherit from several other classes FlyingThingAnimal AirplaneHelicopterBirdWolfHorse multiple inheritance

22  A subclass inherits its parent’s attributes, operations, and relationships  A subclass may:  Add additional attributes, operations, relationships  Redefine inherited operations (use caution)  Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy.

23 Order Product Ship via

24 CorporateIndividual TruckTrain Sale SalespersonCustomerVehicleProduct seller buyer Item sold Shipping mechanism

25 CorporateIndividualTruckTrainAirplane Suppose you need a new type of shipping vehicle … Sale SalespersonCustomerVehicleProduct seller buyer Item sold Shipping mechanism


Download ppt "Informática II Prof. Dr. Gustavo Patiño MJ 16- 18 12-09-2013."

Similar presentations


Ads by Google