Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 - Travis Shepherd
1. Inheritance - When a particular class has more specific information about a certain kind of more general class, it is appropriate for that class to inherit from the general class. For example, a Car is a fairly generic class, but has common behavior that all cars share. A specific implementation of a Car, say, a BMW, while performing all the basic routines a Car can do, might do them differently than other cars, and also might have additional behaviors and attributes that not every car has.
2. Delegation - Delegation is the process of having a message delegate from one class to another, where the responsibility for the message actually lies. For example, you can start a Car, but the internal workings of a Car can delegate the start message to the Ignition, which can delegate to the Engine, etc. It wouldn't be appropriate to directly expose these internal delegations, so the Car class handles a start, and makes sure that everything that is necessary to happen for the car to start, happens.
3. Polymorphism - Polymorphism allows for inheritance to handle how specific classes implement various methods. As in the previous inheritance example, all Cars share common behavior, but different Cars may actually implement them differently. All Cars can switch gears, but the mechanism for switching gears varies based on the make and model, if the car is manual or automatic, and various other factors. The specific implementation is hidden, but is called appropriately depending on what kind of object a variable references. Polymorphism allows generic programming and ensures that the specific details work appropriately.
4. Encapsulation - Encapsulation is the idea that one can "blackbox" a class's methods and data into a single class, and not worry about how it works, just know that it does work. The specific implementation details of how certain methods behave isn't necessary for the programmer; only the end result is necessary. This keeps data hidden from outside sources, and allows the class/object itself to manage how the details work without affecting anyone else.
5. MVC - MVC stands for Model, View, and Control. This is a GUI concept where the graphical representation (view) is kept separate from the physical data (model) and the controller. This allows for various adaptations to occur without penalty. Since the data and control are independent of the view, the programmer can switch one view out for another, without affecting the other two areas of the program. Similarly, the data or the control sides can be switched out too, allowing for a very modular program (very much in the spirit of OO).
Links to this Page