View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 4 - Stephen Rollyson

Definitions
from Midterm #1 Review - Spring 2004

Define each and give an example.

What is Inheritance?
Inheritance is the act of subclassing a parent class (which is often abstract) to specialize methods yet keep a standard across a variety of classes. One of the most popular examples of inheritance is having a parent class called Shape and subclasses like Rectangle, Circle, and Triangle. Shape might define a method getArea which will be overwritten in each of the subclasses to include a different formula for getting the surface area of the shape.
What is Delegation?
Delegation is the act of assigning a task to another method or class. This is useful to keep methods small and readable. An example of delegation might be a method that loads an image, say loadImage, which would delegate the tasks of loading the binary data from a file to a method called loadData and interpreting the data to a method called createImage.
What is Polymorphism?
Polymorphism is the ability for inherited classes to implement a method differently, even though the method name is exactly the same. As in the inheritance example I gave earlier, Shape's getArea method can act in very different ways for each of the subclasses, which must calculate the area differently.
What is Encapsulation?
Encapsulation is the ability for a class to protect and hide its inner workings and data. Thus, a class representing a Person could have the methods getBirthday and getAge but only have one piece of data storing both. The point is, if you're calling both of these methods, you don't need to know if the age attribute exists or if it's been derived from the person's birthday.
What is the MVC paradigm? (For an example show an example using MVC)
The MVC (Model-View-Control) paradigm is a plan for seperating the data, the methods modifying the data, and the appearance of the data to the user. A good example of the MVC paradigm is modern database software that has a spreadsheet presented to the user, an application that validates and interprets the data that the user enters, and the actual data stored within the database.

Link to this Page