Home

ABCs of Programming Constructs

Blueprints / Objects Containers

Summary goes here...

A. Classes

Classes are BLUEPRINT (templates or recipes) on how to create objects.  Like real world blueprints that are a set of instructions on how to build something (e.g., a house, a car). classes are blueprints on "how to" build objects. Note, they are not objects but instructions on how to build objects.  When you create an object from a class, you can create an instance of that object from that class.  Multiple objects (instances) can be created from the same class (blueprint).

 

B. Prototypes

Here's some collapsible content.

C. Objects

Final bit of collapsible content.

Key points to remember about classes and objects:

  • Classes names by best practice begin with a capital letter (e.g., Number)
  • To create instance of an object you use the new key word constructor function (e.g., var myObject = new Object()). Instances of an object share COMMON properties (e.g., height, width). Yet at the same time, they have properties UNIQUE to themselves (e.g., color). Usually, instances of a class share common methods, however; custom methods can be defined for individual instances which is called polymorpism
  • When thinking about what properties will be needed when creating an object, think of the things you would like to change (e.g., x/y, width/heigt, alpha) and then make them the
  • Objects are SPECIFIC instances of a class. The process of creating an object from a class is called INSTANTIATION.
< Previous Topic     Next Topic >