Introduction: Object Oriented Programming: Creating Objects Learning/Teaching Method/Technique Using Scissors

Picture of Object Oriented Programming: Creating Objects Learning/Teaching Method/Technique Using Scissors

Learning/teaching method for students new to object-oriented programming.
This is a way to allow them to visualize and see the process of creating objects from classes.

Parts:
1. Scissors (any kind will do).
2. Piece of paper or cardstock.
3. Marker.
4. Business card-sized piece of paper or cardstock.

Step 1: Object Oriented Programming Definitions

Picture of Object Oriented Programming Definitions

1. A "class" is defined as the piece of orange cardstock/paper.
2. The action of cutting out a piece of the cardstock/paper with the scissors is known as "instantiation", "creating an instance of the class" or creating an object..
3. Each of the pieces that have been cut out are known as "objects".
4. The things written on each of the pieces of paper are the objects' "attributes", ie: variables and methods for that object.

Step 2: Define the Class

Picture of Define the Class

1. On the piece of paper/cardstock, write down the name of the class. In this case, it is called "Orange".
2. Next write down the variable and method that will be associated with each object created from the class. Here, the variable is "Ripe" and the method is "PickFromTree".

Step 3: Create/Instantiate the Object

Picture of Create/Instantiate the Object

1. Use the business card-size piece of paper/cardstock and marker to trace out 4 boxes.
2. Using the scissors, cut out each square from the sheet/cardstock.
3. The act of cutting out shapes is known as creating an object, or "instantiation", that is, the creating of an instance of the class.
4. Here, we have cut out several shapes, each one an object of class "Orange".
5. Each object will have the properties of the class "Orange".

Step 4: Name the Objects

Picture of Name the Objects

1. Name each of the objects by writing them on the shapes with the marker.
2. Here, they are named "NavelOrange", "ValenciaOrange", "BloodOrange" and "Clementime".

Step 5: Give the Objects Attributes

Picture of Give the Objects Attributes

1. Write down the variable and method defined in the class for each object.
2. Here, write down "Variable: Ripe" and "Method: PickFromTree" on each object card.
2. Now, one can visualize and touch each each object created from the Orange class with a different name and the variable/method for each object.

Comments

Chanio (author)2015-08-08

Nice, but I wonder how one could then, explain class variables and inheritance...

The action comes next!

You are right, I guess that recycling is all about OO classes. When you choose an object to create something new, you count on its basic properties to call them besides using your own extensions. That is the reason of choosing certain materials.

Perhaps, another example might be cloning a pet.

THX!

matt392 (author)Chanio2015-08-22

Ok, class inheritance teaching method is up:
https://www.instructables.com/id/Object-Oriented-Programming-Class-Inheritance-Lear/

matt392 (author)Chanio2015-08-09

good idea on class inheritance. will work on that for a future instructable.