Last updated: Wed, 8 Apr 2015 15:29:36 -0400
- Note: These slides are from a previous semester. We provide them because learning is often aided by looking at different presentations of the same material. However, previous iterations of the course had a different structure and different style requirements. Read these slides for their ideas only. When there are discrepancies, follow the rules of our current course.
Understand the key concepts of object-oriented programming.
Understand how interfaces and classes relate to the course materials thus far.
Understand the tradeoffs between OOP and the function-based programs you have written in this course so far.
(define Shape<%> (interface () ; weight : -> NonNegReal ; Returns the weight of this shape, which is related to its area in Pixels. weight ; render : Image -> Image ; Returns an Image with this shape added to the given Image. render)) ; A Pixels is a NonNegReal ; A Circle is a (new Circle% [x Coordinate][y Coordinate][r Pixels][c Color]) ; Represents a circle. ; A Square is a (new Square% [x Coordinate][y Coordinate][l Pixels][c Color]) ; Represents a square parallel to sides of a canvas. ; A Composite is a (new Composite% [front Shape<%>][back Shape<%>]) ; Represents a group of two overlapping Shape<%>s.