Jul. 23rd, 2006

juan_gandhi: (Default)
At times I feel like I am not getting it at all.

So, say, we have a class Animal, and two classes, Cat and Dog. They have something in common. We'll talk about this common later.

Let's have Dog d1 and Dog d2. What's the difference between these two dogs? Name, age, gender, genealogy... What's common between these two dogs. Behavior. You can start laughing - or not, if you ever met two dogs that had exactly the same behavior.

Now, let's return to class Animal. What kind of behavior features should we stuff in that class? layEgg()? fly()? swim()? crawl()? walk()? growOnTheBottomOfTheSea()? I guess there are just two common behaviours: eat() and shit(). Except that some animals do not eat (it's an exercise).

How about convergence? Say, we have a class Fish extends Animal (or narrows, depending on how we look at it), and a class Mammal extends Animal. How about their fins? Most of the fishes have fins, but some don't. Most of the mammals don't have fins, but some do.

See what I mean? Our traditional way of thinking in programming terms does not help even in the issues that we are all familiar with.

Any answers?
juan_gandhi: (Default)
"This is the lonelies spott in the world, the pitcher mound of the Yankee's Stadium.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 12th, 2025 10:43 pm
Powered by Dreamwidth Studios