Objects and their properties.

Objects and their properties

DESIRABLE PROPERTIES OF COMPONENTS

Each subsystem or component must

• Have clearly defined responsibility

• Act when requested by an "order"

How the component does its task need not be known to other components

• What the component does should be known

• Components must be general enough to be reusable

• Variety of components should be reduced-this is facilitated by allowing components to inherit properties of other components

• Another aid to generalize the function of a component is to allow generic commands which make components do their task. This is called POLYMORPHISM

OBJECT ORIENTED MODELLING

Use of component oriented design facilitates changes in the system at low cost, promotes reuse of components, problem of integrating components to configure large system will be simplified. It also simplifies design of distributed systems.

OBJECT AND THEIR PROPERTIES

• All tangible entities in an application can normally be modelled as objects For example: A student,a cycle,a train ticket

• Some intangible entities may also be modelled as objects For example: a bank account, stack data structure

• Objects with similar meaning and purpose grouped together as CLASS. And a member of a class is an object instance.

CHARACTERSTICS OF OBJECTSimage

CLASS DIAGRAM – UML NOTATION

Universal Modelling Language (UML) is an industry standard notation to represent a class

Example of UML notation for a Class

image

image

OPERATION TYPES ON OBJECTS

• Constructor-creating new instances of a class and deleting existing instance of class

Example : add new vendor

• Query - accessing state without changing value, has no side effects Example : find vendor address

• Update - changes value of one or more attributes & affect state of object Example : change address of vendor

Implementation of operations on objects called methods

IMPLEMENTATION OF CLASSES

TERMINOLOGY USED IN OBJECT ORIENTED MODELLING

ABSTRACTION Picking necessary operation and attributes to specify objects

ENCAPSULATION Hiding implementation details of methods from outside world, it is also known as information hiding. Information hiding allows improvement or modification of methods used by objects without affecting other parts of a system

VIEW OF OBJECTS AS CONTRACTORS

1) Objects can be thought of contractors who carry out assigned contracts for clients

2) Clients need not know how the contractor carries out its contracts

3) Contractors can modify/improve methods they use to carry out contracts without “informing” clients

4) External interface presented to clients remain same

INHERITANCE

New classes are created from current classes by using the idea of inheritance.They inherit attributes and/or operations of existing classes.

Inheritance allows both generalisation and specialisation in modelling Specialisation - given student class, arts students and science student are two subclasses, subclasses inherit properties of parents and in addition may have their own special attributes and operations.

EXAMPLE OF INHERITANCE

image

GENERALISATION/SPECIALISATION

Given a class Eye surgeon we can generalize it to surgeons which will inherit most of the attributes and operations of the eye surgeon A general class School, will inherit many properties of middle school, primary school Given a class Doctor we can obtain subclasses : Surgeon, Physician, General Practitioner, Consulting Doctor.All these will inherit many properties of doctor and will have their own new attributes and operations

POLYMORPHISM

By polymorphism we mean ability to manipulate objects of different distinct classes knowing only their common properties, Consider classes hospital & school For both the operation admit will be meaningful, but they will be interpreted differently by each class. Advantage of polymorphism is ease of understanding by a client. A client gives a generic request - each contractor interprets and executes request as appropriate to the circumstances

Comments

Popular posts from this blog

WORKED EXAMPLES ON PROCESS SPECIFICATION.

Why do we need information systems, management structure, requirements of information at different levels of management.

The User Interface:Establishing User Interfaces