Howdy partners, hope you can help - I'm trying to understand the below line. It appears by looking at java.sound.midi.* - we are creating an object Interface instance, with a class and a method from another part of the package.
Here it is -
How do we instantiate an object from an Interface, and how does the above all relate. Thank you for your help!
But remember, curiosity killed the cat. The point of programming to interfaces instead of concrete implementations is so that you don't have to care about the class; you just care about the behavior that it gives you.
Stay with me - Junilu you're right - I see I have opened a Pandora's box when I ran that code!!
Ok - I'm looking at this in a real world layman situation - I want to get into music, so I buy a sequencer and I want it to play/process Midi Files. However - One day I get curious HOW my sequencer plays Midi Files so I decide to take my Sequencer apart. I then can't put it back together, and the cat is dead.
As long as I know I CAN do it, I dont need to KNOW.
James Sands wrote:What do you think? (You're gonna love me!)
Hey, y'all have done an awesome job with the Olympics over there and you're right on track with this one but Love is strong word and not one I like to just wave around like that. Let's just say I'm truly impressed.
James Sands wrote:As long as I know I CAN do it, I dont need to KNOW.
One of the classic examples you'll see is that of driving a car.
In order to drive a car, do you need to know:
1. How the internal combustion engine works?
2. The type of brakes your car has?
Obviously, the answer to all the above is 'no'; and furthermore, if you were thinking about them, it might impair your ability to drive because we puny humans can't deal with too much information at a time.
Same is true of software: If you have a Map of objects, do you care whether it's a HashMap, a TreeMap or a ConcurrentSkipListMap? No. Do you care whether a TreeMap is a red-black tree, an AVL tree, or a splay tree? No.
It's all about managing what a user needs to know to use something; and in general that means: the more you can hide, the better.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Well - I'm definately coming back - even Arunkumar's short but very sweet comment regarding inheritance prompted me to click on Tree in the Java API and it all made sense. Thank you for sticking with me, you've been a great help!