Monday, March 28, 2016

Interesting Links 28 March 2016

Wow! I have a lot to share this week. Please read through it all and I am sure you’ll find something of interest. There is BBS Micro:Bit news for my UK readers, a bunch fo stuff from Microsoft Research that came out last week, and as always some great sharing from teachers!

First thing, in case you missed it, the latest review period, and the first that includes the full draft, of the K-12 CS Framework is now open.

Dan Schellenberg and Garth Flint have been continuing a conversation of sorts on an interesting coding project by looking at it in different ways and with different tools and languages. Read them both for the full value.

Doug Peterson did one of his excellent blog Interviews with Sheena Vaidyanathan, CSTA Board Member and elementary school computer science educator. 

Do you teach CS in lower grades? Take a survey for those who teach computing to kids 14 and younger? It's at: and is part of a research project.

MonoGame 3.5 is now available for download for Windows, Mac, and Linux A cross platform game engine. It’s a follow on of sorts to Microsoft’s XNA.

The BBC Micro:Bit is out and the reviews are starting to come in. Hands on with the BBC’s child-friendly microbit: if you’re an adult you might struggle via @thenextweb I’d say that if you are not a computer person and you didn’t have any professional development you might struggle. Computing At School (CAS) did provide a lot of training abut I know they can’t reach everyone.

In related news, the BBC News is highlighting  seven outstanding Micro:Bit projects.

Microsoft SandDance is a beautiful data visualization tool for chart geeks It looks SandDancevery interesting. The official site is at They are talking about supplying some data sets to play with., Those may be useful for CS classes talking about data.

Jeannette Wing writes about “Computational thinking, 10 years later” in a mostly upbeat article that included the following:

“Still, practical challenges and research opportunities remain. The main practical challenge is that we do not have enough K-12 teachers trained to teach computer science to K-12 students. I am optimistic that, over time, we will solve this problem."

I wish I were as optimistic about the shortage of teachers trained to teach computer science to K-12 students. And of course I know that CT was around before her paper. But it did do a lot to bring it into the conversation.

Thursday, March 24, 2016

Lessons From Two Artificial Intelligences

Artificial Intelligence has been in the news. Last week Google got a lot of great press with some AI software that learned how to play the ancient game of Go. (Google's AlphaGo scores 4-1 against South Korean Go player)  This week things didn't;t go so well for Microsoft Research when they sent an innocent AI on to social media to learn on it’s own. (Microsoft deletes 'teen girl' AI after it became a Hitler-loving sex robot within 24 hours )

Some differences jump out at me that I think have implications for education. The first is how the two AIs, both of which were designed to learn, were educated. AlphaGo was introduced to the best Go strategy available. It continued to learn on its own but under close supervision and guidance. When it started to interact with people beyond the research team it was with professionals who had nothing but good intentions. Things worked well.

Tay was sent out into the world with very little in the way of training. The idea was for it to learn from interaction with people on the Internet. Unfortunately people on the Internet can have goals other than helping an AI learn good and useful things. Supervision seems to have been less close than would have been ideal. Tay learned from people who seemed, in too many cases, to want to mess things up. Things did not work well and the AI was shut down in less than 24 hours.

As I see it having help selecting what to study and who to study with was a huge advantage for AlphaGo. Tay was set lose with no guidance. It had no way of knowing what was good information, who were reliable sources, or how to use the information it gathered. Poor teachers can do a lot of damage to people or AIs. “Teachers” who are trying to steer people wrong can do even more damage.

I suspect that if most people had communicated with Tay in good ways things would have turned out much better. This experiment turned into a game without rules and that is very unfortunate. Though I suspect the researchers learned quite a bit anyway.

An AI can be turned off, reprogramed, and made harmless pretty easily. People not so much. That is one reason I worry and too little guidance for learners. Experienced, generally older, learners have good filters and better insight into what is going on than younger learners of course. Some people are better at discovering things as well. But most people need some help from teachers in some ways. It is important that we pick good teachers.

Wednesday, March 23, 2016

Online Cyber Security Competitions

Computer security has been in the news a lot lately with all the talk of the FBI and Apple going at it in court. Students are interested as well. In the last 24 hours or so information about two cybersecurity and computer science competitions have come across my virtual desk. I thought I would share them with you.

PACTF, short for Phillips Academy Capture The Flag

PACTF, short for Phillips Academy Capture The Flag, is a free online cyber security and computer science competition for middle- and high-school students. Teams of up to 5 competitors will face a series of increasingly challenging problems, in which they must break, hack, decrypt, reverse engineer or do whatever it takes to find hidden answer strings known as flags. Once a team exploits the security vulnerability purposefully left in the problem material, they can submit the correct flag to receive points and improve their ranking. Challenges will be distributed across the spectrum, for beginners and for experts, and they will feature binary exploitation and reversing, cryptography, and other miscellaneous topics. Prizes totaling over $2,000 will be awarded to the top-ranking teams.

imageThe entire competition will be online at
and will last for 3 weeks: April 10–30, 2016.

If you have any questions, please feel free to email us at


HSCTF 3, An Online Computer Science Competition, Running From May 14-21

HSCTF is a free online programming and cyber security competition organized by high school students for high school students. Last year, in HSCTF 2, we had over 2,300 competitors from over 40 countries. Competitors in High School Capture the Flag (or HSCTF) will learn computer science skills, and use ingenuity to discover a series of increasingly hard to find "flags" encrypted, hidden, or otherwise stored somewhere difficult to access. HSCTF includes topics such as computer security, programming, algorithm design, and programming language design. Previous prizes totaled over $1,000 and assorted Facebook swag.

The HSCTF team will be releasing a substantial set of practice problems on April 8th. We will also be available for video conferences with teachers, classes and clubs in the intervening time until the competition to go over problems and answer any question you may have.image

You can sign up for email updates from our website, If you have any questions, you can email us at

Tuesday, March 22, 2016

Post Number 1000

About two weeks ago I realized that I was approaching 1,000 posts on this blog. Most of these have come in the last three and a half years since I left Microsoft. This is really the second version of the blog I started while I was working t here. Since that was a Microsoft owned site I lost access to it when I left the company.  I thought maybe I should try and make post 1,000 something profound and important. I couldn’t decide what that should be though.

I thought about doing a post on artificial intelligence. And I though about doing a post on diversity in computing. Or the future or robotics combined with AI. Ultimately I decided just to write about a few lessons learned from blogging.

First off maybe around the reason I have a second version of this blog - never run a blog on a site that is dependent on your employment with a specific company. Oh you may be required to blog at a company site. I have an obligation to blog at the CSTA Voice blog because I am on the board and that is fine. But if you want to blog about things that interest you and that is an extension of you than you really want to keep ownership of the blog. You might get extra attention or traffic on a company site but in the long run your life and your work should be about more than the company you work for.

Secondly, you never know what is going to get attention. For the last year the post with the most traffic on my blog has been Interview Questions for Computer Science Teachers and I have no idea why. Second most is Programming With Blocks  or Drag and Drop programming but I think I know why that is. It talks about a lot of products that people search for. Search engines are responsible for something around 60% of my blogs traffic. Their ways are mysterious.

Something of a corollary to the last lesson is that you never really know who is reading your blog. That person you know personally who you think of as your natural audience may not be reading. That famous (for some definition of famous) person who you think would never notice you might be a regular reader. The only ones you really know read are those who leave comments or who tell you at the occasional face to face meeting that they read. The message here is don’t worry about who is reading. Never get upset when you find out someone isn’t reading or get too excited when you find out someone you are impressed with is reading. OK you can get a little excited when someone “important” reads but never think poorly of yourself if that never happens.

Blog statistics are useless. They are amazingly unreliable. I look at two sets of statistics on this blog. They disagree by an average of 7 times. That is to say that one of them reports 7 times as many readers as the other. Just like you should not get worked up over who is reading or not you should never get hung up on how many people are reading. If you help one person with a post once in a while it’s worth it. In fact if you help yourself by making it easier to find things or by working though an idea by writing it out its worth it. In some ways blogging is its own reward.

Comments are awesome!  Comments are how you really learn as a blog writer. Sure sometimes someone will really challenge you. They will tell you that you are wrong and why. Read those with an open mind. You may actually be wrong. It could happen. There is no shame in learning and changing your mind based on new information. Other comments will be in support of your ideas but will take them in new or improved directions. That’s terrific. Blogger says there are about 1,029 comments on this blog. More than one per post but many posts have no comments. Some of the comments were written by me and maybe they should not count as much. But they are part of a conversation and that is where the value is.

Blogging at it’s best is a conversation. Maybe it happens in the comments. Maybe it happens with someone else writing a related post and linking. Other times the conversation happens on Facebook or Twitter (both see announcements when a blog post shows up here). Sometimes it happens via email.  Sometimes it actually happens in face to face communication. Imagine that! And sometimes it is really a conversation the author has with themselves.  At its best it happens in multiple ways.

Thanks for reading.

Monday, March 21, 2016

Interesting Links 21 March 2016

It’s Spring! And as I work on this Sunday afternoon I am wondering if we will have enough snow to cancel school tomorrow. I’m thinking we will not but it’s still fun to think about. Computers have make weather forecasting a lot more accurate but the weather has a knack for changing direction is ways we don’t predict that well yet.

Speaking of computers, here are some links that may be of interest to you.

The ACM, CSTA,, NMSI, and Cyber Innovation Center invite you to review the first full draft of the K-12 CS Framework. See the review instructions at

Alan O'Donohoe ‏@teknoteacher shared some interesting looking Python resources. 10 Python Teaching Resources You Really Should Be Using and the Micro:Bit Python cheat sheet


This EdTech Conference Puts Teachers Before Tablets is a nice article on Forbes about the conference Microsoft ran for/with teachers around the world recently. It really is as much about the teachers as the technology.

2 weeks to take advantage of early bird registration for the 2016 CSTA Annual Conference. Workshops , Sessions, keynotes, BOFs & playgrounds! Hope to see you there!

Will robots care for elderly?  And if they do is that good or bad? Good questions to discuss with students.

Apple vs. FBI: this is just the beginning by @hadip Hadi Partovi talks about the deeper issues of this controversy and what it tells us about the need for computer science education for everyone.

Math Teachers Group Questions Allowing Computer Science to Count as Math Credit  via @educationweek Well of course they do. A lot of this is about turf of course. Math teachers don’t want to lose courses but there is more too it than that. What it really means is that CS has to be required as computer science.

Computer Science is Changing Everything is the new CS promotional video from @codeorg And its a good one!

Via @NPR: Can Computer Programs Be Racist And Sexist?  Short answer – yes it can be. This is another example of why we need more diversity developing our software.

[Resource] Over 16GB of high-quality, royalty free sound effects to boost your game development projects 

There was a lot of attention being paid to Google’s program AlphaGo taking on one of the world’s best Go players and winning. For example, Google's AlphaGo scores 4-1 against South Korean Go player But is AlphaGo the solution to artificial intelligence? This article Why AlphGo is Not AI argues that it is not even real artificial intelligence. Great topic for discussion with students.

I’ll finish up with this cartoon from Hugh MacLeod that has had me thinking a lot lately.

Friday, March 18, 2016

Review Period Open for First Full Draft of the K-12 CS Framework

Writing the K12 Computer Science Framework is an ongoing effort by a writing team of several dozen computer science educators with review and advise from many more. A month or so ago the first, but incomplete, draft was reviewed. The writing teams have worked for several weeks to incorporate those suggestions and complete a full draft. Well it is ready for review. Will you help with the review?

The ACM, CSTA,, NMSI, and Cyber Innovation Center invite you to review the first full draft of the K-12 CS Framework. See the review instructions at

The review period ends on April 5th. Your feedback in the online form will help us improve the framework - what works, what doesn't, and how to improve. On behalf of the K-12 CS framework writers, thank you!

Tuesday, March 15, 2016

Maple Syrup and Coding For Fun

It’s maple syrup time in New Hampshire where I live. My wife and I with some help from the neighbor kid decided it was time we got in on the fun. TreeSo we bought some supplies and tapped a couple of trees. The picture on the right is one of those trees which happens to be in my back yard.

Now sugaring on this scale is not a great way to save money. In fact the supplies we bought to get started would probably buy us several gallons of the stuff and we hope to get a couple of pints this year. While the supplies will last us for years it would take quite a while for it to pay off. And that is not including our time and efforts. It can be a labor intensive process. So why do it?

There are actually a couple of good reasons to do it. One is that it is fun. We pay for fun right? Another is that it is educational. We’re learning a lot about how sap flows, its relationship to weather, the process of boiling sap down to syrup (5 gallons of sap gave us about a pint of syrup), and more. There is also the intangible but very real satisfaction of creating syrup from our very own trees and effort. We’re not saving money if all you take into account is the syrup but that doesn’t mean we are not getting real value for the money (and time and effort.)

By now, assuming you haven’t left after thinking you were reading the wrong blog, you are wondering what this has to do with computer science education. Valid question.

Lots of people get hung up on the idea of computer science and learning programming being all about the money. How often do you hear someone talk about creating the next Bill Gates? Computer science is a lot more than that for me. I write code for fun.

Oh sure I am usually trying to solve some “problem” for myself but in terms of cost benefit there are often more cost effective ways to do things. I wrote a phone app to help we track my rotating class schedule at school for example. The information is all available on a webpage and I could get it that way. It’s a little easier with the app but it took some real effort on my part to write (and keep updated) the app. It would probably not be workable if I had to pay for my time. Not when you compare what I charge for writing code with what I get paid for teaching. Smile 

I also have a number of students writing code for projects of their own. Mostly they are writing games. Now the games they are writing can not compare with the games they cold buy by just about any measure. If you figure the pay rate they get for their part-time jobs they could buy much more sophisticated games for a few hours of paid work. Far fewer hours then they are spending on their personal coding projects. So why do they do it?

For many of them the creation itself is fun. The journey being as important, if not more so, than arrival at a destination. And they are learning things. Students actually like learning. They may not enjoy the process and that sometimes colors their view but really they do want to learn. There is also a level of personal satisfaction in creating something even if only for personal use. As a teacher I really enjoy helping students with these projects BTW. So much of life’s learning takes place outside of a formal classroom.

Most of my students will not go on to be professional software developers, university researchers, or other computer science professionals. And that is ok. What they will all have, if they work at learning and retaining, is a skill they can use in other ways. They will be able to have intelligent conversations with developers. They will have a deeper understanding of what software can and cannot do. They will have the knowledge to make better use of the software others write. Understanding programming can really make a difference in using search engines, spreadsheets, database applications and much more.

And some of them will code for fun. I sure plan on doing so for the rest of my life.

Monday, March 14, 2016

Interesting Links 14 March 2016

  The US went on to Daylight Savings Time over the weekend. Most of my devices updated their clocks automatically. How that happens is an interesting discussion. Did you know that companies regularly have to update their software to account for countries changing how and when they change time zones? It’s something most of us have come to take for granted but it can be a major headache for software companies. BTW Doug Peterson has a blog post about this very topic to start my interesting links post today.

My social, daylight saving, error correcting friends

More and more states are jumping on the computer science for everyone bandwagon. Code.Org announced two states last week:
And more people are writing about how to bring CS to individual schools and districts - A Simple “Algorithm” for Bringing Coding to Your School @WiseStamp

In the United Kingdom where they jumped on the CS for All train earlier people are realizing that “Delivering computer science is 'challenging' for schools’

An article on Fast Company asks the question I and a lot of other people are asking -As schools put more emphasis on CS, how are we teaching TEACHERS to code?

What is Computer Science Principles? a video from @codeorg My assistant principal wants to see us add this course to the schools program of studies. Are you adding it at your school?

Build it, run it, host it on Azure – make a Web game live in under an hour! This video is on my things to watch for this week. The cloud is the big thing and I need to learn more about it.

Closing today with a quote from Patrick Larson, a local assistant superintendent of schools who is active in social media. Are you promoting your school and its programs on social media?


Thursday, March 10, 2016

Virtual Reality and Augmented Reality in Education

Virtual Reality and Augmented Reality - what is their future in education? Last year at ISTE I saw a number of exhibits of educational uses of virtual Reality. And of course there has been a lot of talk about Google Cardboard and Google Expeditions since they were announced. The hype is building. So I’m thinking. Sort of out loud in this blog post.

I wonder how it will play out though. The tools for VR, Cardboard not withstanding – you do still need a smart phone to use it, tend to be expensive. More importantly there isn’t a lot of content out there yet. I say “yet” to be optimistic. Virtual field trips sound cool. It will be a while though before it is just like being there.

Teaching computer science the uses for VR and AR don’t seem as obvious as they do for social studies or biology (virtual tour though the body anyone?) or several other subjects. Can we use VR to travel though recursive processes I wonder? Or even a CPU? Maybe. And maybe it would be cool. Possibly even helpful. Content will take a while. Maybe that is where the potential is for CS educators.

The tools for virtual reality and augmented reality are computer driven. Could we have CS students generate content? Or tools for generating content? Maybe. Assuming we have these students long enough for them to learn the tools they need. One teacher I talked to is using Unity and Minecraft to have students build content for Virtual Reality.

I’ve had students in the past create adventure-style games to do simple tours though a building. We’ve got a lot better tools for capturing and displaying video so maybe there is a next step. Though we have had 3D imaging for a while and we never saw the amazing things that seemed to promise. I’ve seen so many things over the years fail to live up to their promise that I tend to be a bit of a skeptic.

Ultimately VR and AR (which I expect to trail behind VR but which may have even more promise) to be things we have to talk about in computer science classes. One educator I talked to thinks that “the initial use [of VR] will be demonstrating the power and applications of technology.” That may be the case and that is valuable in CS classes. We have to look longer term though. We also have to start having conversations about the ethical and social complications of VR and AR.

Right now I don’t hear a lot of conversations about what those complications will be. They are not all knowable either. But thinking about them now will be helpful later on. And that is important.

Wednesday, March 09, 2016

Try Not To Be Boring

Every morning while I eat breakfast I view a few things on the Internet. Dilbert is one of them. Sometimes I find things that apply to teachers as well as managers.

Try Not Being Boring - Dilbert by Scott Adams

I thought I was doing so well as I created my wonderful PowerPoints to explain various programming topics. I mean they really looked good. Students didn’t seem to be getting things though.  I finally decided to try using more worked examples – doubling up on the worked examples rather than talking at students. This seems to be working better.

I still have the PowerPoint decks and the recorded talks I made with some of them. I think they have value for review and as references. But I’m not talking to the slides as much as I used to. I’m just not good at making “fifty slides of pure excitement.”

Tuesday, March 08, 2016

Who Needs a Real Class To Learn Computing?

You hear it all the time “all the resources you need to learn computer science are online!” and “you can get help from professionals in online forums.” Sure you can. It’s all true. Does it work in real life? Absolutely! Does it work for everyone? Not a chance! Will it work for you? Who knows!
Ok now the details. There are a lot of online courses one can take. And people do take them. Completion rates are abysmal though. Let’s face it they don’t work unless a student is highly motivated. One also has to know they are interested just to sign up. That means they are not so good for getting people interested in the first place.

Asking for help online is even more problematic. This article - Friction Between Programming Professionals and Beginners – goes into a lot of detail and I recommend it. The tl;dnr version is that professionals can be very impatient, even nasty, with beginners. And that makes things unpleasant for many. You need a thick skin to ask for help online in far too many cases.

Beginners do best, I believe, with a patient supportive mentor. It’s hard to find one of those online. In the classroom they are the norm though. A classroom teacher, teaching face to face, can do a lot that an online class cannot do as easily. Projects can be more easily adapted or adopted that meet the interests and needs of a particular class. They can even be personalized to meet the different learning styles of individual students.

A classroom teacher is bound to be more supportive of “stupid questions”, of repetitious questions, and of questions that are poorly expressed. Being a teacher is more than being an expert in the material – it means being an expert in explaining things. I’ve done a lot of trying to help students/beginners online over the years. It’s a lot easier in person though.

What I think it key though is that in school one can have required courses. A well-designed course with a good teacher can really spark an interest in a subject for a student. And even more importantly a good teacher can help students to continue when things get frustrating. And things do get frustrating while learning computer science.

So while online can be useful, and after school programs can be great, what students really benefit from is a face to face class with a good teacher.

Monday, March 07, 2016

Interesting Links 7 March 2016

Well last week was a busy one. I spent the first few days in Memphis working on the K-12 CS Curriculum Framework. (Blogged about that at Writing the K12 CS Framework). Then school. Saturday I attended an unconference – EdCamp Boston. Speaking of conferences I have a reminder of the Annual CSTA Conference at the bottom of this post. I hope to see you there. And now some interesting links for you to check out.

App Lab in the Classroom a YouTube video demo from @codeorg It’s been suggested I use this for my mobile app development class next year. Anyone else using it?

Cryptography Pioneers Receive ACM A.M. Turing Award  The Turing Award is the Nobel Prize equivalent for computer science. Whitfield Diffie,and Martin E. Hellman were awarded for their critical contributions to modern cryptography specifically public-key cryptography and digital signatures.

Traffic Light Remix  This is great. Riff on riff on a project Sharing what we do helps everyone.

Microsoft Launches Pre-Orders For $3,000 HoloLens Development Kit, Will Start Shipping March 30 via @techcrunch What is the role of virtual reality in education? A lot of people are looking for answers to that question.

How to set up your own Raspberry Pi  web server: These little devices seem to be able to do a lot. See also Get Rolling with Raspberry Pi and Windows 10 in 5 Minutes 

For Elementary Schools, the Search for an Ideal Coding Curriculum Is Far From Over   via @EdSurge I would say it is just beginning.  

I’m still keeping an eye on BBC Micro:Bit stuff in the UK.

Teachers are getting samples and trying interesting things. Look at this cute Micro:Bit robot created on a Hackaday

Or print this poster explaining the BBC Micro:Bit functions in the CodeKingdoms editor More information about Code Kingdoms is at


Saturday, March 05, 2016

Trip Report–Ed Camp Boston 2016 – #edcampBOS

I spent most of today at one of the Microsoft offices in Cambridge MA for the Boston EdCamp. EdCamp is an unconference about education. Not much (well really none) about computer science but a lot of teaching in general and using technology in specific. It’s always interesting to see/learn what others are doing with technology in education.

A few general observations before I talk about sessions I sat in. First off a lot of people have Twitter usernames on their badges. There is a of tweeting going on using the #edcampbos hashtag. So even if you are not here you can see some of what is going on. If you are here you can see that some other session may be more interesting than the one you are in so you can move.

Another common thread in sessions is learning being fun. There is a lot of talk about how things are motivating and fun for students while they are learning. Seems like a win to me. Also teachers here are clearly all about learning and not grades. Principals are as well. Parents and students seem more interested in grades though. I hear that a lot.

logo[2]I first went to a session on Voxer. The people using it seemed very excited about it but I can’t say I caught the bug. Anyone using it for sharing ideas about computer science?

From there I moved to a session on Augmented reality. I missed the beginning of that because of the Voxer session. Again a lot of enthusiasm for things like the Google cardboard and Google Expeditions but the reality of AR in education seems not to be there that much. But people are thinking about it, trying things out, and looking for ways to add depth to education though technology. I think maybe this will happen sometime. I don’t think we’re there yet.

Minecraft in education was next. I still don’t get it. Kids love it but what are they learning? Answers include a lot of soft skills such as teamwork, communication, problems solving and that sort of thing. It’s great that kids are enjoying themselves and that they are learning these soft skills. In general it feels like a solution in search of a problem. Or more specifically teachers are seeing something that students are highly motivated to use an looking for ways to connect it to the curriculum. Other than creating mods and introducing programming via Minecraft most “solutions” feel like a bit of a stretch to me.

A session on green screen video making seemed to be a lot more connected to curriculum than I expected. The important thing about using green screen is the work that leads up to it. The research that students have to to to write their scripts or collect their background images and videos is where the learning happens. Creating the movie is the incentive or an additional motivating factor is getting the students to do the work. The videos they create mean there is an audience of sorts and a lot of students really like that. I’m thinking about adding some green screen work to my unit on video editing in my explorations in CS course.

After lunch was a session on Genius Hour sometimes called 20% time after Google’s famous (and as much legend as reality) program for their employees to do things other than their main job but that they are passionate about. It In my classes I try to fit in as much “pick something you really care about” sort of thing in to projects already. Is that Genius Hour? Not really but I think it has some of the same benefits. One of the big issues with these Genius Hour programs is connecting them to the curriculum. An other common thread today. And one not always easy to answer.

Last session of the day for me was about student tech support programs. We’re starting one where I teach so that was a natural for me. A number of middle schools have student help desks which surprised me. At some schools Help Desk is a for credit course. For some in middle schools students give up recess time several times a week. In any case students are trained in the apps or other software that are used by teachers and students. Help desk students can do more than just help teachers with problems. They can help younger students learn apps (especially in elementary and middle schools), create teaching videos, blog about resources and generally get more involved in technology integrations. I see that as an exciting piece. It would be great if we got more of these programs going.

Overall a good day of learning for me. I love this unconference model. We need to do one with a specific computer science education some day.


Tuesday, March 01, 2016

Days, Weeks, Months, and Leap Years

Yesterday was Leap Day – 29 February – a day which only comes along once every four years. Or so. It’s actually more complicated than that which we’ll get to in a moment. What this means for me is, you guessed it, programming projects.

Leap Year FlowchartI’ve used the old “is this year a leap year” for decision statements for years. Dan Anderson tweeted out a very clear and helpful flowchart for this task.

That one is going up on my bulletin board and will probably show up in a lecture as well. Great stuff.

But there is more. Doug Peterson has a blog post about leap year and counting days. (February 29) In the post he lays out a set of programming projects of increasing complexity. He starts with counting between two days in the same month and works up to calculating the number of days between any two days crossing century boundaries. Yeah that one is going to be some work. Doug and I had a twitter conversation and I started working on this problem in preparation for assigning it to my students one of these days.

One reason one does this is to learn what problems students might run into. Another is to see what shortcuts they might find.image In this case I found several starting with the MonthCalendar object in .NET. That takes care of pretty much the whole validating the dates issue.

Next it turns out that there is a DateTime object that allows for subtraction and returns a value of type TimeSpan. It’s a simple matter to get the time span in days from that object. So rather than a very complicated set of methods with decision statements and data checking and worrying about leap years the whole project can be completed in three statements. Possibly fewer if you don’t care about readability.

I’m going to have to be very careful about how I specify this project if I want students to do things the “hard way.”