Day 105: UML Class Diagrams and Type Tables

Several students in AP Computer Science are struggling with the AP free response questions. In general, the logic is sound and the syntax is correct, but there is a lot of confusion about matching types. What I mean by matching types is making sure the type of the variable being assigned the value returned by a method is correct. Or, the type of the variable on which a method is invoked is correct. Or, the type of the variable being passed as a parameter is correct. Or, the type of the variable being compared to another variable are comparable. The transition from Python to Java’s strong typing is a challenge for some students.

This weekend, I thought of two representations that can assist a student crafting a solution to an AP free response question. The first is UML Class Diagrams, which is relevant to our current unit on object-oriented design. UML Class Diagrams capture everything important about a class in a single box and also shows the relationships between classes. The second representation, I just made up and there may be much more effective techniques. Today, I had students create a “type table”. One column is the variable name (including parameters, instance variables, this, and local variables). The other column is the type of the variable. I modeled how students can use this table, in conjunction with the UML Class Diagram, to check that their types are correct. Several students are trying this out tonight and we’ll see the results tomorrow.



Leave a Reply