DOC PREVIEW
Berkeley COMPSCI 61A - Lecture 14

This preview shows page 1-2-3-4-5-6-7-8-58-59-60-61-62-63-64-65-66-118-119-120-121-122-123-124-125 out of 125 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 125 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

61A Lecture 14Friday, September 30Friday, September 30, 2011The Story So Far About Data2Friday, September 30, 2011The Story So Far About DataData abstraction: Enforce a separation between how data values are represented and how they are used.2Friday, September 30, 2011The Story So Far About DataData abstraction: Enforce a separation between how data values are represented and how they are used.Abstract data types: A representation of a data type is valid if it satisfies certain behavior conditions. 2Friday, September 30, 2011The Story So Far About DataData abstraction: Enforce a separation between how data values are represented and how they are used.Abstract data types: A representation of a data type is valid if it satisfies certain behavior conditions. Message passing: We can organize large programs by building components that relate to each other by passing messages.2Friday, September 30, 2011The Story So Far About DataData abstraction: Enforce a separation between how data values are represented and how they are used.Abstract data types: A representation of a data type is valid if it satisfies certain behavior conditions. Message passing: We can organize large programs by building components that relate to each other by passing messages.Dispatch functions/dictionaries: A single object can include many different (but related) behaviors that all manipulatethe same local state.2Friday, September 30, 2011The Story So Far About DataData abstraction: Enforce a separation between how data values are represented and how they are used.Abstract data types: A representation of a data type is valid if it satisfies certain behavior conditions. Message passing: We can organize large programs by building components that relate to each other by passing messages.Dispatch functions/dictionaries: A single object can include many different (but related) behaviors that all manipulatethe same local state.2(All of these techniques can be implemented using only functions and assignment.)Friday, September 30, 2011Object-Oriented Programming3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behavior3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state•Each object has its own local state.3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state•Each object has its own local state.•Each object also knows how to manage its own local state, based on the messages it receives.3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state•Each object has its own local state.•Each object also knows how to manage its own local state, based on the messages it receives.•Several objects may all be instances of a common type.3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state•Each object has its own local state.•Each object also knows how to manage its own local state, based on the messages it receives.•Several objects may all be instances of a common type.•Different types may relate to each other as well.3Friday, September 30, 2011Object-Oriented ProgrammingA method for organizing modular programs•Abstraction barriers•Message passing•Bundling together information and related behaviorA metaphor for computation using distributed state•Each object has its own local state.•Each object also knows how to manage its own local state, based on the messages it receives.•Several objects may all be instances of a common type.•Different types may relate to each other as well.Specialized syntax & vocabulary to support this metaphor3Friday, September 30, 2011Classes4Friday, September 30, 2011ClassesA class serves as a template for its instances.4Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All bank accounts have a balance and an account holder; the Account class should add those attributes to each newly created instance.Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All bank accounts have a balance and an account holder; the Account class should add those attributes to each newly created instance.>>> a = Account('Jim')Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All bank accounts have a balance and an account holder; the Account class should add those attributes to each newly created instance.>>> a = Account('Jim')>>> a.holder'Jim'Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All bank accounts have a balance and an account holder; the Account class should add those attributes to each newly created instance.>>> a = Account('Jim')>>> a.holder'Jim'>>> a.balance0Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All bank accounts have a balance and an account holder; the Account class should add those attributes to each newly created instance.Idea: All bank accounts should have "withdraw" and "deposit" behaviors that all work in the same way.>>> a = Account('Jim')>>> a.holder'Jim'>>> a.balance0Friday, September 30, 2011ClassesA class serves as a template for its instances.4Idea: All


View Full Document

Berkeley COMPSCI 61A - Lecture 14

Documents in this Course
Lecture 1

Lecture 1

68 pages

Midterm

Midterm

5 pages

Midterm

Midterm

6 pages

Lecture 35

Lecture 35

250 pages

Lecture 2

Lecture 2

159 pages

Lecture 6

Lecture 6

113 pages

Lecture 3

Lecture 3

162 pages

Homework

Homework

25 pages

Lecture 13

Lecture 13

117 pages

Lecture 29

Lecture 29

104 pages

Lecture 11

Lecture 11

173 pages

Lecture 7

Lecture 7

104 pages

Midterm

Midterm

6 pages

Midterm

Midterm

6 pages

Lecture 8

Lecture 8

108 pages

Lab 4

Lab 4

4 pages

Lecture 7

Lecture 7

52 pages

Lecture 20

Lecture 20

129 pages

Lecture 15

Lecture 15

132 pages

Lecture 9

Lecture 9

95 pages

Lecture 30

Lecture 30

108 pages

Lecture 17

Lecture 17

106 pages

Load more
Download Lecture 14
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 14 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 14 2 2 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?