Object Oriented Design - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Object Oriented Design

Description:

Attributes: Four wheels, engine, 3 or 5 doors. Behaviours: ... Front wheel drive. Max speed 115 mph. Behaviours (what it does): Accelerate. Turn. Stop ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 12
Provided by: test356
Category:

less

Transcript and Presenter's Notes

Title: Object Oriented Design


1
Object Oriented Design
  • What is it?
  • Why do it?Simon Woodworth, 19 August 2004

2
Introduction
  • Purpose of this presentation
  • Explain what Object-Oriented Design (OOD) is
  • Explain why it is important as a design and
    programming methodology
  • OOD is important because
  • It allows complex programming projects to be
    broken down into more mangeable sections
  • It reduces the cost of maintaining software

3
What is Object-Oriented Design?
  • It promotes thinking about software in a way that
    models how we think about the real world
  • It organises program code into classes of objects

Class Dog
  • Every object is an instance of a class
  • Every object has attributes and behaviours

4
What is a Class?
  • A class is a collection of things (objects) with
    similar attributes and behaviours.
  • For example
  • Dogs
  • Attributes Four legs, a tail
  • Behaviours Barking
  • Cars
  • Attributes Four wheels, engine, 3 or 5 doors
  • Behaviours Acceleration, braking, turning

5
What is an Object?
  • An object is a specific instance of a class
  • For example
  • Volkswagen is an instance of the Car class
  • Attributes (what it looks like)
  • Blue
  • Front wheel drive
  • Max speed 115 mph.
  • Behaviours (what it does)
  • Accelerate
  • Turn
  • Stop

6
In programming terms
  • A class is a section of program code that defines
    how to create and use a specific group of
    objects.
  • Its a template for creating new objects
  • An object is a specific instance of a class and
    has its own place in computer memory
  • Its attributes are stored as data values
  • Its behaviours are defined by program code
  • Every object is different even if they look
    exactly the same!
  • For example My blue Volkswagen is not the same
    as your blue Volkswagen

7
Classes and ObjectsAn Example
Object Alices Account AttributesName
AliceNumber 04701Balance 1003.22 Behaviours
WithdrawLodge
Class Account Attributes NameNumberBalance Beh
avioursWithdrawLodge
Object Bobs Account AttributesName
BobNumber 28804Balance 81.66 BehavioursWi
thdrawLodge
8
Why is this important?
  • It models how we view the real world
  • Humans tend to categorise what they see into
    groups
  • Even very small children do it
  • Reduces cost of software development
  • Large complex projects can be subdivided into
    classes
  • Reliability the workings of objects cant be
    interfered with
  • Classes can be reused in other projects
  • Classes can be maintained without rewriting other
    program code
  • Introduces new programming concepts
  • Encapsulation
  • Inheritance

9
Object Oriented Design Concepts
  • Encapsulation
  • We can hide how an object works from other parts
    of the program
  • Increases reliability because the internal
    workings of objects are protected from
    interference
  • Allows us to reuse objects in other programs
    because their behaviour and attributes are
    well-defined
  • Allows us to change the way an object works on
    the inside without changing the way it looks on
    the outside
  • Example Car Stereo
  • Standard case size and fittings, regardless of
    features
  • Can be upgraded without affecting rest of car

10
Object Oriented Design Concepts
  • Inheritance
  • We can create new classes of objects by
    inheriting attributes and behaviours from
    existing classes and then extending them
  • No need to reproduce or duplicate work done in
    creating original class
  • We can build hierarchies (family trees) of
    classes
  • Example Rally Car
  • Inherits properties of class Car
  • and extends class Car by adding a rollcage,
    racing brakes, fire extinguisher, etc.

11
Conclusion
  • Object Oriented Programming Languages
  • Java, C, Visual Basic .NET, C
  • Object Oriented Design allows us to create
    program code that is
  • Reusable
  • Adaptable
  • Maintainable
  • Reliable
Write a Comment
User Comments (0)
About PowerShow.com