Object Oriented Modeling David Li CTO, DigitalSesame.

25
Object Oriented Modeling David Li CTO, DigitalSesame

Transcript of Object Oriented Modeling David Li CTO, DigitalSesame.

Page 1: Object Oriented Modeling David Li CTO, DigitalSesame.

Object Oriented ModelingObject Oriented Modeling

David Li

CTO, DigitalSesame

Page 2: Object Oriented Modeling David Li CTO, DigitalSesame.

Object Modeling is

• Fun

• Elegant

• Easy to understand

• Powerful

• Comprehensive

Page 3: Object Oriented Modeling David Li CTO, DigitalSesame.

Creating Beautiful Systems

• Introduce the concept of object orientation

• Introduce a design notation

• Introduce an analysis and design method

• Discuss implementation issues

Page 4: Object Oriented Modeling David Li CTO, DigitalSesame.

What you should take away

• A set of tools to help you solve problem

• A knowledge of what object orientation is about

• A way of solving problems

• An understanding of how to implement solutions in object oriented language

Page 5: Object Oriented Modeling David Li CTO, DigitalSesame.

Course Structure

• Module 1 – Object Oriented Concepts

• Module 2 – Object Modeling

• Module 3 – Dynamic Modeling

• Module 4 – Activity Modeling

• Module 5 – Functional Modeling

• Module 6 – Object Modeling Technique

• Module 7 – Design and Implementation

Page 6: Object Oriented Modeling David Li CTO, DigitalSesame.

Module 1 – Contents• Why object-orientation?• What an object is• Representing objects• Classes and instances• Inheritance• Encapsulation• Polymorphism• Aggregation

Page 7: Object Oriented Modeling David Li CTO, DigitalSesame.

The Faith

• Objects are a nature way of representing the real world in a computer system

• Objects are easy to understand

• Objects will revolutionize computer systems development

• Computer programs will become easy to understand and maintainable

Page 8: Object Oriented Modeling David Li CTO, DigitalSesame.

The Hope

• Costs will come down

• Timescales will not slip

• Maintenance will become easier

• System will meet expectations

Page 9: Object Oriented Modeling David Li CTO, DigitalSesame.

The Reality

• Object concepts underpin most modern software products

• Objects are simply a refinement of long established concepts

• The basic concept began as early as 1967 (Simula 67)

• The current idea matured in the early 1980’s (Smalltalk 80)

Page 10: Object Oriented Modeling David Li CTO, DigitalSesame.

Re-inventing the Wheel?

• Object methods use traditional software analysis and design approach but– They integrate approaches much better– They fit with computer languages much better– They are supported by software tools which can

generate the code for framework of the application

Page 11: Object Oriented Modeling David Li CTO, DigitalSesame.

The Object Model Is the Center

Object Object ModelModel

Dynamic Dynamic ModelModel

Functional Functional ModelModel

Activity Activity ModelModel

Page 12: Object Oriented Modeling David Li CTO, DigitalSesame.

Object Model

• Sits at the center

• Final repository of everything

• Starting point of the implementation

Page 13: Object Oriented Modeling David Li CTO, DigitalSesame.

What is an object?

• An object is anything in the real world– Can be tangible: chair, car, and person– Can be a process: workflow or schedule– Can be a relationship: contract– Can be theoretical: matrix

• Any Noun can a an object

• Objects are simplified view of real world artifacts

Page 14: Object Oriented Modeling David Li CTO, DigitalSesame.

Representing Object

• Object have names

• Objects have attributes which define their states

• Objects have operations which defines what can be done with them

Page 15: Object Oriented Modeling David Li CTO, DigitalSesame.

Picture of Objects

PersonPerson--------------------------------------

AgeAgeNameName

--------------------------------------Admit()Admit()

Examine()Examine()

NameName

AttributeAttribute

OperationOperation

Page 16: Object Oriented Modeling David Li CTO, DigitalSesame.

Attributes

• Data in the system

• Manipulated by operations

• Attributes of an objects are the only data which operations can access directly

• Attributes can be other objects (HAS)

Page 17: Object Oriented Modeling David Li CTO, DigitalSesame.

Operations

• Also called “Methods” or “Messages”

• Where the process is done

• Manipulate attributes with in a object

• Can called operations in related objects

• Send and receive information as parameter

Page 18: Object Oriented Modeling David Li CTO, DigitalSesame.

Classes and Instances• A collection of similar objects is called

a “Class”• All objects in a class have the same– Attributes– Operations

• Attributes of different objects of the same class may be different

• A object of a class is called an “instance” of the class

Page 19: Object Oriented Modeling David Li CTO, DigitalSesame.

Classes and Instances (Example)

• A set of all teachers is a class

• All teachers have a name, age, and gender

• All teacher can talk and teach

• Different teachers have different name, age and gender

Page 20: Object Oriented Modeling David Li CTO, DigitalSesame.

Inheritance

• Classes can be arranged in inheritance hierarchies

• A class inherits operations and attributes from its parent (super class)

• This is one of the underlying mechanisms for providing for code reuse

Page 21: Object Oriented Modeling David Li CTO, DigitalSesame.

Inheritance (Example)

PersonPerson

StudentStudent TeacherTeacher

CollegeCollege High SchoolHigh School

Page 22: Object Oriented Modeling David Li CTO, DigitalSesame.

Multiple Inheritance

PresidentPresident

Admin.Admin. TeacherTeacher

• A class can inherit from multiple super classes

Page 23: Object Oriented Modeling David Li CTO, DigitalSesame.

Encapsulation

• Only way to change object is through its operations

• Attributes and operations are encapsulated in one definition

• Easy control changes to data

• Change internal of an object with changing its behavior

Page 24: Object Oriented Modeling David Li CTO, DigitalSesame.

Advantage of Encapsulation

• Access to data is controlled– No illegal or accident change to data can be ma

de

• All operations on data are grouped together

Page 25: Object Oriented Modeling David Li CTO, DigitalSesame.

Polymorphism

• Operation of the same name can be override

• Single operation can perform differently on different object