CSC302 2007S, Class 19: Basics of Object-Oriented Programming Admin: * Due: HW5. * Wednesday and Friday, you will be watching videos in class. In lieu of reading response, please send me one-paragraph responses to those videos after you watch the videos. * Please help the Adm. Asst. set up the video. * The reading for Monday the 12th is a long online document. See the link in today's page (and elsewhere) * About citation. * The Mid-Semester Exam is ready. Overview: * What is object-oriented programming? * Three key issues: Encapsulation, Inheritance, Polymorphism. * Why OOP? * A biased history. * Polymorphism vs. Overloading. /About Citation/ * This is an incorrect URL http://urlcollector.org?istolethisfrom=http://www.wikipedia.org/eng/polymorphism * This is not a citation. "Taken from Wikipedia" * This is not a citation, but it's better. http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29 * This is not a citation, but it's better http://en.wikipedia.org/wiki/Polymorphism_%28computer_science%29 (Dated ___; Visited ___) * Ideally, you keep a copy, too. * This is a citation AUTHOR (YEAR). TITLE. Online resource at URL (Dated ___; Visited: ___). Related issue: Give author names, quotes, and pages, when referring to papers "The author of the first paper claims that object-oriented programming is useless." "On p. 5 of "Why Scheme Rules", J. Fred Schemer notes that "Every design pattern is automatic in Scheme, so why would anyone use OOP?"" /Finally! What is OOP/ * 3.5 main paradigms of language design: * Imperative - * Emphasizes side effects: Moving values to and from memory * Sequenced * Declarative * Say what you want, not how to compute it * grep: grep "^[^a-z]" foo.txt * SQL: select F.foo,B.bar from F,B where F.baz=B.bam * Prolog: * Pure functional programming (+ 0.5) (define (foo x) (bar (baz x) (bam x))) * Object-oriented * 'Everything' is an object vs. "the building blocks of the program" * An object has data and methods to manipulate the data Why OOP? * Good for software engineering * Encapsulation helps segment concerns - Modfiication of one object should not affect others, as long as the "interface" is maintained * Inheritance and Polymorphism make programmers more efficient * Pointy-haired bosses like buzzwords?