Presentation on theme: "Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set."— Presentation transcript:
Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set of objects with common attributes and the services (operations) provided by each object Various object models may be produced –Inheritance models –Aggregation models –Interaction models http://java.sun.com/docs/books/tutorial/java/concepts/index.html
Computer Science Dept. Fall 2003 Object models Natural ways of reflecting the real-world entities manipulated by the system More abstract entities are more difficult to model using this approach Object class identification is recognised as a difficult process requiring a deep understanding of the application domain Object classes reflecting domain entities are reusable across systems
Computer Science Dept. Fall 2003 Inheritance models Organise the domain object classes into a hierarchy Classes at the top of the hierarchy reflect the common features of all classes Object classes inherit their attributes and services from one or more super-classes. these may then be specialised as necessary Class hierarchy design is a difficult process if duplication in different branches is to be avoided
Computer Science Dept. Fall 2003 Object-Oriented Programming Concepts What Is an Object? : An object is a software bundle of related variables and methods. Software objects are often used to model real- world objects you find in everyday life.What Is an Object? What Is a Message? : Software objects interact and communicate with each other using messages.What Is a Message? What Is a Class? : A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.What Is a Class?
Computer Science Dept. Fall 2003 Object-Oriented Programming Concepts… What Is Inheritance? : A class inherits state and behavior from its superclass. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs.What Is Inheritance? What Is an Interface? : An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface.What Is an Interface?
Computer Science Dept. Fall 2003 What Is a Class? In the real world, you often have many objects of the same kind. For example, your bicycle is just one of many bicycles in the world. Using object-oriented terminology, we say that your bicycle object is an instance of the class of objects known as bicycles. Bicycles have some state (current gear, current cadence, two wheels) and behavior (change gears, brake) in common. However, each bicycle's state is independent of and can be different from that of other bicycles.instance When building bicycles, manufacturers take advantage of the fact that bicycles share characteristics, building many bicycles from the same blueprint. It would be very inefficient to produce a new blueprint for every individual bicycle manufactured.
Computer Science Dept. Fall 2003 What Is a Class? In object-oriented software, it's also possible to have many objects of the same kind that share characteristics: rectangles, employee records, video clips, and so on. Like the bicycle manufacturers, you can take advantage of the fact that objects of the same kind are similar and you can create a blueprint for those objects. A software blueprint for objects is called a class.class Definition: A class is a blueprint, or prototype, that defines the variables and the methods common to all objects of a certain kind.
Computer Science Dept. Fall 2003 The Unified Modeling Language Devised by the developers of widely used object- oriented analysis and design methods Has become an effective standard for object- oriented modelling Notation –Object classes are rectangles with the name at the top, attributes in the middle section and operations in the bottom section –Relationships between object classes (known as associations) are shown as lines linking objects –Inheritance is referred to as generalisation and is shown ‘upwards’ rather than ‘downwards’ in a hierarchy
Part of a Library class hierarchy Name of object class Class attributes Object’s operations
Computer Science Dept. Fall 2003 Object aggregation Aggregation model shows how classes which are collections are composed of other classes Similar to the part-of relationship in semantic data models
Computer Science Dept. Fall 2003 Object aggregation
Computer Science Dept. Fall 2003 Object behaviour modelling A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a use- case Sequence diagrams (or collaboration diagrams) in the UML are used to model interaction between objects
Computer Science Dept. Fall 2003 Issue of electronic items