Object Oriented Programming

Next

mailto:legan@acm.org












































Quick Pointers

Previous Next




































Vectored Execution


    "Vectored exectution is the apex of Object Oriented Programming"
                                  - "Swami",
                                     UCLA Extension,
                                     USC ISC

Previous Next































How to Vector in Perl


package  SwitchConfig  ;    #  package == name space == class

sub  new  {

  my $pkg  =  shift  ;
   
  $rtsdo  =  [ reference to some data object ]  ;  # define 'attributes'

  bless $rtsdo,   $pkg  ;  #  'ref' operator accessor method to object type
  
  #  return $rtsdo  ;  # redundant, 'bless' returns reference, 
}                      #  and is last statement of function, value returned

sub whatever   {    #  define the 'methods' down here
my $self  =  shift  ;
    ..........$self->{some data object.....}
..............
}

1  ;

Previous Next




























Using the Object


package  main  ;

$anobject  =  new SwitchConfig(...)  ;
 
............$anobject->whatever(....)  ;

Previous Next






























Original Program - Generate a Kermit Script


           (Flat File "Database")
                     |
                     |-----(Command Line Parameters)
                     |
                (Perl Script)
                     |
                     |
                Kermit Script Output

Previous Next































Second Generation Program - Generate a Kermit Script SNMP Message Format


           (Flat File "Database")
                     |
                     |-----(Command Line Parameters)
                     |
                (Perl Script - organize data
                     |
Kermit module--->Perl Script - write script)
                     |
                     |
                Kermit Script Output

Previous Next






























Third Generation Program - Generate a Kermit or Perl Script


           (Flat File "Database")
                     |
                     |-----(Command Line Parameters)
                     |
                (Perl Script - organize data
                     |
Kermit module--->Perl Script - write script)     (switch specific module)
Perl script module-->|                                    |
                     |                               (Perl script) 
                     |
                Kermit/Perl Script Output

Previous Next


































Fourth Generation Program - Generate a Kermit or Perl Script


           (Flat File "Database")
                     |
                     |-----(Command Line Parameters)
                     |
                (Perl Script - organize data
                     |
Kermit module--->Perl Script - write script)         (switch specific module)
Perl script module-->|                              /           |
Perl action module-->|                             /      (Perl Script)
                     |                            /
                Kermit/Perl Script / Perl Action
                   Output

Previous Next




























Object Oriented Programming Gets You........


  # This:
    $obj->method(..)  ;     #  object ~  case

  # Instead of cluttering up program with:
     if( 'case1' == $case ) {      #  strings of cases == need for OOP
        $method1(..)  ;
     } elsif( 'case2' == $case ) {
        $method2(..)  ;
     } elsif( 'case3' == $case ) {
        $method3(..)  ;
     }

mailto:legan@acm.org

Valid HTML 4.01!