Friday, March 25, 2011

Smart Girl!

Eryn wants to know how to code.  I taught her a little bit of Ruby once upon a time (we played with Shoes), but she asked if I'd teach her C# because she knows that's what I used when I did programming for a living (I haven't given her the article "Why We Don't Hire .Net Programmers" to read).  We started out with a simple Console app so we could play around with loops and writing to the console.

int counter = 0;

            for (long i = 1; i <= 100; i++)
                Console.WriteLine(i + " My name is Eryn");
                counter = counter + i;
            Console.WriteLine("Counter is: " + counter);

She was having fun increasing the counter value by a magnitude and watching it hop from 5050 to larger numbers.  But after she threw in a million and waited for the loop to end, she asked, "Hey, why isn't the number as consistent as the other numbers were?"  That's right...she intuitively debugged the fact that the int datatype wasn't sufficient to hold the sum of all the numbers up to a million without creating a problem in the output.  We discussed bugs and what a bug like that might have meant if you were trying to write code for the space shuttle.  Fun!


Anonymous said...

That's impressive! Way to go Eryn!


Bart Flentje said...

I check in every once in a while and my eye caught this post. I too am a .NET developer and got a kick out of your post. My three girls look at the code I write and think I am nuts. I guess no one in my household will follow daddy's footsteps.