Sunday, January 27, 2019

Learn, Practice, Improve

Last night I went to our school's performance of "Little Shop of Horrors".  It was so fun to see some of my students in a different light.  I was also impressed by the performance and the talent of these
students -- I have some very gifted students!  As teachers, we see students in the classroom on a daily basis with their struggles and successes with the material we teach.  Last night was a great opportunity to see students shine in a different way.  They took a lot of time after school and on weekends to learn their lines and the music, practice over and over, and improve until they have a performance to be proud of.  And those themes of learning, practicing, and improving is the topic for the week,  But I am reminded that we are all so much more than what we see in the classroom.

Learn, Practice, Improve

We have learned the basics of Python in Exploring Computer Science -- input(), print(), int(), float(), explored the math module and I was very pleased with the speed that we were moving through the material and hopeful that this year we would be able to get further in the language than last year.  My typical approach to learning is to code together with the students and talk about the concepts and the code as we write a program that has lots of starter comments and we fill in the code as our notes.

The practice part of each unit is to complete a set of step by step instructions included with snakify.org and then either complete projects in Snakify or complete projects that I have come up with for the students.  These projects are all the same and students can and are encouraged to work together.  After listening to @teachingpython podcast by Sean Tibor (@smtibor) and Kelly Paredes (@kellypared), I have started to do 5-minute challenges to start each day with a 3-5 line program that the students need to write and then we review together.

Finally, each student completes some type of independent project that lets them be a bit creative but also shows that they can complete an assignment using these basic concepts.

How much practice is enough

I was ready to quiz over the basic material and move on.  Then on Friday, I had the students complete a 5-minute challenge of a four line program which included importing the math module, ask the user to enter a radius, calculate the circumference of a circle and display a message with the result.  With one of the two sections of ECS, I spent over 15 minutes on the 5-minute challenge.  Thank you @teachingpython!  These 5-minute challenges are a valuable formative assessment, and very quickly told me that I need to have some more review before we move on.

I am creating some additional review programs for the students to complete.  But it does go to show me the importance of these formative assessments and that from year to year and even from one section to another additional practice may be required.  And just like the Little Shop of Horrors, once the students have learned, and practiced they can improve their skills and perhaps learn something new that may become a new interest just like theater!

Image from pexels.com

Monday, January 21, 2019

Code Testing as a Teaching Method ... and THE EGG

On Friday, the students in Exploring Computer Science were working on a "Studio Day" (a term I borrowed from our art teachers to replace work day), I was circulating through the classroom, helping students with questions, encouraging those that needed a little push, and reminding some students to get back to work and
No these are not the eggs that broke the internet!
crank some code.  As I approached one group of students, a picture of an egg flashed from the screen and the code was back.  I encouraged the group and moved on.  I thought that was an odd thing to have on the screen -- usually, it is cars, clothes/shoes, or makeup that are more popular than me and not an egg!

Over the weekend I learned about the egg that broke the internet, and how a picture of an egg became more popular and had more likes on Instagram than a picture from Kylie Jenner.  I enjoy seeing what is popular with students and why.  Voting up a picture of an egg seems to be one of those things that students do, just to have fun.  But I also think it shows them that they can have power with their vote, and I hope that their enthusiasm with voting in Instagram to change things carries through to adulthood and that they value the importance of their vote and the power it has.  No, this blog is not turning political -- that vote can be left, right or center -- but our votes do have power!  And in the end, a very important purpose of the school system is to educate our citizens.

Code Testing:  Education Research

On Friday, I had a conference call with the Career and Technical Education (CTE) Advisory Committee for our software engineering program at Pinnacle.  We had a new member join, so I had everyone introduce themselves and as I again heard Anita Wall introduce her role at IBM working with companies and their Software Quality and Assessment, it reminded me about the importance of testing and that this was an area that I was not emphasizing with my AP Computer Science A students.  So I did a little digging over the weekend.  I read an interesting education research article by a set of professors (Edwards, Shams, Cogwell, and Senkbeil) from Virginia Tech University:  Running Student Tests Against Each Others' Code: New Life for an Old "Gimmick".   And a second article by Edwards, Using Test-Driven Development in the Classroom.

The article discussed the importance of making sure that students write test cases for the code they write and that these test cases have good/complete code coverage.  The article begins by suggesting that students test their code with the test cases that all other students have written.  This is a powerful idea in that all students get to look at each others' code as well as the test cases that others have written.  It not only expands their thinking about the code, but it also expands their thinking about what makes a good test case.

The authors also discussed the value of using a tool such as Web-CAT to show students what the code coverage of their test cases is.  The tool can be used for grading but it can also be used to show students how well their test cases actually test their code.  That is a bit more than I need, so I plan to take a little time to show the students EclEmma and what a code coverage tool looks like.  The authors also discussed the difficulties doing something like testing other students code with their Runner classes if students do not use the same method signatures or if solutions are only partially implemented and do not compile.

Implementing the Research in the Classroom


I am using the A+ Curriculum for the APCS A class and am very happy with it.  With all of the Java classes my students write for their assignments, there is always a set of starter code for the class and a separate Runner for executing and testing the class.  Some of the assignments specify a complete set of test cases that must be included in the runner and other assignments only provide one test case and direct students to add more test cases.

The next unit we start digging into what reference variables are, although we have been using them for quite some time.  We will look at reference variables and arrays of references.  The code students will be writing is becoming more complex and looking at what constitutes a good unit test of the code becomes increasingly important.  I plan to initially have students work with partners and have each student write the code and a set of tests for the code.  Then they can exchange classes and test each others' code.  Because there is a set of starter code for each assignment in A+.  And the start code includes class declarations and method signatures, students will have the same starting point.  Unless they go in and change method signatures (which does happen sometimes), all students should be able to test each others' code.

Along with that, I will have students setup EclEmma to have them look at code coverage.  The discussion that needs to accompany it will be the difference between code coverage (each line of code is executed) and testing edge cases (what happens with an array of zero elements, one element, repeating elements, etc.).  While testing and code coverage don't seem to be topics that are heavily covered in the AP curriculum, it does seem worthwhile to expose students to these practices.  Testing is a good thing -- even if it is not as popular as THE EGG.

Photo from pexels.com

Sunday, January 6, 2019

Ice Castles and Code Tracing / Reading

Dillon, CO Ice Castle
It's the last day of Christmas break before tomorrow's work day and students' return on Tuesday for the new semester.  It was a wonderful break of catching up with family and friends as well as some fun activities.  Last night was a great final trip to Dillon, CO and a walk through an full scale ice castle (https://icecastles.com/dillon/) with friends.  The ice castle was beautiful with lights coming through the ice making it glow in different colors.  The end product was beautiful, but it was very slowly built up from a set of scaffolding with lights built in and then layer and layer of water turned to ice.  It is  a good metaphor for the building up of skills needed in the AP Computer Science A class.

Also, over break I had the opportunity to do some reading.  One very good blog post from Austin Cory Bart was a CS1 Literature Review (https://acbart.github.io/2019/01/01/cs1-lit-review-review/).  This blog post is a look at what I want to do with one of the topics from the literature  review:  Code reading and tracing. 

Starting the new Semester

I plan to start the new semester with a review activity that covers all of the topics we visited during the first semester with a special look at some of the most complex or difficult parts for the students.  In the non-AP version of programming that I taught in previous years, I did this as a code along activity where we wrote code together to go through these concepts.

Enter the Literature Review...  One of the early topics covered was the importance of code reading leading to good or better code writing.  Code reading is not something I have emphasized.  The concept makes sense.  Students who are good writers also tend to be those who read a lot.  The same concept can be true for Computer Science as well.  Reading code can lead to better writing of code.  Extending that idea, reading good, well-written code is important.  In the same way that reading abbreviated text messages or poorly written text does not lead to good writing skills.

I plan to combine the code reading assignment with think/pair/share which is something I use fairly often in my lower level classes.  The Literature Review also covered the importance of collaborative experiences which is an important soft skill in the working world of IT.

Code Tracing and Reading

One of the confusing points for me was references to Code Tracing and Code Reading as two different things.  So I went back and read one of the research articles, Relationships between reading, tracing and writing skills in introductory programming by Mike Lopez, Jacqueline Whalley, Phil Robbins, and Raymond Lister (https://opus.lib.uts.edu.au/bitstream/10453/10806/1/2008001530.pdf).  To me, code tracing is the equivalent of knowing the meanings of words and code reading equates more to the idea of reading for comprehension.

Code tracing is the ability to read a line(s) of code and explain what it does:
a = 4;
a += 5;
Add 5 to the current value of a which is 4 and set a to the new value of 9.

Code reading is the more advanced concept of looking at a block of code and being able to explain what it does.
sum = 0;
for (int i=1; i <= 10; i++)
     sum += i;
System.out.println(sum);
Sum the values 1-10 and print out that sum.

Beginning of the Semester Activity

With those definitions in mind, I see that my students have plenty of opportunities to trace code but not that many opportunities to read larger amounts of code for comprehension. Students can read small blocks of code such as the example above, but not many opportunities to read an entire class and runner for comprehension.

The code example that I am using is Rainfall.  The class stores the name of a city and an array of monthly rainfall totals.  The class processes the array to calculate min and max months, total and average rainfall and a standard deviation.  The runner class reads in CSV lines from a file and then processes the lines using the comma as a delimiter.  Students will also have the opportunity to review code again that does formatted printing as it is a topic that still confuses several.

The methods in the Rainfall class are things like get1(), get2()... and several variables are set to x and y.  Students will be assigned methods to read and review.  Then they will work with a partner to compare and together assign new method and variable names that are descriptive.  After that I will have the students discuss their assigned methods with the class.

Here are the classes and data file that we will use:
Rainfall.java
RainfallRunner.java
rainfall.txt