Internet Explorer 5.0 Preview, Part I: Object Oriented Concepts for Behaviors- Doc JavaScript
Behavior's object-oriented concepts
As we have shown, the Behavior construct exemplifies several concepts from object-oriented programming languages and environments:
- Hiding of the implementation details. Only the
Behaviorinterface is exposed to the caller HTML code (via theIMPLEMENTStags). It allows you to change the implementation of the style without modifying the caller HTML elements, as long as the interface does not change. - Encapsulation of code. A
Behaviordefinition is enclosed in a single scriptlet file (soccer.sctin our Blinking Soccer example). Separating the behavior from the page contents eases the maintenance of both. No longer must the content expert deal with style and format. The style expert, on the other hand, can now focus only on these scriptlets, and does not have to deal with the page content. - Object-based definition. The definition of
Behaviors and objects is very similar. It includes both the data and the operations defined on it. No other data can be associated with aBehaviorafter its definition. No other operations can be supported besides the initially-defined ones. - Reusable code. The same
Behaviordefinition can be used by multiple DHTML elements. - Application Procedural Interface (API). The interface to a
Behaviorscriptlet is well defined, similarly to a procedural interface. The contents page assigns values to the pre-defined parameters of theBehavior. TheBehaviorcan send events back to its caller page.
Created: July 19, 1998
Revised: July 19, 1998
URL: http://www.webreference.com/js/column22/objectoriented.html


