Objects with prototype-based mechanisms

  • Authors:
  • Linda Wilkens

  • Affiliations:
  • Department of Mathematics and Computer Science, Providence College, Providence, Rhode Island

  • Venue:
  • Journal of Computing Sciences in Colleges
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

In this paper we consider using the popular scripting language JavaScript / ECMAScript to teach object-based and object-oriented programming to beginning or novice programmers. We explore JavaScript's use of constructors and prototypes as an alternative to class-definition based systems. We show that JavaScript's prototype-based mechanisms provide the four essential components of the object-oriented paradigm: abstraction, encapsulation, modularity, and hierarchy.We provide examples which conform to the ECMAScript standard, and which have been implemented and tested using the JavaScript interpreter incorporated into Netscape Communicator 4.7.