240 likes | 375 Views
COP3502: Introduction to CIS I. Lecture 13. Problem Set 2 due 2/15 Additional non- Sierpinski submissions accepted until 2/19. Super Session tonight 8pm-1opm E119 Discussions tomorrow (no worksheet) Super Session Thursday 8pm-10pm E119 Additional TA Office Hours.
E N D
COP3502: Introduction to CIS I Lecture 13
Problem Set 2 due 2/15 Additional non-Sierpinski submissions accepted until 2/19
Super Session tonight 8pm-1opm E119 Discussions tomorrow (no worksheet) Super Session Thursday 8pm-10pm E119 Additional TA Office Hours
Object-Oriented Programming (OOP) • Everything is an object
Object-Oriented Programming (OOP) • Everything is an object • Program = objects communicating through messages
Object-Oriented Programming (OOP) • Everything is an object • Program = objects communicating through messages • Each object has its own memory
Object-Oriented Programming (OOP) • Everything is an object • Program = objects communicating through messages • Each object has its own memory • Every object has a type
Object-Oriented Programming (OOP) • Everything is an object • Program = objects communicating through messages • Each object has its own memory • Every object has a type • The type dictates what messages an object can receive
everything is an object public class Hello { …} public class PrimeNumberTheorem{ … } public class Calculator { … } public class Mandelbrot { … } public class Factorial { … }
a program contains objects that communicate by sending messages Car Person turnOn()
a program contains objects that communicate by sending messages StdDraw Sierpinski filledPolygon()
a program contains objects that communicate by sending messages StdDraw Sierpinski filledPolygon() xCoords, yCoords
a program contains objects that communicate by sending messages StdDraw Sierpinski filledPolygon(xCoords, yCoords)
a program contains objects that communicate by sending messages Complex Mandelbrot multiply(z)
a program contains objects that communicate by sending messages Complex Mandelbrot result
each object has a memory which may contain other objects Complex double real double imag
each object has a memory which may contain other objects StdDraw Color penColor Double penRadius int height int width Font font Graphics2D onscreen booleanmousePressed Complex double real double imag
every object has a type that dictates what kinds of messages it can receive add() Complex multiply() abs()
an object’s interface tells you what kind of messages you can send StdDraw getPenColor() setPenColor() filledSquare() picture() setFont() text() setScale() show()
access control public private protected
interface “How do you use the object?” implementation “What are the inner workings of the object?”