liveBook · Manning

Prototype-based object orientation

Prototype-based object orientation is an object model in which objects obtain properties or behavior through links to other objects called prototypes.

How 2 Manning books explain it

The Joy of JavaScript

An inheritance style in which an object delegates property and method lookup to objects linked in its prototype chain.

How it is used
Models reusable object behavior through prototype links in JavaScript domain objects.
How deep it goes
Works through Object.create, prototype inspection, and implicit property lookup, while contrasting linking with copied properties.
Examples
Uses linked transaction and money-transaction objects to show shared sender data and an addFunds method.
What you can do after
Build it from scratch with Object.create and evaluate when delegation or property copying better fits an object model.

Read how The Joy of JavaScript explains prototype-based object orientation →

Secrets of the JavaScript Ninja, Second Edition

An object-oriented model in which objects inherit properties through prototype links rather than class inheritance.

How it is used
Frames prototypes as JavaScript’s object-orientation model and cautions against applying class-based expectations.
How deep it goes
Contrasts prototypes with class inheritance and signals deeper coverage of their operation and implementation, but gives no mechanics here.
Examples
Uses Java-trained developers who write class-based code in JavaScript and are surprised by the results.
What you can do after
Understand that JavaScript uses prototypes rather than class-based object orientation.

Read how Secrets of the JavaScript Ninja, Second Edition explains prototype-based object orientation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.