SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Object-Oriented Analysis and Design



          Introduction
Cutajar
  &
Cutajar
What is an Object?
          An object has…
             State
               ◦ Changes over time
             Behavior
               ◦ What the object does in response to messages
             Identity
               ◦ What makes the object unique
Cutajar
  &
Cutajar
State
          Not only do these people look different, they have different properties (also
          called attributes) that let us tell one from the other. Some of the properties
          that a person might have are name, age, height, and so on. Some of these,
          like age, might change (are mutable) and some, like name, might never
          change (are immutable)..



                            John                                 Maria
                            Age: 32                              Age: 35
                            Height: 6’ 2”                        Height: 5’ 10”
Cutajar
  &
Cutajar                     Jane                               Joe
                            Age: 21                            Age: 35
                            Height: 5’ 8”                      Height: 5’ 10”
Behavior
                sit!            Behavior is what the object can
                                do. That is, the effect of the
                                object responding to a message
                                or a call to a method.


                return BONE!     Some methods
                                 return something
                                 to the caller



Cutajar        eat(drumstick)
  &                                                  I said SIT!
Cutajar
                         Some methods
                         need something
                         from the caller
Identity




Cutajar
  &
Cutajar     Usually, one can tell one object from another through some
          combination of the properties. In fact, there MUST be some way
             of telling one object from another. Java uses the object’s
                                       address.
Classes
             Define the properties and behavior of objects
             Can have behavior and properties that are defined in the class but are
              independent of the individual objects




Cutajar
  &
Cutajar
Inheritance                       Object-oriented languages support
                                               some type of inheritance. Many
                                               support inheritance from more
                                               than one parent class. This is
          Human (Super Class)
                                               called multiple inheritance. Java
            having common
                                               supports only single inheritance,
             attributes and
                                               but allows a class to implement
               behaviors
                                               multiple interfaces.



                                                                         Multiple
                                                                       inheritance
Cutajar
                                                                           not
  &                                                                     permitted
Cutajar      Male                                                        in Java
                                            Female              Baby


          Subclasses inherit common features and changes or adds some of their own
Interface




Cutajar
  &
Cutajar   A Class can implement
          various interfaces and
           must define methods
          used for that interface
Polymorphism
             Different type of objects can respond to the same message
             The actual method that executes is not determined until run time
              ◦ Dynamic (or late) binding
                                                    PLAY !




Cutajar
  &
Cutajar
Overloading
              The method which the object performs is determined by the type and
               number of parameters passed to it.


                                       play(radio)




Cutajar
  &                                                                   play(guitar)
Cutajar


          play(piano)
Overriding
                                    The method in a subclass
                                     hides the method in the
                                     super class. This permits a
                                     redefinition of a method
                 I know how it       according to the particular
                should be done       needs of the subclass


            overriding                    overriding


          I know how                                   I know how
           boys do it.                                   girls do it.


Cutajar
  &
Cutajar
Encapsulation
          We are hiding the implementation details of
          a behavior. The way an object responds to
          a message is not exposed, just the fact
          that it can respond and the result type
          (response). One of the biggest advantages
          of O-O is the ability to make changes to an
          object’s implementation without affecting
          other parts of the program.

                                    How did he do
                                       that ?
Cutajar
  &
Cutajar

Contenu connexe

En vedette

Hydrologic Design of a Percolation Tank
Hydrologic Design of a Percolation TankHydrologic Design of a Percolation Tank
Hydrologic Design of a Percolation TankC. P. Kumar
 
Topic11 sortingandsearching
Topic11 sortingandsearchingTopic11 sortingandsearching
Topic11 sortingandsearchingGopi Saiteja
 
Relational Database Examples
Relational Database ExamplesRelational Database Examples
Relational Database ExamplesJohn Cutajar
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating SystemsJohn Cutajar
 
Installing virtual box and windows server 2008 R2
Installing virtual box and windows server 2008 R2Installing virtual box and windows server 2008 R2
Installing virtual box and windows server 2008 R2Anna Hristova
 
Inheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingInheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingArslan Waseem
 
Inheritance in oops
Inheritance in oopsInheritance in oops
Inheritance in oopsHirra Sultan
 

En vedette (20)

Minimum Energy Performance Standards for Boilers in India
Minimum Energy Performance Standards for Boilers in IndiaMinimum Energy Performance Standards for Boilers in India
Minimum Energy Performance Standards for Boilers in India
 
Online Efficiency Monitoring and Diagnostics in Coal Fired Boiler
Online Efficiency Monitoring and Diagnostics in Coal Fired BoilerOnline Efficiency Monitoring and Diagnostics in Coal Fired Boiler
Online Efficiency Monitoring and Diagnostics in Coal Fired Boiler
 
New Technologies in Process Heating
New Technologies in Process HeatingNew Technologies in Process Heating
New Technologies in Process Heating
 
Relational
RelationalRelational
Relational
 
SImple SQL
SImple SQLSImple SQL
SImple SQL
 
Databases
DatabasesDatabases
Databases
 
Case Studies on CFBC Boilers
Case Studies on CFBC BoilersCase Studies on CFBC Boilers
Case Studies on CFBC Boilers
 
Developments in Industrial Boilers, WHR and Power Boilers
Developments in Industrial Boilers, WHR and Power BoilersDevelopments in Industrial Boilers, WHR and Power Boilers
Developments in Industrial Boilers, WHR and Power Boilers
 
Indigenization of Russian Make WHR by Vizag Steel
Indigenization of Russian Make WHR by Vizag SteelIndigenization of Russian Make WHR by Vizag Steel
Indigenization of Russian Make WHR by Vizag Steel
 
Boiler Water Treatment for LP,MP and HP Boiler
Boiler Water Treatment for LP,MP and HP BoilerBoiler Water Treatment for LP,MP and HP Boiler
Boiler Water Treatment for LP,MP and HP Boiler
 
Hydrologic Design of a Percolation Tank
Hydrologic Design of a Percolation TankHydrologic Design of a Percolation Tank
Hydrologic Design of a Percolation Tank
 
Topic11 sortingandsearching
Topic11 sortingandsearchingTopic11 sortingandsearching
Topic11 sortingandsearching
 
Relational Database Examples
Relational Database ExamplesRelational Database Examples
Relational Database Examples
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating Systems
 
Boiler Superheater Design Modification
Boiler Superheater Design ModificationBoiler Superheater Design Modification
Boiler Superheater Design Modification
 
Efficient steam systems - Generation to WHR
Efficient steam systems - Generation to WHREfficient steam systems - Generation to WHR
Efficient steam systems - Generation to WHR
 
Virtualbox
VirtualboxVirtualbox
Virtualbox
 
Installing virtual box and windows server 2008 R2
Installing virtual box and windows server 2008 R2Installing virtual box and windows server 2008 R2
Installing virtual box and windows server 2008 R2
 
Inheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingInheritance, Object Oriented Programming
Inheritance, Object Oriented Programming
 
Inheritance in oops
Inheritance in oopsInheritance in oops
Inheritance in oops
 

Oop principles

  • 1. Object-Oriented Analysis and Design Introduction Cutajar & Cutajar
  • 2. What is an Object? An object has…  State ◦ Changes over time  Behavior ◦ What the object does in response to messages  Identity ◦ What makes the object unique Cutajar & Cutajar
  • 3. State Not only do these people look different, they have different properties (also called attributes) that let us tell one from the other. Some of the properties that a person might have are name, age, height, and so on. Some of these, like age, might change (are mutable) and some, like name, might never change (are immutable).. John Maria Age: 32 Age: 35 Height: 6’ 2” Height: 5’ 10” Cutajar & Cutajar Jane Joe Age: 21 Age: 35 Height: 5’ 8” Height: 5’ 10”
  • 4. Behavior sit! Behavior is what the object can do. That is, the effect of the object responding to a message or a call to a method. return BONE! Some methods return something to the caller Cutajar eat(drumstick) & I said SIT! Cutajar Some methods need something from the caller
  • 5. Identity Cutajar & Cutajar Usually, one can tell one object from another through some combination of the properties. In fact, there MUST be some way of telling one object from another. Java uses the object’s address.
  • 6. Classes  Define the properties and behavior of objects  Can have behavior and properties that are defined in the class but are independent of the individual objects Cutajar & Cutajar
  • 7. Inheritance Object-oriented languages support some type of inheritance. Many support inheritance from more than one parent class. This is Human (Super Class) called multiple inheritance. Java having common supports only single inheritance, attributes and but allows a class to implement behaviors multiple interfaces. Multiple inheritance Cutajar not & permitted Cutajar Male in Java Female Baby Subclasses inherit common features and changes or adds some of their own
  • 8. Interface Cutajar & Cutajar A Class can implement various interfaces and must define methods used for that interface
  • 9. Polymorphism  Different type of objects can respond to the same message  The actual method that executes is not determined until run time ◦ Dynamic (or late) binding PLAY ! Cutajar & Cutajar
  • 10. Overloading  The method which the object performs is determined by the type and number of parameters passed to it. play(radio) Cutajar & play(guitar) Cutajar play(piano)
  • 11. Overriding  The method in a subclass hides the method in the super class. This permits a redefinition of a method I know how it according to the particular should be done needs of the subclass overriding overriding I know how I know how boys do it. girls do it. Cutajar & Cutajar
  • 12. Encapsulation We are hiding the implementation details of a behavior. The way an object responds to a message is not exposed, just the fact that it can respond and the result type (response). One of the biggest advantages of O-O is the ability to make changes to an object’s implementation without affecting other parts of the program. How did he do that ? Cutajar & Cutajar