Protoype Based Programming and Prototypal Inheritance

Protoypal Based Programming languages work on the premise that object instances inherit from other objects and can then be given added functionality and be mutated in their behaviour. Other instances can then be created which can then be further mutated. This is a subset of OOP that differs slightly from the classic constructor mechanism of creating objects as part of a class which may or may not inherit from a previous class.

PBP allows mutation and extension of object functions and methods at the moment of creation. The creation can be ex nihilo (from nothing) or from a copy or clone of a previous object.

This dynamic mutation of objects on creation allows for more dynamic object behaviours at the arguable cost of code reliability and predictability. True object-orientated behaviour would demand that objects inherit from other objects and new objects can act as ‘prototypes’ for yet newer objects. And prototypes can be altered during the runtime of the program.

Written by Retesh Bajaj and Sivan Patel (“yo”)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.