Let me be honest, I don't have the best memory in the world. I forget things, especially names. Names of people, places, movies, and on and on and on. After 13 years of programming, admitting that I've forgotten the names of basic object oriented techniques might not be kosher, but I admit to my faults. Method overloading and polymorphism especially confuse me because they're so similar.
Polymorphism is when the code decides at run time which method gets executed. This is basically where objects can be subclasses or they can implement interfaces. Which method gets called depends on the actual object being referenced. Since one type of object or an interface can have multiple subclasses or implementations, methods that operate on interfaces, abstract classes, or simply super classes don't have the luxury of knowing which classes is going to implement the method being referenced. This is quite different than method overloading even though as the name implies, method overloading has to do with multiple methods.
Method overloading is the ability to have multiple implementations of a method with different parameters. Contrary to polymorphism its possible to know which method will be called before run time. It will be the method with the parameters that match the passed in attributes. The benefits of method overloading aren't quite as obvious to me as polymorphism. Polymorphism allows for some slick and simpler designs, but is dangerous in the wrong hands. Method overloading isn't so dangerous and can be very convenient, but it can lead to developers scratching their heads figuring out the difference between multiple methods named the same.
Encapsulation is another term I often get confused, because it seems so simple. It means to hide stuff, right? Just make some methods and attributes private or design an api and hide the implementation behind that, right? Well, maybe not exactly. I think those are acceptable answers, but it turns out that if I go back to my OO programming books from college, then encapsulation is a bit different from hiding implementations. Encapsulation in OOP means to include behavior in the same container as the data. This was an aha moment for me because I had forgotten that it was such a specific term and one that is regrettably (IMHO) seldom practiced in the enterprise world, but that could be another blog.
Monday, March 8, 2010
Friday, March 5, 2010
America Can Compete
"There is no reason that America can't compete in a global economy." Alan Mulally, CEO of Ford
Its good to see that manufacturing companies are realizing that competing doesn't mean look everywhere but America. Now if we can just get corporate IT departments to realize that concept.
I also find it fascinating that Mulally believes that not having any problems is a problem. It seems obvious to me, but I've never encountered a corporate culture that understands that if you're going to make progress, you're going to have a few problems. You can't make an omlette without breaking a few eggs.
Its good to see that manufacturing companies are realizing that competing doesn't mean look everywhere but America. Now if we can just get corporate IT departments to realize that concept.
I also find it fascinating that Mulally believes that not having any problems is a problem. It seems obvious to me, but I've never encountered a corporate culture that understands that if you're going to make progress, you're going to have a few problems. You can't make an omlette without breaking a few eggs.
Subscribe to:
Posts (Atom)
