Object Oriented Modeling David Li CTO, DigitalSesame
Jan 20, 2016
Object Oriented ModelingObject Oriented Modeling
David Li
CTO, DigitalSesame
Object Modeling is
• Fun
• Elegant
• Easy to understand
• Powerful
• Comprehensive
Creating Beautiful Systems
• Introduce the concept of object orientation
• Introduce a design notation
• Introduce an analysis and design method
• Discuss implementation issues
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
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
Module 1 – Contents• Why object-orientation?• What an object is• Representing objects• Classes and instances• Inheritance• Encapsulation• Polymorphism• Aggregation
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
The Hope
• Costs will come down
• Timescales will not slip
• Maintenance will become easier
• System will meet expectations
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)
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
The Object Model Is the Center
Object Object ModelModel
Dynamic Dynamic ModelModel
Functional Functional ModelModel
Activity Activity ModelModel
Object Model
• Sits at the center
• Final repository of everything
• Starting point of the implementation
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
Representing Object
• Object have names
• Objects have attributes which define their states
• Objects have operations which defines what can be done with them
Picture of Objects
PersonPerson--------------------------------------
AgeAgeNameName
--------------------------------------Admit()Admit()
Examine()Examine()
NameName
AttributeAttribute
OperationOperation
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)
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
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
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
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
Inheritance (Example)
PersonPerson
StudentStudent TeacherTeacher
CollegeCollege High SchoolHigh School
Multiple Inheritance
PresidentPresident
Admin.Admin. TeacherTeacher
• A class can inherit from multiple super classes
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
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
Polymorphism
• Operation of the same name can be override
• Single operation can perform differently on different object