Wednesday, April 27, 2005

Contract First? Code First? Both First.

The recent debate (here, here, and here, amongst others) might lead you to believe there are two ways to design a web service: code-first and contract-first. A surface reading of the debate seems to indicate that you either write a bunch of classes and rely on the vendor to generate the XML (code-first) or write all your WSDL/XSD by hand (contract-first). This is utter crap.


Just like anything else, it all comes down to Splosky's Law. Roughly paraphrased, it reads, “There is no free lunch.“ You don't get to ignore the wire format, and you don't get to ignore the tools. Instead, you have to remember things like, “CLR value types don't work very well in the face of missing elements, but Java works differently.“ You, lucky coder, have to remember that you're writing a system in which the parts might look something like this:


Java <-> Axis <-> XML <-> HTTP <-> XML <-> System.Xml.Serialization <-> ASP.NET <-> C#


And that every layer has its own oddities and idiosyncrasies. If you can do that by writing a pile of classes, great. But you simply won't be able to guarantee success unless you know how those classes turn into XML. You might get lucky, but that's pretty much the same thing as saying, “Well, there was a threading bug, but I ran it again and it didn't happen, so it must not be a problem.“ Similarly, you can't just hurl an XSD at the world and expect that everyone will write code to consume the corresponding XML directly off the wire - they're going to use vendor toolkits for the simple economic reason that it's too expensive not to.


Note that I'm not putting words into the mouths of any of the participants in this debate. Many of them make the same points, although not, I think, in the same “camp neutral“ vein. My point is that you can claim to be either a “contract-first” or “code-first” person and still succeed. Which pretty much makes the distinction (and therefore that aspect of the debate) pointless.


No, call yourself whatever you want, but you still get to learn the stack from end-to-end. Programmers hate this because they spend their life building abstractions, and this flies right in the face of that. Vendors hate it to admit it because it means they can't sell toolkits that “take care of everything for you.” (Not that they don't try.) But at the end of the day, the universe doesn't care that we don't like it - it's still the case that abstractions leak, and knowledge is the only insurance.

Making iTunes Work with MSN Messenger's &amp;quot;Now Playing&amp;quot; Feature

On a recommendation from Brad Wilson, I've switched from using WMP to iTunes. I'm not sure I'm going to stick with it, but so far I like it. But one problem that was bugging me was how to get the “Now Playing” feature of MSN Messenger 7.0 working. I had it working for a little while, but then it stopped and I couldn't get it back.


Well, I've got it working now. After a little Googling, I found the answer here. Here's the important bit:



In MSN Messenger go to Tools / Options / General and check "Open Messenger main window when Messenger starts."


This rates as one of the more bizarre fixes I've seen, but so far it's working perfectly.


In the spirit of this post, here are my five most recently played songs. Clearly, I've got my whole library on “shuffle“. :)




  1. The Separated Man: I'm in a Cage/I Am the Man/The Man's Gone [Reprise]/Some - Neal Morse - One


  2. Concerto Per Mandolino, Archi E Cembalo- In C Major RV - Antonio Vivaldi


  3. Piggy - Nine Inch Nails - The Downward Spiral


  4. Home - Dream Theater - Dream Theater Graspop Festival 2002


  5. Turn on Tune In - Threshold - Hypothetical

Tuesday, April 26, 2005

This Blog Now Requires CAPTCHA

I've had some fairly serious problems with comment spam on this blog - literally hundreds of bogus comments on some days. I've been trying to keep on top of it, but it's a pain. Now, thanks to the efforts of Keith Brown, a CAPTCHA feature has been implemented. Hopefully this doesn't discourage anyone from commenting. Given that it only requires you to type in four numbers, I suspect it won't.


Please contact me if you have any problems with this feature.

Monday, April 25, 2005

Visual Source Safe and Visual Studio 2005?

Looking at this chart, it's unclear to me if I'm going to have to cough up for a VSS license in addition to dropping money on VS2005. Of course, I've never been too clear on VSS licensing in the first place. (And frankly, I'd pay quite a bit not to have to use it, particularly given the number of alternatives that are both superior and free). But I know there are a lot of midsize shops out there that use VSS, and I'll bet they're going to be asking themselves the same questions.

Sunday, April 24, 2005

Periodic Slowness in ASP.NET Apps

This one came up on the FlexWiki mailing list the other day. I should have known it, but I missed it, and it's worth spreading around.


A user complained that their FlexWiki install would periodically respond very slowly. The wiki was under very light load, so it didn't seem like a traffic problem. I was initially a bit confused, because the user reported that they hadn't changed the <processModel> element. Changing <processModel> to recycle the ASP.NET worker process periodically would have explained the problem, but the default is not to do that.


At that point, Michael Teper pointed out what I should have remembered: under IIS6, <processModel> is ignored in favor of the IIS6 metabase settings. If you go into the Internet Services Manager and pull up properties for an application pool, you'll see right there that by default, IIS will recycle the worker process every 29 hours (yes, 29), and after 20 minutes of inactivity. So on a lightly-loaded server, you're going to see a lot of recycling, and the consequent periodic delays. If you're supporting an internal web server that doesn't get hit that often, changing this value might be a good idea.

Sunday, April 17, 2005

How to Tell You're a Network Nerd

Got this one in my email today. I thought it was too funny not to share:






Dear Dr. Internet:


I am afraid that I'm becoming a network nerd. How can I tell for sure?


Sincerely,


Geek-or-not






Dear Geek-or-not:


How many syllables do you think there are in the word "coax?"


Dr. Internet





Friday, April 15, 2005

MIT Students Generate Gibberish

OK, we've all been to a conference talk or two that sounded like the author had been smoking the thesaurus. But this beats them all: some MIT students wrote a program that randomly generated a meaningless conference talk paper. Then they submitted it. And it was accepted.


[Update: forgot to credit Shawn Van Ness for pointing this one out on the WinTechOffTopic Mailing List.]