Java Thoughts

Name: cis327saul

Saturday, January 29, 2005

Polymorphism

Now there's a funny word, don't ya think. It's actually a pretty powerful characteristic of object-oriented programming. This referst to the ability to define different "specific" behavior for "child" classes that inherit the same "general" behavior from the same parent class.

Let's look at an example. That always makes it easier, doesn't it? Say for example, you define an abstract class of "GraphicalObject" with an action of "Draw." Child classes could then be defined as a "Sphere" and "Pyramid." When asking either of these two child classes to draw, we would get two different results even though they both inherit the same action from the parent object. The polymorphic characteristic allows the general (or parent) class to define an action that will be implemented differently by each specific (or child) class.

Inheritance

You might first think this has something to do with your rich uncle's hidden treasures, but that is not the case here. In OOA&D, we can more closely relate to the occurance of "having your mother's eyes."

Actually, we can build upon the prior term, abstraction, and say that once we have defined an class of objects using abstract thinking, we have identified certain attributes and actions that are common to all occurances of that abstract class. We can then describe classes that are derived from that "super-class" or "parent" class. So these "child" classes actually absorb or "inherit" the characteristics of the parent. To use my car example, a car can either be a coupe or a sedan. So each would inherit the characteristics, wheels and engine, from it's parent class and for a coupe, it would have two doors, while a sedan has 4 doors.

Tuesday, January 25, 2005

Abstraction

This term refers to the idea of thinking on very general definitions. In other words, thinking of something without needing to apply the form of that something to a specific instance of the something.

OK, that was a pretty absract definition. How about an example. Think of a car and what that means, not a specific make or model of a car, but just a car. It has wheels, and engine, and so forth. You can picture that without actually needing to reference an actual instance of a car such as a Nissan 350Z (my dream car :-) )!

Make sense?

Terminology

OOA&D (object oriented analysis and design - for those who were wondering) has many new terms to learn. I'll start with abstraction (since that's what our prof has listed for us to define) and give my definition of some of these terms. Soooo... here goes...


Welcome message

I hope I don't bore you too much with these comments, but here is where I will write whatever crosses my mind relating to the Java course I am currently taking.