Sie sind auf Seite 1von 4

Object oriented modelling

The object oriented approach is becoming popular because it supports effective representation of a real- world application, it can represent complex relationships, it can represent data and data- processing in a consistent notation. A object- oriented model is built with objects, where a ER- model (Entity- Relational model) uses entities. An object encapsulates data and behaviour, so the object- oriented model can be used for data- modelling and process- modelling. The phases of a object- oriented system development model The model steps from abstract, focusing at the external qualities of the system. To more and more detailed, and focusing on how the system will be built and how it should function. Analysis: develop a model of the real- world application showing its important properties. Abstract concepts from the applications domain and describe what the system will do, rather than how it will be done. Structure the requirements, and really understand them. It specifies the functional behaviour of the system, independent to the environment. Design: The design phases look at how the analyse- model will be implemented in its environment. What operations an object provides, what sort of communication between objects, what messages will be sent and so on. It makes an overall system architecture, organise the system into components called subsystems. Builds the model by adding implementations details, data structure, algorithms, and control. Implementation: Use a programming language and the database management system. Coad and Yourdon(19911b), identifies several motivations and benefits of object- oriented modelling for example: Improved communication between user, analysts, designers and programmers. The ability to solve more complex problem domains. The UML notation can be useful to graphically depict an OO- analysis or design model. Modelling the applications, some keywords and explanations. In a ER- model the entity can be seen as an object. But an object can store state and behaviour, that affect or examines the state. Class: is a sort of template describing how the objects will be created, and how the objects will be represented according to state and behaviour, the class are supposed to encapsulate the internal state. A class can be abstract, or concrete. A abstract class dont implements all or none of its methods. But it proposes that the children of the abstract class will implement it. A concrete class implements all of its methods. Object: an entity that has well- defined role in the application. It has state, behaviour and identity. A key part of the definition of an object a unique identity. In a n object- oriented system each object is assigned an OID (Object Identifier) when it is created. The OID is

13

system- generated and unique to that object. Once the object is created the OID will never be reused, even if the object is deleted. Its independent of the values of the attributes, and it should be invisible to the user. The Objects communicates by sending messages. A message is simply a request from one object to another object. An object sending message to another object dont have to know anything about the receivers internals state, and that is whats encapsulating is about. State: keeps an objects properties (attributes and relationships) and the values of the properties. Behaviour: how an object acts and reacts, the operations or methods an object provides. Theres three types of operations. - Constructor operations that creates a new instance of a class. - Query operation that accesses the state. - Update operations that alters the state of an object. The operation can also be abstract, it defines the form of a operation, but not the implementation. The methods can be overridden, when using inheritance. Class
Student Name dateOfBirth ... getAge() getDateOfBirth()

Objects
Steve: Student Name = Steve DateOfBirth = ...

Associations, or relationships A association is an relationship between object. The association can be unary. It can be binary, between two objects, and the relation can be ternary consisting of more than two objects. The relation can have different multiplicity that indicated how many objects participate in a given relationship. Unary relation: Is- married- to 0..1 Person

0..1 In a binary relationship the multiplicity between objects can be One- to- one, One- to- many and Many- to- many. A association between objects can have attributes and operations, here represented with a dashed line.

14

Student

* Registration ---------------grade getGrade()

Course

The association can be an aggregation, a- part- of relationship between objects. Also known as has- a or composition. For example the PC has- a CPU. Animal

Mammal

The OO- model expresses generalisation relationships using super- classes and subclasses. Car Boat

Amphibious

The inheritance can also be multiple. Inheritance is a very powerful mechanism because its support code reuse, and it provides polymorphism. Polymorphism is a key concept in OOsystems. There are three types of polymorphism operation, inclusion and parametric. A method defined in a super- class and inherited in its subclasses is an example of inclusion. Parametric or generic descriptions acts as a template for the later establishment of one or more different types. Overloading allows the name of a method be reused within a.) class definition or b.) across class definitions. a. This means that which method to be executed depends on what parameters are passed to the method. b. For example a super- class has a abstract method print(), and the subclasses has one print()- method to. The variable declared as the super- class can hold a value of one of the subclasses. Which print() method will be executed depends of what subclass- value the super-class variable holds.

15

Shape print()

Circle print()

Rectangle print()

The process of selecting the appropriate method based upon an objects type is call binding. There is static binding and dynamic binding. The static or early binding refers to binding performed at compile time. The dynamic binding refers to binding performed at run time, as in example b.) above.

16