The Artima Developer Community
Sponsored Link

Java Community News
JavaScript's Language Features

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

JavaScript's Language Features Posted: Dec 21, 2006 3:27 PM
Reply to this message Reply
Summary
In a recent IBM DeveloperWorks article, Bruce Tate discusses some of JavaScript's lesser-known language features, such as prototype-based objects, dynamic types, and support for higher-order functions.
Advertisement

JavaScript is both the black sheep of current programming languages, and also the language that many people wish was more ready for prime-time application development, according a recent IBM DeveloperWorks article by Bruce Tate, JavaScript's Language Features.

Tate explains that far from being an impoverished language in terms of features, JavaScript supports a large number of state-of-the-art programming techniques, such as higher-order functions well-known in the functional programming community:

Functions are first-class objects in JavaScript, and I can manipulate them freely... C developers think of this concept as a function pointer, but JavaScript's notion of higher-order functions is much more powerful. This feature gives JavaScript programmers the ability to deal conceptually with actions, or functions, as easily as they deal with other variable types.

Using a function as a function argument, or returning a function as a value, elevates this abstraction into the realm of higher-order functions... Higher-order functions form the foundation of functional programming, which most believe represents a higher level of abstraction than pure object-oriented programming.

Tate also discusses JavaScript's prototype-based object system:

JavaScript represents objects as nested functions [and] bases object construction on a prototype, or an existing instance of an object, rather than a class template...

Many have used [JavaScript]'s object model to create surprisingly sophisticated, well-designed, object-oriented software. But the object model, especially for inheritance, is not what you're used to.

The Java language is class-based. When you build applications, you build a new class as a template for all objects. Then, you call new to instantiate that template, creating a new object. In JavaScript, you instead create a prototype, which is an instance that creates all future objects.

A more detailed explanation of prototype-based objects is given in Artima's interview with Scott Blum, the Google engineer behind the Google Web Toolkit's Java-to-JavaScript compiler, Compiling Java to JavaScript.

What do you think of JavaScript as a programming language?

Topic: PMD 3.9 Released Previous Topic   Next Topic Topic: Ant 1.7 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use