cs31 lecture 17

X a class is a type x an object is an instance of a

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mming is a paradigm A “philosophy” to design/organize programs A “method” to write programs x Some languages have built-in support for OOP C++, Java, Javascript, … x Some don’t C (but you can still follow the OOP paradigm!)
 109 Reminder: Imperative programs x An imperative program is a set of instructions, possibly An organized into functions organized x A few features, from C: Variables (local to a procedure, global to a program)
 Functions may have side effects (access to memory)
 The program can be organized into multiple files … 110 Why OOP is useful? x Way of thinking: life is about objects/people, what they Way know, and what they can do. A car cannot do the same thing as a dog car I cannot use my procedure “fetch the ball” on my car cannot x Contrast: reasoning about memory and actions to be Contrast: performed on this memory performed x Way of thinking: data and what we can do with it should be Way packed together, not decoupled packed 111 Why OOP is useful? x OOP tends to force modularity x OOP tends to force structure in program designs Hierarchical view of properties/behaviors x OOP tends to force the user to reason (more)
 about types x OOP tends to isolate the data from the user Or, it...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online