1 / 14

Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming

Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming. PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer Video presenations Review questions. OOP: Early History.

Download Presentation

Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Guided NotesCh. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer Video presenations Review questions

  2. OOP: Early History • OOP languages began in the 1960s with Simula project (extend Algol60 for simulation) => Simiula67 • Simula67’s influence took 2 different directions: • Abstract data type (classes) • Object paradigm (program = a collection of interacting independent objects) => Smalltalk-80

  3. OOP: Development • Beginning in the mid-1980s, object-oriented programming => a language paradigm and a methodology for program design • Extremely effective mechanism for promoting code reuse and modifiability => dominant paradigm for large software projects

  4. Major concepts of OOP • Address to 3 issues in software design: • Need to reuse software component as much as possible • Need to modify program behavior with minimal changes to existing code • Need to maintain the independence of different components • Abstract data type vs. OOP – improved solution to above design problems

  5. Five Basic OOP Elements • Extension of the data and/or operations • Restriction of the data and/or operations (info hiding, encapsulation, protection) • Redefinition of one of more of the operations • Abstraction (abstract method) • Polymorphism (overloading and overriding)

  6. Code centric and data centric • Procedure language (code centric) – code the application in functions/procedures using parameter passing sent in/out data. Function does the transformation – data and function separation • OOP language (data centric) – objects, which represent their data internally, contain functionality called methods – data and behavior exist together  less thinking and better organized

  7. Terminology of OOP • Encapsulation: the only code that changes an object’s data structure is in the class  easier maintenance • Inheritance: a way of defining a new class by saying that it’s like an existing class

  8. Polymorphism • An OO feature that gives us the ability to treat an object in a generic manner. • Invoke a behavior on existing classes for any new classes with extension and leave the details and differences to the interpreter at run time • Different classes can have different behaviors for the same operation (PHP book page 130 example: display())

  9. Overloading and Overriding • Overriding – fancy kind of polymorphism is resolved at runtime. It occurs when one class extends another, and the subclass has a method in the super-class. The reason for“fancy” is that you can’t tell until run time. • Overloading – trivial kind of polymorphism, resolved by the compiler at compile time. Overloading allows several methods to have the same name, and the compiler will choose by matching on argument type

  10. 3 levels of Name Spaces • Must put a $this -> keyword in front of the member name (differs from Java or C++ where is optional, $this keyword tells PHP the variable from the object’s name space) • 3 levels of name spaces: • Lowest level for local variable inside functions or methods • Middle level for the members of an object • Highest level for global variables

  11. Abstract method • A method contains no code and implementer of any possible subtypes must implement the behavior for that method • Show PHP book Example page 131-132 • The class-function call operator – ClassName::functionName( ); (page 132 bottom)

  12. PHP’s Limitations • No static members (like a global variable but it is tied to class name space) • No Destructors for PHP 4 (clean up when script is finished executing) • No multiple inheritance

  13. PHP for this week and Assignment 4 • PHP include files • Language reference: • Classes and objects • Control structures – include, require • Chapter 5 of PHP book

  14. Review Questions • How Simula67 influenced programming language development? • What are the 3 software design issues that motivate OOP development? • What are the major difference between procedure oriented programming and object oriented programming? • OOP terminology: Encapsulation, Inheritance, Polymorphism, abstract method

More Related