Skip to content

Instantly share code, notes, and snippets.

@charleshimmer
Created February 10, 2012 15:50
Show Gist options
  • Save charleshimmer/1790409 to your computer and use it in GitHub Desktop.
Save charleshimmer/1790409 to your computer and use it in GitHub Desktop.
Lamen explanations of programming concepts

Objects

The concept of an “object” in programming is a made up abstraction to make programming easier. Computers don’t require us to use objects to code software. Humans invented this concept to make building, organizing, and maintaining code easier and consistent. What computer scientists really did was steal this pattern from dealing with real objects we work with everyday.

Let’s take a car for example. A car is an object that can do certain things. A car can drive, break, turn, and lock the doors. If we were to implement a car in our code we would create an object and call it “Car”. This car object would have methods (fancy word for functions that are defined in an object) that could drive(), turn(), brake(), and lockDoors(). The actual syntax would look something like this if you were doing this in JavaScript:

var car = new Car(); // manufacture a new car object and store it in a variable

car.drive(); // make the car drive
car.brake(); // make the car brake
car.lockDoors(); // make the car lock the doors
car.turn(); // make the car turn

The beauty of following this object pattern, is the car object can handle the messy details of doing all those functions internally. As a developer I can break the pieces of my software into smaller self-governing encapsulations. We call these smaller encapsulations objects. Just like when you are driving a real car, you aren’t too concern with how the car is braking, or turning, just that it does and it does it correctly.

Elements

DOM

Arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment