OOConcepts

Uploaded from authorPOINTLite
Views:
 
Category: Education
     
 

Presentation Description

No description available.

Comments

By: waladunqadhi (27 month(s) ago)

Good ppt to use..please send this ppt to my email waladunqadhi@yahoo.com.

By: shanaka (28 month(s) ago)

The contents of you presentation really helped me... Please forward me the PPT file for educational purpose. email address: shanakad@gmail.com Thanks, Shanaka

By: ashish81_surat (28 month(s) ago)

good ppt thanks for uploding if possible, please send this ppt to my email address : ashish81_surat@yahoo.com

Presentation Transcript

Object Oriented Concepts: 

Object Oriented Concepts

Basic OO Terms: 

Basic OO Terms Objects Classes Class attributes Relationships Methods (Services) Encapsulation Polymorhpism Inheritance Reuse

Objects and Classes: 

Objects and Classes Object An abstract or concrete “thing”, an entity Each object instance must have a unique ID Attribute A property of an object Classes A groups of similar objects Have the same kind of attributes

Example Class: 

Example Class The Class of Automobile Objects Attritubtes Vehicle Identification Number Manufacturer Color Type (sedan, roadster, pickup, etc) Price Etc …

Example Object Instances: 

Example Object Instances VIN 8183764 Manu Ford Color Fuscia Type Pickup Price $28,000 VIN 132417 Manu Chevy Color Taupe Type Sedan Price $15,000

Relationships: 

Relationships Association (Connection) between classes 1:1, 1:M, M:N Whole – Part (Composition) The object is part of another object A cylinder head is part of a motor. Buttons, text boxes, etc. are part of a window. Have cardinality and optionality.

Class Methods or Services: 

Class Methods or Services Methods Procedures What an object knows how to do. Similar to functions in other languages. Used to model object behavior. Associated with classes. Thus, classes have both attributes and methods.

Automobile Class : 

Automobile Class Attritubtes VIN Manufacturer Color Type Price Methods (Services) Insert Update Delete

Encapsulation: 

Encapsulation Attributes and methods are packaged together. “Information hiding” Internal aspects are concealed or hidden. Objects are prevented from changing other objects.

Message Passing: 

Message Passing User and other objects send messages to objects. Objects can be told to perform a service (method). Can be told to change itself. May result from Clicking a button, Choosing from a list, etc. Calling a method

Polymorhpism: 

Polymorhpism Methods with the same name may do different things. Depends on the object class they are associated with. Accounting example: Real Property and Computer Equipment are two asset classes. Both have Methods called “Calculate Depreciation.” Real Property is depreciated on a straight-line basis Computer equipment uses sum of the year’s digits.

Hierarchies and Inheritance: 

Hierarchies and Inheritance Classes arranged in hierarchies of sub-classes and super-classes Attributes and methods are inherited by sub-classes Inherited properties may be over-ridden.

Automobile Class Hierarchy: 

Automobile Class Hierarchy Motor Vehicles # of Wheels Engine Automobiles 4 Wheels # of Doors Motorcycles 2 Wheels Sidecar Pickups Bed Length Local attributes Over-ridden

Accounting Class Hierarchy: 

Accounting Class Hierarchy Accounts Number Name Balance Liabilities Assets Depreciation Method Buildings Depreciation (Straight line) Computers Depreciation (Accelerated)

Insurance Policy Object: 

Insurance Policy Object Attributes: Policy Number Policy Type Owner Premium Method: Calculate Penalty

Slide16: 

Insurance Policies Home Flood Plain Date built Earthquake Date built Feet from source Surveyor Date built defined for all home policies. These attributes are local Date built Building material Last quake date Attribute Inheritance Inherited

Slide17: 

Insurance Policies Home Calculate age Calculate age Earthquake These mehtods are inherited These are local Calculate age Calculate penalty Flood Plain Calculate age Calculate penalty Method Inheritance

Slide18: 

Local Behaviors Insurance Policies Home Earthquake Calculate penalty $0.50 * (Days since last quake) Flood Plain Calculate penalty (100/Feet to source) * Appraised Value * .1 Local behaviors may have different characteristics.

Slide19: 

Polymorphism Insurance Policies Home Earthquake Flood Plain Calculate penalty (100/Feet to source) * Appraised Value * .1 Calculate penalty $0.50 * (Days since last quake) Calculate penalty message

Slide20: 

Benefits Encapsulation provides data independence. e.g., change an from integer to decimal type without affecting other objects. Inheritance provides a parsimonious environment. Polymorphism allows applications to be generic, removing the need for handling "special cases" with Case statements of If’s. Objects can be placed in a library for reuse.

Summary: 

Summary Objects entities Classes groups of similar objects Class attributes properties Relationships associations, part-whole Methods (Services) procedures Encapsulation data hiding Polymorhpism same method name,different proc. Inheritance properties passed to children Reuse object libraries