FACTOID # 58: Looking for geniuses? Head straight to Iceland. There are more than 3 Nobel Prize Winners for every million Icelanders.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Prototype based programming

Prototype-based programming is a style and subset of object-oriented programming in which classes are not present, and behaviour reuse (known as inheritance in class-based languages) is done by cloning existing objects which serve as prototypes for the new ones. It is also known as class-less, prototype-oriented, or instance-based programming. In computer science, object-oriented programming, OOP for short, is a computer programming paradigm. ... In object-oriented programming, a class consists of encapsulated instance variables and subprograms, the methods mentioned below. ... In object-oriented programming, a class consists of encapsulated instance variables and subprograms, the methods mentioned below. ... Cloning refers to the making of an exact copy of an object, frequently under the paradigm of instance_based programming. ... An object is fundamental concept in object-oriented programming. ... Prototypes or prototypical instances combine the most representative attributes of a category. ...


The original (and canonical) example of a prototype-based language is Self, but the class-less programming style has recently grown increasingly popular, and has been adopted for the programming languages Cecil, JavaScript, NewtonScript, Io, MOO, REBOL, and several others. Self is an object-oriented programming language based on the concept of prototypes. ... Other listings of programming languages are: Categorical list of programming languages Generational list of programming languages Chronological list of programming languages Note: Esoteric programming languages have been moved to the separate List of esoteric programming languages. ... Cecil is a pure object-oriented programming language that was developed by Craig Chambers at the University of Washington in 1998 to be part of the Vortex project there. ... JavaScript is an object-based scripting programming language based on the concept of prototypes. ... NewtonScript is an prototype based programming language created to write programs for the Apple Newton. ... Wikibooks Programming has more about this subject: Io Io is a pure object-oriented programming language inspired by Smalltalk, Self, Lua, Lisp and NewtonScript. ... The MOO programming language is a programming language used to support the MOO system. ... REBOL, the Relative Expression Based Object Language (pronounced [rebl]), is a data exchange and programming language designed specifically for network communications and distributed computing. ...

Contents


Incentive

With class-based languages, objects come in two general types. Classes define the basic layout and functionality of objects, and instances are "usable" objects based on the patterns of a particular class. Programming in such a language typically consists of designing classes and adding functionality to create various instances that store and manipulate data. In strictly mathematical branches of computer science the term object is used in a purely mathematical sense to refer to any thing. While this interpretation is useful in the discussion of abstract theory, it is not concrete enough to serve as a primitive datatype in the discussion of more concrete... In object-oriented programming, classes are used to group related variables and functions. ... An object is fundamental concept in object-oriented programming. ...


The classes are collections of code for the objects, which are the same for all instances, whereas the instances are collections of memory holding the objects' data, which are what distinguishes them from each other (a concept known as state). This model works well with traditional compilers, which basically write code and then have that code manipulate data. In information processing, a state is the complete set of properties (for example, its energy level, etc. ... A diagram of the operation of a typical multi-language compiler. ...


One problem with class-based languages, in the opinion of proponents of prototype-based programming, is that programs rarely remain static during development. As systems grow, their original class structures often become inadequate. The classes must be extended with more code, negating some of the benefits of object orientation. For some uses, it would be better if programs could change the behaviour of the underlying classes. In most languages, the classes are, however, fixed at compile time and cannot be changed at runtime. In computer science, compile time, as opposed to runtime, is the time when a compiler compiles code written in a programming language into an executable form. ... In computer science, run time (with a space, though often its spelled without one) describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). ...


Prototypes and cloning

Instead of data-containing instances and code-containing classes, prototype-based languages have only objects. A prototype system starts with at least one atomic object loaded, and new objects are created by cloning existing ones. Cloning an object creates an entirely new one that starts with the same default behaviours as its original.


Instead of having a pointer to a class, new objects contain a pointer to the object that created them. They are largely empty, and only start growing in memory when changed. This is different from class-based, object-oriented languages, where each instance of a class usually sets aside a known amount of memory. Additional data can be added to any object at any point at runtime. Since objects grow as needed, anything can be added to them. In fact, every object in such a system tends to be different from every other, not only in the data themselves, but in what data are being recorded. It is also important to note that not only data but also methods can be added or changed. For this reason most prototype-based languages refer to both data and methods as "slots".


Although prototype-based languages only need to start with one object, they typically provide a selection of basic objects for convenience. In general these objects tend to have method definitions only, relying on the programmer to add the data as needed. For instance, a Point object that can record positions in two dimensions might contain methods for adding and subtracting points, but not include the x and y definitions. The programmer would instead have to add these to each new copy.


This leads to some increased flexibility. Bugs in existing object methods can be fixed by sending the new code (in the form of blocks) into the appropriate "slot". Similarly, any object can be turned into one that handles remote invocation by replacing methods in the same fashion. Class design is simplified, because the "class" definitions can be changed at any point in time, and within any application (one application can fix bugs in the objects it uses for itself, and the changes will not be visible to others).


Pure prototypes

Under pure prototyping, there are no pointers to the "parent". The "mother" object is copied exactly, but given a different name (or reference). It can be compared to biological mitosis. Methods and attributes are simply duplicated as-is. The drawback is that memory is consumed for each copy for the parts that are the same. The advantage is that one can alter the copy without worrying about side-effects in the other children of the parent. Pure prototyping can also simplify implementation, assuming memory is not a scarce resource. Light micrograph of a newt lung cell in early anaphase of mitosis. ...


Criticism

From the point of view of proponents of statically typed programming languages, correctness, safety, efficiency and predictability are more important than the increase in flexibility gained through the ability to modify code at run-time. In theoretical computer science, correctness of an algorithm is asserted when it is said that the algorithm is correct with respect to a specification. ... Warning signs, such as this one, can improve safety awareness. ... Efficiency is the capability of acting or producing effectively with a minimum amount or quantity of waste, expense, or unnecessary effort. ... Prediction of future events is an ancient human wish. ...


A particularly good example of this is the extensive use of JavaScript to implement Mozilla Firefox's user interface and its extensions. The JavaScript running in the browser has higher security access than the JavaScript objects embedded in web pages, but often has to interact with untrusted objects. In a non-statically-typed language, it can be quite difficult to guarantee that you have the object you think you have and that the method you're calling does what you think it does. Calling a method that was replaced can cause untrusted code to run at a higher security level. This has resulted in many security bugs. JavaScript is an object-based scripting programming language based on the concept of prototypes. ... Mozilla Firefox is a free, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers. ...


Languages

ABCL/1 (Actor-Based Concurrent Language) is a prototype-based concurrent programming language for the ABCL MIMD system, created in 1986 by Akinori Yonezawa, of the Department of Information Science at the University of Tokyo. ... ABCL/R is a reflective subset of the ABCL/1 programming language, written by Professor Akinori Yonezawa of Tokyo Institute of Technology in 1988. ... ABCL/R2 is a second generation version of the object-oriented reflective concurrent programming language ABCL/R, designed for the Hybrid Group Architecture. ... The title given to this article is incorrect due to technical limitations. ... Agora is a reflective, prototype_based, object_oriented programming language that is based exclusively on message passing and not delegation. ... Cecil is a pure object-oriented programming language that was developed by Craig Chambers at the University of Washington in 1998 to be part of the Vortex project there. ... Cel is an object-oriented prototype-based programming language based on Self and Smalltalk. ... ECMAScript is a scripting programming language, standardized by Ecma International in the ECMA-262 specification. ... ActionScript is an ECMAScript-based programming language used for scripting Macromedia Flash movies and applications. ... The DMDScript programming language is Digital Mars implementation of the ECMAScript engine, and thus, scripting language. ... JavaScript is an object-based scripting programming language based on the concept of prototypes. ... JScript is Microsofts Active Scripting implementation of ECMAScript. ... Wikibooks Programming has more about this subject: Io Io is a pure object-oriented programming language inspired by Smalltalk, Self, Lua, Lisp and NewtonScript. ... The Lua (pronounced LOO-ah, or in IPA) programming language is a lightweight, reflective, imperative and procedural language, designed as a scripting language with extensible semantics as a primary goal. ... The MOO programming language is a programming language used to support the MOO system. ... NewtonScript is an prototype based programming language created to write programs for the Apple Newton. ... Obliq is an interpreted, object-oriented programming language designed to make distributed, and locally multi-threaded, computation simple and easy for the programmer, while providing program safety and untyped variables. ... Laszlo is an open source platform for the development and delivery of rich internet applications on the World Wide Web. ... REBOL, the Relative Expression Based Object Language (pronounced [rebl]), is a data exchange and programming language designed specifically for network communications and distributed computing. ... Self is an object-oriented programming language based on the concept of prototypes. ... Slate is a prototype based object-oriented programming language with multiple dispatch. ... TADS is a programming system for creating interactive fiction games. ...

See also



 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.