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
Behavior
interface is exposed to the caller HTML code (via theIMPLEMENTS
tags). 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
Behavior
definition is enclosed in a single scriptlet file (soccer.sct
in 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
Behavior
s and objects is very similar. It includes both the data and the operations defined on it. No other data can be associated with aBehavior
after its definition. No other operations can be supported besides the initially-defined ones. - Reusable code. The same
Behavior
definition can be used by multiple DHTML elements. - Application Procedural Interface (API). The interface to a
Behavior
scriptlet is well defined, similarly to a procedural interface. The contents page assigns values to the pre-defined parameters of theBehavior
. TheBehavior
can send events back to its caller page.
Created: July 19, 1998
Revised: July 19, 1998
URL: https://www.webreference.com/js/column22/objectoriented.html