Object Oriented Analysis and Design
module 03
Dr Abu-Eesa
Islamic Online University
Module 03
Treating everything as an object…
Everything has a class!
Caution using __init__
Instance attributes and methods
Static methods
Class methods
Inheritance
Abstract Classes
Inheritance and the LSP
Summary
Treating everything as an object…
def:Defines things
class: define class
What is a class: logical grouping of data and functions
Everything has a class!
Customer example
self
__init__
Caution using __init__
Instance attributes and methods
We said functions within a class called a “method”
Methods can access all data within on the instance of the object,
anything set on self can be accessed and modified
Due to being set on self, they must be instance of the class to be used
Hence often called “instance methods”
Static methods
Class attributes: class level
Class methods
Variant of static method
Passed to the class rather than receiving the instance as the first
parameter
Defined using a decorator
Inheritance
Parent class
Child class: has everything parent has and we can add more
Abstract Classes
Vehicle not real world object!
It is a concept that some real world objects embody
Inheritance and the LSP
To summarise…
UML Diagrams
Unified modelling language -- A Notation for Describing Object-Oriented
Systems
Structure diagrams
Behaviour diagrams
Interaction diagrams
Structure Diagrams
Class diagrams
Composite structure diagrams
Component diagrams
Deployment diagrams
Object diagrams
Package diagrams
Behaviour Diagrams
Activity
Use case diagrams
State machine diagrams
Interaction Diagrams
Sequence diagrams
Timing diagrams
Communication diagrams
Interaction overview diagrams