I. What is Object Oriented Programming?
 

1.1 Examples:

1.2 Procedural programming vs. Object oriented programming:
 
C MODSIM III 
job=reportposition; 
car54position=task(car54,job); 
                            /|\  
                        action 
task(car54,job) 
 
   if(job.eq.reportposition) 
       x=position(car54); 
   else 
       x= ...; 
   return x;  
}
ASK Car54  TO  ReportPosition 
             /|\                     /|\ 
        object             method 
                                     /|\ 
                       one of several methods 
 

Note: object includes methods (functions) and fields (data).  

In this case field of object is hidden, it is the 
value returned by method.

  1.3. More examples :
 
MODSIM III statement: Explanation:
ASK Vehicle TO Stop 
ASK Aircraft TO Stop 
ASK Bike TO Stop 
ASK Boat TO Stop 
           /|\            /|\ 
      object    method 
Object's stop method sets speed field value to 0. 
Different objects can be given same generic method, but different behavior 
 
 
CarSpeed  :=   ASK  Vehicle speed 
       /|\                            /|\           /|\ 
field of object1      object2   field
Field value of another object can be obtained through statement 
 
 

1.4. Characteristics:

1.5. Questions:
  1. What is the characteristics of object oriented language?
  2. What is the object, method and field in the following MODSIM III statements?

  3. TELL truck TO ProceedTo(NUS);
    ASK ranGen TO SetSeed(randSeed);
    ASK Singaporeair20 position;
    OBJECT Rocket;  TELL METHOD launch(speed, orientation);