Computer Science Teacher

# February, 2008

• #### It's Leap Day - Does Your Software Know That?

Well today is February 29th 2008. A February 29th only comes around once every four years. Or does it? Actually some years that one might think are leap years are actually not. So in honor of today being leap year (and me not being especially creative) I decided to repost something I originally wrote in July of 2006. (I have no idea why I was thinking about leap year in July 2006 by the way.) Perhaps you can use it with your students today since it is a "found day."

--------------------------------------------------------------

I’ve been spending some time over the weekend thinking about interesting projects. I think that the best projects teach concepts in context. By that I mean they don’t just teach a concept but make it real and show how it is valuable. If you can teach complimentary concepts so much the better. Projects that involve If statements or other discussion structures in the context of validating date fit into this category.

One of the things that programmers have to do fairly often is validate dates. Students are tempted to take the easy way out and do a rough calculation: Month between 1 and 12, day between 1 and 31 and not bother checking the year at all. In the real world that will never do. In the real world one has to make sure there is the right number of days for the specific month. Often you really do care about the year as well. But for the moment let’s look at the days in the month problem. The big complication is of course February because it doesn’t always have the same number of days. This means the third commutation is to determine if a year is a leap year or not. Most students assume that any year that is evenly divisible by four is a leap year but that is not quite the case. In fact, pay attention now, years that are evenly divisible by 100 are not leap years unless they are also evenly divisible by 400. So 1900 and 2100 are not leap years. The year 2000 was a leap year though.

Obviously, doing a full verification of dates can be a bit more involved than many students assume. This opens the door to some interesting conversations about how good does validation have to be under different circumstances and can require programmers to write some fairly complex nesting of decision structures. As a teacher (or a tester) doing validation of date checking it also means one has to give some serious thought to test data. Just testing February requires at least four different years: a standard “not leap year”, a “regular” leap year, a year divisible by 100 and a year divisible by 400. This also opens the way for a discussion about how much serious thought has to go into a test plan. It all makes for a project that is about a lot more than just nested If statements.

BTW if you are looking for some reading on why leap year is the way it is you can visit this page on wikipedia or read this classic actual response to a bug report.

• #### Join The Conversation - Girls On The Web and Other Topics

I'm away on a gaming in computer science conference and while I really wanted to have a lot of great blog posts for you all to enjoy and learn from it's been tough getting all the things done that I needed to get done. But I did want to make sure some conversations kept going and perhaps start more.

There has been a lot of discussion about girls on the Internet and them being the content providers. This article in particular seems to have been forwarded to me by everyone who knows I care about getting more girls into the computer field. It talks to girls about some of the reporting by the Pew Internet & American life organization that highlights that girls are creating a lot more (and a lot more creative) content on the Internet than boys. I have to admit that I don't follow enough girls on the Internet to see this myself. A lot of my former, mostly male, students are doing a lot of content generation. But I guess overall things are different.

What are you seeing? And are girls signing up for web design courses to learn or are they all learning on their own? Does this article match what you are seeing in your school, with your daughters, with other young people you know?

The new DreamSpark program (also announced last week) makes some really outstanding design tools available for free. Unlike programming tools more of the professional quality tools for designers seem to cost money. Will girls adopt the Expression Suite of tools or will they not even hear about the program? In any case, my hope is that we can convince girls that there is creativity and self-expression in programming as well as in web development. It's a chance for everyone to put something of themselves into a project.

For the continuing conversation, two posts I made last week seemed to generate more than the usual number of comments and opinions. One was on Programming as the New Literacy. Several people disagreed with me on that one and wrote some great comments with some good links to go with them. If you haven't read the comments please go back and do so - and best of all add your own.

The other post was on the teaching of Intellectual Property and Copyright. Also some strong opinions and some good links by others. This is an important topic and one well worth discussion among students, faculty and the general public. As a published author I have an obvious bias. What about you? Drop by and join in there as well.

And as the saying goes, I'm away so please talk amongst yourselves. :-)