Close But No Cigar

I just got a 71% on a Microsoft 70-536 practice test (80% is required to pass). I got creamed in Globalization and Security topics (things I’ve never had an occasion to use before). I guess I should probably read over the material before I take the tests for real. (I figured since I’ve been a .NET programmer for several years now I should get some certifications to that effect.)

Company Smell

I found this recent post on ASP.NET Weblogs sort of funny: Please question the need for whitespace. This person is actually suggesting that blank lines in your source code (which, for most normal people, are used to improve readability) could be a “code smell.” Then at the bottom of the post we learn that they are hiring. Hrm. Coincidence? Or company smell?

Open Source Licenses

I’ve been thinking about releasing some open source stuff, so I’ve been reading up on Open Source licenses. They all seem to have a significant hole in them: It looks to me like a nefarious person could slap any GPL software onto a CD and sell it to the nearest gullible corporation for $5000. Granted, anyone could get the software from non-nefarious sources for free, but still, the nefarious person would probably be able to con a few people into handing over money for the free software, which is bad, but it’s even worse that the actual author — the person who did all the work, in other words – gets absolutely nothing out of the transaction. That doesn’t seem quite right to me. If someone is willing to pay $5 or $500 or $5000 for a product, I think the creator of the product deserves some portion of that.

Which is not to say I want to go through the arduous process of selling my projects… I’ve got a day job after all. So I’m okay with “free software” (“free as in freedom”), but I’m not okay with nefarious Pointy-Haired Bosses making money from my work without explicit permission. (And if you think there aren’t people out there who would gleefully grab up free software and sell it for their own personal gain, you are pretty naive… I personally figure roughly 90% of the people in the computer industry are sheisters, but then I’m pretty cynical about human nature in general.)

So I would want to add a clause to any open source license I use to prohibit selling the work or any derivative works without explicit permission from the original author. Does that still make it “free software” enough to satisfy the Open Source Initiative? It should, because it still gives users freedom to use and modify the software — it just doesn’t give them the freedom to screw me over for a quick buck.

My ego also wants to prohibit anyone from creating a “fork” of my work under a new name , but my rational brain realizes that the source for such a fork must also be made available, so I could integrate any cool stuff in the fork back into my original version if I wanted to.

I like the idea of prohibiting anyone from using my name or the project’s name, though, as I saw in the CruiseControl.NET license:

The names “CruiseControl”, “CruiseControl.NET”, “CCNET”, and “ThoughtWorks, Inc.” must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact opensource@thoughtworks.com.

Products derived from this software may not be called “CruiseControl.NET” or “ThoughtWorks”, nor may “CruiseControl.NET” or “ThoughtWorks” appear in their name, without prior written permission of ThoughtWorks, Inc.

On Obama’s Pastor

I got the sense today that some of the anti-Obama people have been dying for a story like the one about his pastor to come out, so they can have a legitimate, politically correct reason to despise him. Previously, they would just hem and haw and say things like, “Well, I don’t know… he doesn’t have much experience, does he?”  Now they are all buzzing around like, “Did you hear what that pastor said? He’s a raving lunatic! I knew there was something about that Obama that wasn’t quite right!”

Obviously I don’t agree with the things Pastor Wright said.  (Something about killing whitey, right? Just kidding.) But there is a leap of logic here that doesn’t make much sense to me, namely that one pastor’s 5 second sound bites should somehow reflect the entire worldview of one member of his congregation. That’s not to say Obama shouldn’t be in political trouble over this – you’d think he might have anticipated people recording his… let’s say “enthusiastic” pastor’s sermons.

But still I hate to think that we’ve come to the place in society where we are judged not on what we say, but on what people say around us.  You don’t even have to be the one to say “macaca” any more, in other words.  Presidents of the future will have to isolate themselves in sensory deprivation chambers in order to pass that kind of test.

I Second That

Shaun Kenney will always be in the Virginia blogosphere Hall of Fame because of observant posts like this: What is Worse Than Reading Today’s News?

Reading Virginia political blogs of late is a huge chore for those of us who aren’t political groupies… so if you people are trying to reach average voters with all that exciting he-said-she-said analysis and semi-daily poll results, um, it ain’t working. (That was a joke… I realize you’re trying to reach journalists and not voters.)

The Magic Two-Faced File

I was in a store recently where the clerk vehemently declared that we should stick with XP and not install Vista until there was absolutely no choice.

But where else can you find an OS that gives you the ability to have one file with two entirely different contents? Huh?

Those are in Richmond?

So I guess SWAC Girl was in Richmond recently taking pictures again (which seems to be her life’s work now that the Republican party is leaning more moderate). What’s funny is that I’ve lived in Virginia all my life – have lived around Richmond for most of my life – and I’ve never seen any of the buildings in her pictures, let alone been inside them. I suck.

NAnt MissingManifestResourceException Tip

With NAnt 0.86 Beta 1, I found that I couldn’t use the <resources> element to include *.resx files in my <csc> task. For example, this didn’t work:

<csc target=winexe output=${bindir}\UvNotes.exe debug=${debug} win32icon=UvNotes.ico >

<resources>

<include name=*.resx />

</resources>

<sources>

<include name=*.cs />

</sources>

</csc>

The program wouldn’t run, failing with a MissingManifestResourceException.

Initially I tried to do this:

<resgen todir=${objdir}>

<resources>

<include name=*.resx />

</resources>

</resgen>

<csc target=winexe output=${bindir}\UvNotes.exe debug=${debug} win32icon=UvNotes.ico >

<resources>

<include name=${objdir}\*.resources />

</resources>

<sources>

<include name=*.cs />

</sources>

</csc>

But that also failed because it was generating resource files named eg. ”NoteForm.resources.”

To finally fix it, I ended up doing this:

<resgen input=NoteForm.resx output=${objdir}\UvNotes.NoteForm.resources />

<csc target=winexe output=${bindir}\UvNotes.exe debug=${debug} win32icon=UvNotes.ico >

<resources>

<include name=${objdir}\*.resources />

</resources>

<sources>

<include name=*.cs />

</sources>

</csc>

That generated resource files named eg. “UvNotes.NoteForm.resources” which was apparently required for it to work properly.

Design By Contract and Spec#

I’ve ragged a bit on The Pragmatic Programmer lately, but I wanted to mention one concept in the book that I really liked: Design By Contract.

Unfortunately, there are no languages that inherently support Design By Contract except arcane languages that nobody has ever heard of. (The Pragmatic Programmer discusses Eiffel and Sather. See what I mean?)

However, a few months back I stumbled upon Spec#, a language variant under research at Microsoft that is specifically built to add Design By Contract concepts to C#.

To describe “Design By Contract,” I could give you some high fallutin’ computer science jargon, but it basically boils down to this: When you declare a method signature, you also declare assert-style validation statements on the incoming parameters and return values. It’s a way to ensure that you have valid data, enforced by the language itself, rather than the programmer.

Without Design By Contract, you might write this:

public int DivideMe( int x, int y )

{

Trace.Assert( y != 0 );

return x / y;

}

With Design By Contract in Spec#, you would instead write:

public int DivideMe( int x, int y )

requires y != 0;

{

return x / y;

}

Pretty cool. Of all the language tricks and gimmicks I see from time to time, this is one of the few that actually appeals to me. It feels like a real improvement, rather than just a change for change’s sake.

Text Manipulation Languages

I said before that The Pragmatic Programmer seems biased toward Unix environments and lacks much real-world experience with Microsoft environments. Here’s another example of that.

In the “Text Manipulation” section, we are advised to “Learn a Text Manipulation Language.” Which means, we are told, we should learn Python, Tcl, Ruby, or Perl. I’m not precisely sure — and the authors don’t tell us – what makes a language better suited for text manipulation than others. The authors do tell us that they “use text manipulation languages almost every day.”

I personally do not use text manipulation languages every day. I have been a working software developer for some 15+ years now and I can’t say I’ve ever felt the need to learn an entirely new language exclusively for the purpose of manipulating text files. On those occasions when I do need to manipulate text files, I find that regular old mainstream languages work just fine. I hate to sound like an old fuddy duddy, but it’s really not that hard to read lines from a text file and parse them, ya know? Even in archaic C, it’s just “while (fgets(buffer, len, fh) != NULL) { }”

Was it really necessary to invent new languages to make that easier?