Penn CIS 500 - Lecture Notes (75 pages)

Previewing pages 1, 2, 3, 4, 5, 35, 36, 37, 38, 39, 71, 72, 73, 74, 75 of 75 page document View the full content.
View Full Document

Lecture Notes



Previewing pages 1, 2, 3, 4, 5, 35, 36, 37, 38, 39, 71, 72, 73, 74, 75 of actual document.

View the full content.
View Full Document
View Full Document

Lecture Notes

62 views

Lecture Notes


Pages:
75
School:
University of Pennsylvania
Course:
Cis 500 - Software Foundations.

Unformatted text preview:

CIS 500 Software Foundations Fall 2006 November 27 Recap Last week The lectures last week developed a series of increasingly sophisticated examples of OO style programming in a typed lambda calculus Multiple representations All the objects in all the examples have type Counter and sometimes more specific types But their internal representations vary widely Encapsulation An object is a record of functions which maintain common internal state via a shared reference to a record of mutable instance variables This state is inaccessible outside of the object because there is no way to name it Lexical scoping ensures that instance variable records can only be named inside the methods Subtyping Subtyping between object types is just ordinary subtyping between types of records of functions Functions like inc3 that expect Counter objects as parameters can safely be called with objects belonging to any subtype of Counter Inheritance Classes are data structures that can be both extended and instantiated We modeled inheritance by copying implementations of methods from superclasses to subclasses Each class I waits to be told a record r of instance variables and an object this which should have the same interface and be based on the same record of instance variables I uses r and this to instantiate its superclass I constructs a record of method implementations copying some directly from super and implementing others in terms of this and super The this parameter is resolved at object creation time using fix Where we are The essence of objects I Dynamic dispatch I Encapsulation of state with behavior I Behavior based subtyping I Inheritance incremental definition of behaviors I Access of super class I Open recursion through this What s missing wrt Java say We haven t really captured the peculiar status of classes which are both run time and compile time things we ve captured the run time aspect but not the way in which classes get used as types in Java Also not named types with



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?