# Friday, 17 October 2008

The concept of "a whole bunch of thingies" is a vital one in just about every programming language. Some languages support it right in the language itself. For example in C++ you can have an array of integers, or Employee objects, or Customer pointers. And when you use an array, you know that it's a continuous block of memory, and it's possible to interact either with just one element of the array or with the entire array. VB has arrays, and so does C#, and while the syntax is different between them, the essential concepts are not.

The thing is, an array is only the simplest and most accessible way to say "a whole bunch of thingies". It's important that you learn other ways to express that concept - typically by using a class of some sort that someone has written to represent it. There are a ton of these depending on whether order matters to you, does insertion speed matter more than traversing/iterating speed, and so on. Some folks, having learned one way to say "a whole bunch of thingies", look at all the other options, roll their eyes up into their heads, and stick with the one way they know.

This is bad. Not just because your code could be faster, neater, and easier to write, but also because arrays are really poorly suited for certain tasks. They especially hamper parallel programming - and you know that the future is concurrent, right?

Eric Lippert has written a cogent and compelling explanation of why arrays are rarely the right choice, and what you should do instead. It's written, naturally, from a C# perspective, but it's applicable to C++ and VB too. It boils down to this: Object Oriented Programming is the norm. Start trusting object writers. Use a class that someone else wrote and provided with your compiler, and you'll be a happier developer. And if you don't have some neurons fire over the phrase "considered harmful", here is a history lesson on that.

Kate

Friday, 17 October 2008 14:07:24 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 16 October 2008

With every year that goes by, I of course get older. But I tend to feel older in bursts that are further than a year apart. Like when I first had a student in a class of mine who was born after 1977, which is the year I started university. Or when someone asked me where to get that special .NET utility "xcopy" so they could take advantage of "xcopy deployment". (Hint: it came in very very early versions of DOS. Pre Windows.)

But it turns out some technologies are not only older than when I started in this business, they're actually older than when I was born. Video games are 50, and I am not.

The circular inset shows an oscilloscope that was hacked up to let people play "tennis".  But not like Pong, from above - this was from the side. From the CBC article:

Several weeks before the annual visitors' day in 1958, Higinbotham decided to liven things up. While reading through the instruction manual for one of the lab's analog computers, he found a description of how the machine could calculate ballistic missile trajectories.
With some minor programming modifications, he discovered that he could turn the ballistics demonstration into a manually-controlled game resembling tennis. Higinbotham had Dvorak hook up the computer to an oscilloscope, a five-inch screen used to display electric voltages, and add a pair of box-shaped controllers, each with a knob and a button.
The resultant game resembled a tennis court, as seen from the side. A horizontal line represented the court while a short vertical line in the middle was the net. Players could control the ball's direction and speed with the knob on the controller and hit it with the button.
"Tennis for Two," as it was dubbed, was a simple reworking of the analog computer's basic functions. To Higinbotham, it was no big deal.
"He didn't think there was anything new in there because he just used the circuits that were explained in the manual that came with the computer," says Peter Takacs, a physicist currently working in Brookhaven's instrumentation division. "He just took those circuits and figured out how to wire them together that would allow two people to hit a ball back and forth across the net. He didn't really think that was such an innovative thing."
Dvorak Jr. says the whole point of the game was to simply show off the capabilities of the hot new technology of the day.
"The whole idea was to show the public what a computer was, what it could do," he says. "From the perspective of society, he had no idea what he was doing."

Really cool.

Kate

Thursday, 16 October 2008 13:50:54 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 15 October 2008

Normally I read Joe Duffy's blog for the concurrency goodness. But like most people, he has opinions that range quite a bit broader. His take on "what is an architect?" is really interesting reading. It's several pages long: here are the subheads:

0. Inspire and empower people to do their best work.
1. Oversight, but not dictatorship.
2. Taste is a hard thing to measure, but is invaluable.
3. Write code and get your hands dirty.
4. The power of the dyad: know your weaknesses.
5. It's for the customer, not you.
6. Admit when you're wrong, fall on your sword, and then fix it.

Joe concludes "Being an architect, in the end, is all about helping others to succeed. If you’re a really good architect, you’ll inspire people and rub off on them. You’ll gain a certain level of respect that is unmistakable and priceless. And that, in my opinion, is far more fulfilling than anything you could accomplish on your own working in a vacuum."

You may agree or disagree about whether these leadership skills are architect skills but I find this a great summary of what I'm trying to be in my firm and how I want to relate to my developers, testers, designers, and so on. Take the time to read it through.

Kate

Wednesday, 15 October 2008 13:39:20 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 14 October 2008

Do you recognize this man?

 

Maybe that's too recent a picture... try this one:

Combine these tickets with the PDC location and I have an earworm that should be with me till the end of the month.

Kate, humming

Tuesday, 14 October 2008 08:50:26 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 13 October 2008

Believe it or not, this code (snipped from something larger) compiles:

  unsigned int c = ( o-----o
                     |     !
                     !     !
                     !     !
                     o-----o ).area;
  assert( c == (I-----I) * (I-------I) );
  assert( ( o-------------o
            |L             \
            | L             \
            |  L             \
            |   o-------------o
            |   !             !
            !   !             !
            o   |             !
             L  |             !
              L |             !
               L|             !
                o-------------o ).volume == ( o-------------o
                                              |             !
                                              !             !
                                              !             !
                                              o-------------o ).area * int(I-------------I) );

Not only does it compile, the asserts succeed. What's more, o is not some instance of a class, and neither is I. As you might imagine, there's some bizarro stuff behind this. Templates, operator overloads, ... it's all reasonably silly and impressive at the same time. Needless to say, the ! and -- operators do not "do as the ints do" in this case.

The files you need are at http://www.xs4all.nl/~weegen/eelis/tutorial.cpp and http://www.xs4all.nl/~weegen/eelis/analogliterals.hpp. There's an explanation of sorts at http://www.xs4all.nl/~weegen/eelis/analogliterals.xhtml but my IE7 refused to load it, so I saved it on my machine and renamed .xhtml to .html. To test the code I used VS 2008, made a Win32 console app and just pasted the body of Eelis' main into my generated main, and the body of the header into an empty header file. No strange settings required and no warnings on compile.

Try it yourself!

Kate

 

Monday, 13 October 2008 07:52:20 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 12 October 2008

I just love the Vista Bridge. I've spoken about it at Tech Ed, on Geekspeek, on DotNetRocks, and pretty much anywhere that will have me (and I have more planned.) Now the Windows SDK team is blogging about it. Yay! They include where to download it, how to make sure you get it when you install the SDK, and some workarounds for some bugs in the samples.

Stay tuned for more Vista Bridge info...

Kate

 

Sunday, 12 October 2008 09:31:02 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 11 October 2008

Headed to the PDC this month? Is it your first? Or did you go once before but ended up feeling you somehow wasted the opportunity? A huge part of conferences is the face time. The really popular sessions will be blogged (so go to sessions on more obscure topics), there will be other ways to get some of the information (not all, so choose wisely), but no screencast can compare to chatting to people who know things you need to know, to making friends, and to seeing some of your heroes as actual human beings and learning what beer they prefer. Thomas Lewis has an intruiging Guide to the PDC that covers slightly different ground than the usual guides. An intruiging combination of how to learn the most and how to get free drinks as well.

Alas I am not staying at the Westin, but the Marriot. The good news is I have an invitation to a party at the Standard :-).

See you there!

Kate

Saturday, 11 October 2008 09:11:47 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 10 October 2008

Well, I already knew I was an outlier. And I knew that my number of open windows was part of that eccentricity. But just how much? According to the Engineering Windows 7 blog entry on the taskbar, pretty much everyone peaks at less than 15 open windows, and most people at less than 10:

Here's my taskbar at a typical moment:

It's routinely three high. I've never gone to four high, but I have had more open than that. 40 doesn't seem unusual to me (that's 42 there) and I can find my way around in them easily enough. I am a big-time Alt-tabber of course.

Curious how the taskbar, launch pane, start menu, and so on will be different in Windows 7? Want to understand why some features are the way they are (hint: customers are all different, except in the ways they are the same)? Read the blog!

Kate

Friday, 10 October 2008 08:45:16 (Eastern Daylight Time, UTC-04:00)  #