Introduction: 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.
1. Scissors (any kind will do).
2. Piece of paper or cardstock.
4. Business card-sized piece of paper or cardstock.
Step 1: 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
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
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
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
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.
We have a be nice policy.
Please be positive and constructive.