Sunday, September 2, 2018

First Time Teaching - Objects Early

We completed the third week of school and I have introduced objects to the Advanced Placement Computer Science A (AP CSA) class.  Together we have coded a class representing a geometric shape and a Runner class that contains a main() method which creates instances of the geometric shape.  My first impressions are that I am going to like this.

Previous Years - Objects Late

During the last three years I taught a Java programming class (not AP CSA).  This was a class that I had built on my own and did not follow a set curriculum so I taught in an order that made sense to me -- and without doing any research on the debate of when to introduce objects.  The order that I taught language concepts follows:
  • Java program skeleton
  • screen output, variables and data types, basic math
  • keyboard input, the Math class, and Random
  • selection statements (if and switch) 
  • loops (for, while, do while)
  • file input and output
  • classes, methods, inheritance and OO Programming
  • arrays and ArrayLists
  • GUI and Swing
Classes, methods, inheritance and Object Oriented Programming were introduced only after students had learned a majority of the Java language constructs and a good number of supporting classes.  Each year, I would introduce the topic and let students know that they had been using classes and methods from the beginning when they created their first String and now they would be creating their own classes, each with multiple methods.  Each year students took a long time to get comfortable with this topic and we needed to do many, many examples -- together, in pairs and individually.  This was always the unit that would need to be extended with a lecture review,  new examples, or an extra project.

For the last two years I found my best success with teaching classes by following a cookbook approach and having students follow a set of task cards to create a class and tester for the class by going through one task card (one step) at a time -- create the class; add instance variables; create a constructor; create a tester that constructs objects; and so on.  I picked up this technique from a professional development I took over the summer at Colorado School of Mines (@CSatMines).  Students would go through one step at a time, it seemed to cement in their minds the steps needed to create objects.  However I was unsure if they were mastering OO concepts or simply mastering the steps in the recipe.  This further became apparent, when we started looking at inheritance, some students were able to take the next step while others showed that they did not fully grasp the concept of a class and had difficulty with inheritance.

This Year - Objects Early - and Hopes

This year I am teaching AP CSA following the order setup in A+ Computer Science (  We have covered the Java program skeleton, screen output, variables and data types and keyboard input during our first two and a half weeks covering Unit 0.  On Friday we started Unit 1 and built our first class Dog which has only the default constructor, no instance variables and a couple of methods that only produce screen output.  This seems like a good first step to start learning the ideas of a class and an object without jumping into the details of instance variables, constructors, access methods, etc.

We will do some more practice with these basic classes containing methods with only println() statements and then go into adding instance variables, constructors and other methods.  My plan is still to spend a good deal of time on this unit with several program together examples, followed by paired programming with task cards and then a project.  Then after that I will introduce inheritance and the importance of abstraction.

With this early foundation in objects, I am hoping that we can as a set of learners have a good foundation in object oriented programming and be able to go further in the content so that concepts such as sorting, searching, and recursion can be covered along with a thorough review for the AP CSA test in May.  From this early look, I am pleased with what I am seeing.

My Look at the Research

Once you are programming in Java and using objects as part of a day to day job, the question of when you learned the OO concepts seems a moot point.  Most programmers from my era learned Java as a fourth or fifth or later programming language and it was a case of one more language and in most cases object oriented concepts were first used with C++.  However, now that I am in the education world, the topic of how you teach programming and object oriented concepts in the same course, the order does become important.

The debate ranges from objects early to objects late to objects never.  With AP CSA the latter is eliminated as it looks like students will be tested on objects.  So that leaves objects early and objects late.  I started looking into this when I attended the AP Summer Institute in July.  I had been following Alfred Thompson's blog and read what he had to say which concluded with use early and create late (  I have to admit that this is what I was most comfortable with, but I also knew that my students had been struggling with this.

I read the 2009 study from Albrecht Ehlert and Carsten Schulte ( which concluded that there were no learning gains to be found from one method over the other.  I also read the 2012 research from Murat Pasa Uysal ( which concluded that there was a statistically significant difference in learning outcomes for object first being better than objects late.  This study was done with graduate students using the BlueJ environment which isn't my student population or the tool I am using in class (Eclipse).

The research does not seem to point definitively one way or the other which leaves teachers to select the method that works best.  Personally I find that with each year I collect new methods and strategies for teaching CS concepts and in the end hope to come up with a good set of tools for my students.  As for the debate, it looks like a spirited one with people falling on all sides of the issue, and I am making my own small experiment by moving from objects late to objects early, so stay tuned and I look forward to finding my own conclusions.

No comments:

Post a Comment