Thursday, 28 August 2008

Start 'em young

My 6.5 year old son was off school sick yesterday. I decided it's time to introduce him to the joys of coding. What better language than Logo to get someone started. I know, I know, it's really a symbolic processing language with a noble Lisp pedigree and so much more than turtle graphics, but turtle graphics seemed like a good place to start.

We used a browser-based Logo implementation at http://www.calormen.com/Logo. It's a site that won't win any beauty contests, but it seemed fairly functional. I explained the underlying metaphor of the turtle with a pen that can be raised or lowered and showed him how to draw a few simple things by a sequence of commands e.g. fd 100 rt 90 fd 100 rt 90 fd 100 rt 90 fd 100. That seemed to make sense once I explained how 90 degrees meant going from vertical to horizontal. This is the kid who asked me when he was four if two dots could ever make a curve, so I figured he'd be good.

He immediately wanted to try a few things, like moving the turtle forward 1,000. I just let him try and see. Whoa! The turtle goes out of the visible region. We cleared the screen (cs) and tried some more things. What happens if you go forward a really large number like 100000000000000. I was expecting an error but no it just went out of the visible region. What happens if you turn right one degree and draw?

Interestingly he said he was "asking" the turtle to do things although after listening to me referring to "commands" he started to say he was "commanding" it to do things. I left him to experiment on his own for a while.

Perhaps next time we'll do some control structures. Perhaps something simple like repeat 4 [ rt 90 fd 100].

Friday, 1 August 2008

F5 / F9

I am slowly but surely going mad. I am currently grafting some lovely shiny C# 3.5 code on to the side of our legacy Delphi.Win32 code. This means working in Visual Studio and the Delphi IDE simultaneously.

I doubt that I will ever love the Delphi IDE. OK, I am still annoyed that it was crashing 20 times per day (literally -- I took to obsessively recording them) until I applied the service pack, but at least it's stable now. The IDE lacks the most basic functionality: no moving the cursor back to a line before this one, no clicking on a point in the call stack and having it set the frame so you can inspect variables at that point, no examining the values of variables if an exception gets thrown. Still, I don't have to love it. Delphi is obviously circling the drain as a development environment. Their latest schedule of coming features makes it obvious they are a few years behind the curve. Coming real soon, Unicode strings! 64 bit will have to wait until the time of our children's children.

But that's not what's driving me mad. It's the F5/F9 thing. In Visual Studio F5 is run, F9 is set breakpoint. In Delphi it's exactly the opposite. For the past twenty odd years, I have used IDEs where F5 means run, so it's now burned into my brain. Having F5 mean "insert breakpoint" just seems profoundly wrong.

There doesn't seem to be a way to remap the keys in Delphi beyond choosing a Visual Studio emulation mode (it doesn't specify what version of VS). I could remap the keys in Visual Studio, but VS has things the way I like them.

In the interests of fair and balanced whining, I should point out that even Microsoft can't decide about the whole F5/F9 thing. I usually have a folder open on the Global Assembly Cache. I have to hit F5 to refresh it. In Outlook, refreshing (checking for new messages) is F9.