Post on 12-Feb-2016
description
transcript
Object-Oriented Development Concepts
Slides by Emmanuel Owusu-Oware, CAD, UGBS
Lecture by: Dr. Boateng Email: Richard@pearlrichards.org
Learning Objectives
Understanding of Object-Oriented concepts/terminologies
Introduction to Unified Modelling Language (UML)
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/232
Introduction
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/233
Introduction
Object Oriented Development (OOD) presents a different perspective, philosophy, mindset to software development: View of applications as objects Objects do things: behaviour , methods, Objects have things: attributes or characteristics Example: A traffic light
Object: A traffic lightCharacteristic: Colour [Red, Yellow, Green]Behaviour: Turn_red
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/234
Introduction
Object-Oriented Development vs. Process-Oriented/ Structured Development: The Difference
OOD SD1. Focus is on Objects, their associated Data and the Actions they perform.
2. The software is modelled on the following elements of objects:•Characteristics/Attributes /Properties•Behaviors /Operations /Methods•Relationships/Associations
1. Focus is on functionality
2. The software is modelled on the following elements
Data Functions and proceduresFunctional decomposition / modularization
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/235
Introduction
OOD Strengths Easier Development
OOD uses a model that have closer representation of real-world situations
OOD uses smaller independent units Maintainability – quicker and easier
changes affecting an object will not require change to other parts of the software
A fault could be identified with the object that is responsible
OOD uses smaller independent units
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/236
IntroductionOOD Strengths (contd.) Rapid application development, i.e. shorter
development life-cycle Through the reuse of object implementations Shorter life-cycle - Schach (2002) (see next slide)
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/237
Introduction
OOD WeaknessOne weakness that OOD had was that there was no universally accepted standards in development methodology and tools. This is no longer the case with the emergence and acceptance of UML (Unified Model language).
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/238
Object-Oriented Development Concepts
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/239
What is an Object?
Definition: An object is a self-contained unit with well-defined characteristics (properties or attributes) and behaviours (operations) – Tsang et al (2005).
Example: A student in a school. Object: A Student Attributes/Characteristics: Name, Age Behaviour/Operation: Writes exams
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2310
Object Concepts The object behaviour is a set of operations that it
performs to meet the system goal. An operation is a function or procedure through
which other objects access an object’s data. The collection of operations is the object’s
interface. Other objects access the object’s operations through the interface
Example: The book class in the Library system have the operations :
borrow (book), return ( book), getBookStatus()
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2311
Object Concepts An object has many states. It can be in one state at
a time. The state is represented by values of the properties or attributes:
Example: Book – [Borrowed, Available, On Order] Types of Objects
Domain Objects (real-world entities)Physical (Tangible): E.g. BookConceptual (Intangible): E.g. Bank Account
Implementation Objects (software object)E.g. : Transaction log file which is used for error
recovery
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2312
A Class and Instance
Definition: A class is an abstraction of real-world entity that captures and specifies the properties and behaviours essential to the system but hides those that are irrelevant. - Tsang et al (2005).
A class is a generic definition for a set of similar objects.
An object is an instance of a class. A class has methods and attributes while object
instances have behaviours and states.
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2313
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2314
A Class and Instance
An attribute is a property of a class. Attributes have a name and a value and may also
have a type e.g. Integer or Boolean. Illustration:
Class: Name: Book Properties: ISBN, Title, Author(s)
Instances: Title: Structured Engineering Title: Advance VB.Net Programming
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2315
Inheritance, Generalisation and Specialisation Inheritance refers to the derivation of a new
class (sub-class) from an existing class (base or super-class).
Employee
Manager Clerk
Base class
Sub-class
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2316
Inheritance, Generalisation and Specialisation
Through inheritance, the sub-class acquires all the attributes (properties) and methods of the base class in addition to its specialised properties and methods.
It also allows code reuse and thus faster application development and extensibility of the software system.
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2317
Inheritance, Generalisation and Specialisation
Inheritance allows generalisation and specialisation associations :
Generalisation distributes the commonalities from the super class (general/bases class) among a group of similar sub-classes (specialised class). The subclass inherits all the super-class’s operations and attributes.
Specialisation allows subclasses to extend the functionalities of their super class by introducing new operations and attributes.
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2318
Inheritance, Generalisation and Specialisation
Persons
Students Employees
Faculty Staff
Non-Teaching StaffTeaching staff
Superclass
Subclasses
Slides: Mr. Owusu-Oware | Lecture: Dr. Boateng 04/22/2319