Team LiB
Previous Section Next Section

JavaScript’s Object-Oriented Reality

Today, object-oriented programming (or OOP) is commonly accepted as a good way to structure programs, but rarely is full-blown OOP style used in JavaScript. You might wonder why this is. The language itself does support the principles of object-oriented programming, which have been demonstrated in the examples of this chapter and are summarized here:

JavaScript supports all of these principles; they are clearly present in the language itself. However, in practice they are largely ignored by most programmers writing their own scripts. This lack of OOP programming style in JavaScript is due to the tasks it tends to be used for and the ease of employing other approaches to accomplish those tasks. The value of using many of its structures is questionable because the size and complexity of most scripts are not sufficient to warrant the use of an OOP approach. In fact, the success of the language for many of its users is that it doesn’t take a great deal of effort or lines of code to accomplish useful tasks within Web sites. Most JavaScript programmers use those features they find convenient and leave the major OOP features to those writing full-fledged Web applications.


Team LiB
Previous Section Next Section