IS0514 Lecture Week 5 - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

IS0514 Lecture Week 5

Description:

Exercise 1 Think about the objects in this room. ... seats The handouts Computer Projector ... Objects can be related Student completes Assignment ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 25
Provided by: IZTP1
Category:

less

Transcript and Presenter's Notes

Title: IS0514 Lecture Week 5


1
IS0514 Lecture Week 5
  • Introduction to Object Orientation

2
Why Object Oriented?
  • Based on domain analysis / subject matter
    analysis
  • Close match to real world
  • Nearly all Modern Technologies are Object
    Oriented
  • Java / C / C / PHP (object extension) / Delphi
  • Oracle Object relational database
  • gt closer match to end solution
  • Widely accepted ( most common approach )
  • Extensible / Maintainable
  • Reusable

3
Today's Lecture
  • Introduction to object orientation concepts
  • Object
  • Class
  • Method
  • Attribute
  • Relationships
  • Inheritance

4
What is the world?
  • The world can be seen to consist
  • Things
  • Relationships between things
  • A thing can be
  • Physical / Tangible
  • Idea / Concept / Non-Tangible
  • In object orientation a thing is called an Object
  • Thing-Oriented Analysis!

5
Exercise 1
  • Think about the objects in this room.
  • Try to identify the objects in this room
  • What things are here
  • Physical
  • Conceptual / Ideas
  • In groups of 3-4 spend 5 minutes discussing what
    objects there are. At the end of that time you
    will be asked to share your thoughts with the
    rest of the class.

6
Exercise 1 - Possible Objects
  • Physical
  • The lecturer
  • Each of the students
  • Each of the seats
  • The handouts
  • Computer
  • Projector
  • Crisps / Chocolate / Cans
  • Each of the Mobile phone switched off or silent!
  • Ideas
  • The lecture itself
  • Exercise 1
  • Lecture slide

7
Attributes and behaviour
  • Objects have properties called attributes
  • Attributes are the data associated with an object
  • Objects have behaviour we call these methods
  • These are the tasks an object will do (typically
    when we ask it to)
  • These may also be called operations / member
    functions but we will try and call them methods
  • Example A Car
  • Attributes
  • Make
  • Model
  • Engine Size
  • Current Speed
  • Methods
  • break()
  • accelerate()
  • changeGear()
  • honkHorn()

8
Exercise 2
  • Think about the object a student
  • Try an identify its
  • Attributes
  • Methods
  • Think about which of these are relevant as regard
    to the university?
  • In groups of 3-4 spend 5 minutes discussing this.
    At the end of that time you will be asked to
    share your thoughts with the rest of the class.

9
Exercise 2 - Solution
  • Attributes
  • Name
  • Registration Number
  • Date of Birth
  • Gender
  • Address
  • Programme
  • etc
  • Methods
  • AttendLecture()
  • AttendSeminar()
  • CompleteAssignment()
  • SitExam()
  • etc

10
Categories of things
  • Things naturally fall into categories (Car,
    Furniture, House)
  • In object orientation, a category of things is
    called a class
  • an object is an instance of a class
  • my car gt object Car gt class
  • Objects share behaviour as defined by their class
    respond to the same set of methods
  • For example all cars can accelerate
  • Some value(s) can affect what a method does
  • Objects share Class attributes e.g. every car has
    a colour
  • Object attributes will have different values

11
Exercise 3
  • Think about the objects in the room and try to
    identify what classes these objects belong to.
  • In groups of 3-4 spend 5 minutes discussing this.
    At the end of that time you will be asked to
    share your thoughts with the rest of the class.

12
Exercise 3 - Possible Classes
  • Physical
  • Person
  • Lecturer
  • Student
  • Seat
  • Furniture
  • Handout
  • Computer
  • Projector
  • Ideas
  • Lecture
  • Exercise

13
Classes and Objects more formally
  • Class Template to define specific instances or
    objects
  • Object Instantiation of a class
  • Attributes Describes each object
  • Behaviors Specify what each object can do
  • Methods (a.k.a. operations)

14
Classes and Objects
15
Methods and Messages
  • Methods implement objects behavior
  • Analogous to a function or procedure
  • Messages are sent to trigger methods
  • Procedure call from one object to another object

16
Messages and Methods
17
Relationships between Classes
  • Classes / Objects can be related
  • Student completes Assignment
  • Student is registered for a Module
  • Student has access to the Blackboard
  • Some relationships are stronger than others
  • Student is a kind of Person
  • Lecturer is a kind of Person
  • Inheritance
  • Is a generalisation / specialisation relationship
    between two classes
  • Is a kind of relationship

18
Class Hierarchy
19
Exercise 4
  • Think about the class hierarchy between Person,
    Student, Lecturer, Full Time Student and Part
    Time Student.
  • Draw the class hierarchy
  • In groups of 3-4 spend 5 minutes discussing this.
    At the end of that time you will be asked to
    share your thoughts with the rest of the class.

20
Exercise 4 - Class Hierarchy
Person
Lecturer
Student
PartTimeStudent
FullTimeStudent
21
Inheritance some terms
  • Superclasses or general classes are at the top of
    a hierarchy of classes
  • Subclasses or specific classes are at the bottom
  • Subclasses inherit attributes and methods from
    classes higher in the hierarchy
  • In our tree, which are the subclasses and
    superclasses?

22
Inheritance
23
Basic Characteristics of Object Oriented Systems
  • Classes and Objects
  • Methods / Messages
  • Inheritance
  • THE BASICS OF OBJECT ORIENTATION
  • Next Week Class Diagrams

24
This weeks reading
  • ESSENTIAL READING
  • Dennis A, Wixom B, and Tegarden D (2005) System
    Analysis and Design with UML version 2 second
    edition, Wiley
  • Pages 23-29
  • Further reading
  • Bennett, S., McRobb, S. and Farmer, R. (2002)
    Object-Oriented Systems Analysis and Design using
    UML, 2nd Edition, McGraw-Hill
  • Chapter 4
Write a Comment
User Comments (0)
About PowerShow.com