Download presentation
Presentation is loading. Please wait.
1
Simon Woodworth 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 Every object is an instance of a class Every object has attributes and behaviours Class: Dog Object: Red Setter Object: Labrador Object: Terrier Object: Bulldog
4
A class is a collection of things (objects) with similar attributes and behaviours. For example: Dogs What is a Class? 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. It’s 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 Objects: An Example Class: Account Attributes: Name Number Balance Behaviours: Withdraw Lodge Object: Alice’s Account Attributes: Name = Alice Number = 04701 Balance = €1003.22 Behaviours: Withdraw Lodge Object: Bob’s Account Attributes: Name = Bob Number = 28804 Balance = €81.66 Behaviours: Withdraw Lodge
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 can’t 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.