Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

October, 2011

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Quality of Testing and Quality of Code

    • 7 Comments

    I see a good number of Tweets in my Twitter stream that just flash by without leaving any impression. Chatty comments between people I barely know (if at all), links to things that don’t really interest me, and other items that really don’t have a lifetime beyond a few minutes after they are sent. But enough them really do make me think or take action that it makes Twitter  pretty useful for me. Recently I saw the following Tweet from Eugene Wallingford.

    image

    Student developers do “interesting” things. For example many of them try to write the whole project before starting to test. Oh they may run the compile to check for syntax errors – as if a program that compiles cleanly will automatically work correctly. And then they start to test. This seldom goes well because there is just much too much to test all at once. Especially for a beginner finding logic errors in a (theoretically) complete program is just too complicated. What makes it worse than just the quantity of code (which let’s face it is not all that much compared to a professional program) but the number of code paths (i.e.. places for things to go wrong) that is just more than a beginner can trace in their heads. Yes, in fact, a beginner writing code this way means that the quality of the code may just not be good enough for easy testing. The result is a long and painful testing process.

    Experienced programmers test small pieces of code. The fewer code paths the easier it is to design a set of test data to test them all. This, test design, is not something we tend to spend much time on in introductory courses. Or perhaps in anything other than a software engineering course which is a shame. I think we could save a lot of students a lot of heartache and perhaps reduce attrition (theory of mine) if we taught them how to test earlier.

    We ask students to do a number of things when creating their own software. I tend to start with three large items:

    1. Understand the problem
    2. Design a solution (algorithm)
    3. Code up the solution

    Many start the testing thinking during (or worse after) the code up the solution part. Not a good idea. At the latest we need to start thinking about testing no later than design a solution. In fact if we understand the problem we should already have a handle of testing. At that point we should know  - what is the right answer for various inputs? What values should be outside the range of what we want to handle and how should we deal with them? In short, testing data is all part of understanding the problem. This understanding should directly lead to test data. Much of this test data would should manually run through our algorithm before we code solutions. When we test our data with the code the results we achieved during manual testing of the algorithm should match.

    Reducing the pain of testing requires several things of which having good code is just one. It’s one important piece of course but not the whole piece. Having good, solid testing data with known expectations of results is a piece. So is testing small pieces of code so that fewer things can go wrong. The fewer the places for things to go badly the easier it is to find and repair them. By coincidence (not) breaking ones code into smaller, more manageable and testable pieces almost invariably results in better code. Sections of code that are too long and that try to do too many things in one module are the huge run-on sentences of programming. In natural language writing run-on sentences are a “bad thing” and make understanding difficult for the reader. Modules of code with too many lines make testing and understanding difficult. They also make modification, expansion, reuse, maintenance and all sorts of other things difficult if not impossible.

    The first programming course is a difficult course to design. Students have to learn a whole new way of thinking as well as a new language in which to express their ideas. That alone makes it difficult. And then there are so many things that we could make an argument belong in the first course. I could see a first course that is four years long if we tried to get it all in. So by necessity things get left out. I am thinking, at this point in my life, that testing is not one of those things we can afford to leave out though. Not that we spend forever on it of course.  I also don’t think it is a separate unit either. Rather I think it is something we talk about as we talk about other things. Include it is the discussion of understanding the problem. Include it with designing algorithms. And include it when we talk about writing the code as something more than just having the compiler check the syntax. It it means that something else waits until a second or third course so be it. On the other hand I wonder if doing better testing and including testing thinking in the whole process might just reduce the amount of time student projects take to complete. It’s a theory. What do you think?



  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Preparation to Teach High School Computer Science

    • 4 Comments

    “What qualifies you to teach computer science?” The question took me off guard. The tone as much as the words seem to be more of a challenge than anything else. The man who asked it was visiting the school where I was teaching during an open house for prospective students. Private schools, such as that one, really have to sell themselves to parents so questions about qualifications are important. My reply what that I had a Masters in Computer Science and 18 years as a professional software developer. That seemed to satisfy him much to my relief. That sort of formal experience is rare in high school computer science teachers though. After all there are lots of opportunities for such people in industry. One has to make a life style decision to take a teaching job with that sort of background. I know a number of people who did just that and I have great respect for them. One day I hope to be back full-time in the classroom myself. It was a rewarding time for me. But this brings up a good question, one of several things that Garth Flint brought up in his post - What we need for CS Education to happen. That question is “how much preparation does someone need to be a good high school computer science teacher?”

    A lot of schools seem to believe that having a FORTRAN course 20 years ago when one was an undergraduate Math major is plenty. At least that appears to be the case from some of the stories I have heard. The truth is that since there are few standards for what is required schools, districts, etc. are free to set their own standards. Some schools set them very low. I assume some set them very high – perhaps too high. There aren’t a lot of guidelines to help them out though.

    I do believe that some formal training is a good requirement. Some professional development experience is helpful but not required. Nor is it generally sufficient. Knowledge along does not make a good teacher as a lot of people who have attempted the move from industry to education can attest. Some training on how to teach computer science is really helpful. I learned it mostly from a good mentor. Not every school has a senior CS teacher to mentor the new teachers though. We could use a lot of research based training as well. Mark Guzdial talks about that on his blog. Most recently at Learning how to prepare CS HS teachers: Why computer scientists have to get involved. There is no where near enough of that research going on and I agree with Garth that we can’t wait for it. We have to start training more CS teachers now. But what do they require?

    A Masters Degree? Great but not really required. A four year bachelors degree in CS? Would sure be helpful but required? Maybe not. The AP CS course as it stands now is an attempt at a first computer science course at the university level. For most high schools this is as advanced as it gets. (Though not at all of them.)  I guess in theory a thorough grounding in this topics would be enough but in practice I think it is far from enough. The old AP CS AB course included data structures which usually makes up the second university computer science course. That’s still probably not enough for a teacher. I’d like to see at least one more course, perhaps one in programming languages, as well as a course in software engineering. A web development course would be a good thing as well. So say four CS courses, a teaching CS course as well as some general education courses might be a good start. This is not dissimilar from an Endorsement In Computer Science Education program LEADING TO TEACHER CERTIFICATION FOR GRADES 6-12 available at Kennesaw State University in Georgia. My recollection is that this program was designed about the state certification standards in Georgia. As an endorsement program it requires that teachers already have a certification in some other field which is, in my opinion, somewhat unfortunate. Some people don’t really want to jump through the hoops to teach other subjects.

    I don’t know of many other programs like this though I suspect that Georgia has others. Outside of Georgia I have no idea though.  It’s a chicken and egg problem. Universities don’t design endorsement programs if there is not state certification standard. States tend not to set standards for which there are not training programs. In Georgia the state education people worked hand in hand with universities and the designed both the certification and endorsement program in parallel. It’s an example that perhaps more states could look at. It’s a start.



  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Be The Robot

    • 2 Comments

    One of the issues with computer science is that some people would rather move atoms than pixels. That is to say that virtual objects, even if they involve images on a screen, are less compelling to some than physical objects doing actual work in the real world. Robots have long been involved in the connection between real and virtual worlds.  How do we control those robots? How much autonomy is there and how much is machines responding to direct human control? Well that all depends. Some tasks are easily programmed and easily done by “rote.” Others have too much variability or require to much in the way of functions, vision comes to mind, that are not as easily programmed. So in  many cases there is a mix. The FIRST Robotics competition includes just that sort of mix. The event starts with a short period of autonomous action followed by a period of remote human control. This works out to create some interesting software developments. The 2012 competition will be adding a new wrinkle though. Microsoft is donating a Kinect device for each team to use. The idea is to allow the robot to become more of an extension of the human player. In a sense, to allow the human to “be the robot.” Some stuff from the press release.

    In the 2012 FIRST Robotics Competition, teams will be able to control robots via Kinect. They will be able to either program their robots to respond to their own custom gestures made by their human teammates, or use default code and gestures. The added ability for teams to customize the application of the Kinect sensor data is a valuable enhancement to the FRC experience.

    This is pretty exciting. During the autonomous period team members will be able to provide some guidance to one (of the three on a team) robot by moving their bodies. Gestures of various types either from sample code that will be supplied or custom code developed by team members will be used to give direction and activity for a robot. Some interesting possibilities. An additional possibility that is not obvious to me from the press release is that a Kinect could become part of the robot as well. Oh there are power concerns, issues of weight, and a small matter of software to make it all work but FIRST students are amazingly clever. So between all the possibilities I can’t wait to see what these students come up with.

    I understand that some teams are getting early hardware so that they can take part in a beta program. FIRST usually runs some sort of beta in the fall before the regular season starts so that they can test new hardware, new software or other new ideas that will probably be part of the new season’s game. Also some software is being developed to act as a starting platform for student teams to use and build around. I don’t know yet when this software will be available though. Not that teams have to wait for this to start experimenting on their own of course. Established teams often have robots from previous competitions to experiment with. The Kinect is not an expensive device and the software to develop for it is free. The Kinect for Windows SDK is a free download and students can either use the Visual Studio Express editions in C++ or C# or Visual Basic to develop. Or high schools can sign up for DreamSpark to get students free professional development products from Microsoft.

    Related links:



Page 1 of 6 (18 items) 12345»