The phenomenal success of object-oriented languages such as Java and C# as enablers of enterprise-wide, Web-deployed applications has compelled countless numbers of organizations and individual professionals alike to seek proficiency with such language in recent years. Many of these are drawn like moths to a flame, however -- and in fact go “down in flames” -- because they are ill prepared to harness the power of an object-oriented programming language, due to a basic lack of understanding of object concepts. (Copyright 2004 by Jacquie Barker – all rights reserved. Reprinted with permission of the author. Excerpted in part from Beginning Java Objects: From Concepts to Code, by Jacquie Barker, ISBN 1590591461; published by Apress LP.)
Imagine that you have been asked to build a house and that you know the basics of home construction. In fact, you are a world-renowned home builder whose services are in high demand! Your client tells you that all of the materials you will need for building this home are going to be delivered to you. On the day construction is to begin, a truck pulls up at the building site and unloads a large pile of strange, blue, star shaped blocks with holes in the middle. You are totally baffled. You have built countless homes using materials such as lumber, brick, and stone, and you know how to approach a building project using these familiar materials; but you haven't got a clue about how to assemble a house using blue stars.
Scratching your head, you pull out a hammer and some nails and try to nail the blue stars together as if you were working with lumber, but the stars don't fit together very well. You then try to fill in the gaps with the same mortar that you would use to adhere bricks to one another, but the mortar doesn't stick to these blue stars very well. Because you are working under tight cost and schedule constraints for building this home for your client, however (and because you are too embarrassed to admit that you, as an 'expert' builder, don't know how to work with these modern materials), you press on. Eventually, you wind up with something that looks (on the outside, at least) like a house.
Your client comes to inspect the work, and is terribly disappointed. One of reasons he had selected blue stars as a construction material was that they are extremely energy efficient; but, because you have used nails and mortar to assemble the stars, they have lost a great deal of their inherent ability to insulate the home. To compensate, your client asks you to replace all of the windows in the home with triple pane thermal glass windows so that they will allow less heat to escape. You are panicking at this point! Swapping out the windows will take as long, if not longer, than it has taken to build the house in the first place, not to mention the cost of replacing stars that will be damaged in the renovation process.
When you tell your customer this, he goes ballistic! Another reason that he selected blue stars as the construction material was because of their recognized flexibility and ease of accommodating design changes, but because of the ineffective way in which you assembled these stars, you are going to have to literally rip them apart and replace a great many of them.
This is, sad to say, the way many programmers wind up building an object-oriented (OO) application when they don't have appropriate training in how to approach the project from the perspective of objects. Worse yet, the vast majority of would-be OO programmers are blissfully ignorant of the need to understand objects in order to program in an OO language. So, they take off programming with a language like Java or C# and wind up with a far from ideal result: a program which lacks flexibility when an inevitable 'mid course correction' occurs in terms of a change in the requirements specification, as when new functionality needs to be introduced after an application has been deployed.