Sunday, June 15, 2008

mrwizard

Sergey Barskiy, a colleague at Magenic, likes to say that there is no magic in software development.  There's only hard work.

Every few months, another software management process is promoted, a new tool is developed, or a new snowclone, "X-driven development", is coined to make software developers more productive, and in general they all promote themselves as the magic that will radically change the way we deliver software, and in general they don't really pan out.  Instead we just end up with different schools of software development.  Physiology, metoposcopy, chiromancy, theurgia, goetia, necromancy, cabalie, geomancy, hydromancy, aeromancy, prymancy and suffumigations -- does one method really provide a better way to deliver software than another?  Or should we simply pick the techniques that work best for us and stick with them?  What is ultimately disappointing, and this is at the heart of Sergey's rule, is that once one immerses oneself in any of these techniques, one discovers, like a teenage goth working through Alaister Crowley's Magick, Liber ABA, that things don't ever go quite quite according to plan.

But does this mean there is no magic?  Perhaps we are looking in the wrong place. 

Last Friday, on June 6th, Microsoft released the beta 2 of Silverlight 2.  Almost immediately, several prominent bloggers published entries not only about the release, but also full code samples demonstrating how to use the new release.  Scott Guthrie, Jeff Wilcox, Kirupa Chinnathambi, Brad Abrams and Ashish Shetty all had immediate posts (Mr. Shetty's was actually a day early), but this is to be expected as they are all Microsoft employees closely associated with Silverlight.

More impressively, non-Microsoft employees like Shawn Wildermuth, Peter McGrattan, Walt Ritscher and several others had immediate code to publish around this release.  No amount of hard work can make that possible. 

What is the occult, after all, but something hidden?  Even for people who once believed in such things, metoposcopy, geomancy and chiromancy were simply techniques for dealing with the hidden world not commonly understood.  Along with alchemy and astrology, cryptography was once considered one of the areas of expertise of a renaissance magus.  Both Johannes Trithemius and Giambattista Della Porta wrote about it.  What made cryptography go so well with other fields such as necromancy and hydromancy is that its secrets were possessed only by the few, and knowledge of it helped preserve one's monopoly on secret knowledge.

Software development is full of secrets.  Developers call what they do "coding", for no obvious reason other than that it is generally incomprehensible to anyone but a fellow initiate of a particular coding language.  The code, in turn, is a set of instructions which must be translated into another code, assembly, the mystical language of all our virtual worlds, which is actually incomprehensible to nearly everyone.

Dame Francis Yates called this kind of magic "practical" magic.  It is simply a way of getting things done.  Whether one instructs a demon to sour one's neighbor's milk, or uses chemicals to acidify it, the effect is basically the same -- all that differs is the particular technique one employs to accomplish one's goal.  One is clearly going to be more effective than the other, but the difference between the occult and the mundane surely does not turn on mere efficacy. 

The other kind of magic is a "spiritual" magic, which is a different sort of secret.  In a chapter entitled "113" in Umberto Eco's Foucault's Pendulum, Eco quotes from Ja?far al-?adiq, the sixth Imam:

"Our cause is a secret within a secret, a secret that only another secret can explain; it is a secret about a secret that is veiled by a secret."

Spiritual magic, in this case, is the way one gains influence by either having special access to secrets, or by appearing to have such access.  One begins to be an initiate into its mysteries simply by recognizing that it exists.  In his history of Secret Societies, Arkon Daraul describes an actual case of a young man becoming a Sufi:

"His first contact with a Sufi was when he was working as a part-time assistant in a restaurant.  Here he noticed a man among the customers who always seemed 'on top of every situation.  His methods of discussion with the people who came into the place were so controlled, and his perception, especially of atmosphere, so profound, that I plucked up enough courage to ask him how one did it.'"

The initiate is then tested for suitability, and finally takes the oaths required of him to learn more of the Sufi way.  Ahmad Yasawi, a thirteenth century Sufi, laid down rules for initiates, of which the seventh is possibly the most important.

"Utter silence of secrets is my oath; and I will show respect for those who are set up over me, without quibble.  I am the friend of the friends of the Order and the Murshid who exemplifies it; the enemy of the enemies of the same."

Today this would perhaps be called an NDA.  The rituals change over time, but the patterns are always recognizable.

The patterns of success are imprinted upon the human mind and its shape appears again and again throughout history.  Secret societies exist in every field, whether we recognize them as such or not.  I do not claim that Microsoft has such a structure, nor do I deny it.  I only suggest that if there is any magic in software development, this is where you will find it.

posted by J Ashley on Sunday, June 15, 2008 3:19:18 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Friday, June 13, 2008

multi-tabs

 

download source code

ASP.NET has been missing a good, free tab control for a long time.  With the ACT Tab Container, we were finally given one.  It typically runs in client-side only mode, but can interact with server-code if we set its AutoPostback property to true.

Compared to what we had before, it is a huge improvement.  The peculiar thing about it, however, is that it isn't actually an Ajax control.  It doesn't use asynchronous postbacks or web service calls to talk to the server -- instead you just have these two mode: run it using client script only, or run it using server-side events and code-behind only.

So a few months ago I rectified this for a project, and only found out afterwards that Matt Berseth had already outlined the technique on his blog.  You basically run the tab container in client-side mode, and add update panels to the tab panels that you want to be ajaxy.  You then hook up the client-side ActivePageChanged event in such a way that it spoofs the Update Panel contained in the tab, causing an asynchronous (or partial) postback.

Matt also gave this technique a cool name.  He called it 'lazy loading the tab panel'.  Like lazy loading in OOP, using this technique the update panels inside each tab panel only do something when its tab is selected.  Information is loaded only when its needed, and not before.

I must admit that I hold some resentment against Matt for coming up with this first, and for coming up with the cool moniker for it.  On the other hand, the solution I came up with encapsulates all of the javascript needed for this into a nice simple extender control that you can drop on your page, which his does not, and I'm rather proud of this.

The VS 2008 project for this extender is linked at the top of this post.  To use it, you need to compile the project and add the compiled assembly to your project, or else just add the project to your solution and add a project reference.

1. Drop the TabContainerExtender control into your page.

2. Set the Extender's TargetControlID property to your TabContainer's ID.

3. In the RegisterUpdatePanels element of the Extender, map your tabs to your update panels.  This mapping tells the extender which Update Panels to activate when each tab is selected.

Your markup will look something like this:

    <cc2:TabContainerExtender ID="TabContainerExtender1" 
    runat="server" 
    TargetControlID="TabContainer1" OnActiveTabChanged="ActiveTabChanged">
    <RegisterUpdatePanels>
    <cc2:UpdatePanelInfo TabIndex="0" UpdatePanelID="UpdatePanel1" />
    <cc2:UpdatePanelInfo TabIndex="1" UpdatePanelID="UpdatePanel2" />
    <cc2:UpdatePanelInfo TabIndex="2" UpdatePanelID="UpdatePanel3" />
    </RegisterUpdatePanels>
    </cc2:TabContainerExtender> 

4. If you want to add some code-behind to your active tab changed event, add set the OnActiveTabChanged property of the Extender to the name of your handler.  The thrown event will pass the correct Index number for the active Tab, as well as the ID of the mapped Update Panel.  The handler's signature looks like this:

        protected void ActiveTabChanged(int index, string panelID)

        {

            ...

        }

I highly encourage you to read Matt Berseth's blog entry (which I have to admit is pretty good) to get a clear idea of the techniques being applied in this ajax extender.  If you just need a quick solution, however, feel free to download this code from the link at the top and use it any way you like with no strings attached.  There is a sample project attached to the solution that will demonstrate how to use the Tab Container Extender, in case you run into any problems with lazy loading your panels.

For reference, here is the code for the sample implementation, which loads controls on the fly based on the tab selected:

    <cc1:TabContainer ID="TabContainer1" runat="server">
    <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Tab Panel 1">
    <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        Content 1 ...
        <br />
            <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>      
        </ContentTemplate>
        </asp:UpdatePanel>    
    </ContentTemplate>
    </cc1:TabPanel>
        <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tab Panel 2">
    <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
        Content 2 ...
        <br />
            <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>      
        </ContentTemplate>
        </asp:UpdatePanel>    
    </ContentTemplate>
    </cc1:TabPanel>
        <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Tab Panel 3">
    <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
        <ContentTemplate>
        Content 3 ...
        <br />
            <asp:PlaceHolder ID="PlaceHolder3" runat="server"></asp:PlaceHolder>      
        </ContentTemplate>
        </asp:UpdatePanel>    
    </ContentTemplate>
    </cc1:TabPanel>
    </cc1:TabContainer>
    <cc2:TabContainerExtender ID="TabContainerExtender1" 
    runat="server" 
    TargetControlID="TabContainer1" OnActiveTabChanged="ActiveTabChanged">
    <RegisterUpdatePanels>
    <cc2:UpdatePanelInfo TabIndex="0" UpdatePanelID="UpdatePanel1" />
    <cc2:UpdatePanelInfo TabIndex="1" UpdatePanelID="UpdatePanel2" />
    <cc2:UpdatePanelInfo TabIndex="2" UpdatePanelID="UpdatePanel3" />
    </RegisterUpdatePanels>
    </cc2:TabContainerExtender> 
posted by J Ashley on Friday, June 13, 2008 1:35:50 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
 Wednesday, June 11, 2008

FashionLady

I'm just doing my bit to propagate this viral Latin phrase.  Roughly translated, it mean "Newer, therefore better."  It doesn't appear to have ever been spoken by a citizen of the empire, but rather by Latin scholars in other periods.  There is an obvious and intentional irony in this, since those using this phrase are appealing to the authority of the archaic, the notion that what is older and more obscure is inherently wiser, as they make the claim.  Ergo, it would seem, the phrase is always used ironically.  (An interesting blog-spanning discussion of this phrase can be found here, here, and here.)  Personally, I like it even better in French: Après cela, donc meilleur que cela, due to a predisposition to believe that everything is always better in French, for instance Poe and Bukowski -- not that my French is any better than my Latin, which is undoubtedly why I cleave to this peculiar prejudice.

In technology, however, this motto should perhaps be taken at face value.  The beta release of a product is always better than the alpha, the RTM is better than the beta, and the first service pack is generally the first stable release of the product.  Unlike in previous eras, our concept of technology has the notion of progress built into it.  This makes everyone in technology a bit of a trend follower, trying to keep on top of the newest technologies and trying to anticipate what will succeed (Entity Framework) and what will not (Linq to SQL).  Once one begins speaking of trends in technology, however, we naturally undermine the notion of progress a bit, and instead are led back to Descartes' observation about fashion:

...[J]usques aux modes de nos habits, la même chose qui nous a plu il y a dix ans, et qui nous plaira peut-être encore avant dix ans, nous semble maintenant extravagante et ridicule.

To some extent this is a valid point.  Isn't SOA simply a return to the type of functional programming that used to be done for mainframes and dummy terminals?  Just because Silverlight is the hottest newest thing in Microsoft development, is this a reason for everyone to jump onto the Silverlight band wagon?  Must we always chase after the shiniest piece of tinsel?

Of course we must.  Those who have been in this profession much longer than I have, who have made the leap from mainframe programming to object-oriented programming to service-oriented programming, who have gone from client-server to n-tier to distributed programming with WCF, have learned that it is better to take a descriptivist view on the phenomenology of progress rather than a prescriptivist view.  Isn't this the secret to understanding Darwinian evolution -- that it is based on a tautology?  Survival of the fittest determines what exists and what does not; existence, in turn, determines what is fit.  Post hoc, ergo est (et non est hoc).

Perhaps this is the most unfortunate aspect of technological progress.  It robs us of our sense of irony.

posted by J Ashley on Wednesday, June 11, 2008 12:40:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, June 07, 2008

conan

In a literary blog I like to follow called The Valve, a recent post asks why the world of public intellectuals is now dominated by scientists like Richard Dawkins and Steven Pinker rather than by literary critics.

"The culture wars so damaged literature as a source of cultural authority that literary intellectuals lost the public stage. They were replaced by scientific popularizers such as Steven Jay Gould, Richard Dawkins, and Steven Pinker - cf. literary agent John Brockman on the third culture. In this climate of opinion, it is not enough to return to evaluative criticism.

...

"My own dog in this fight is a general academic rehabilitation of normativity (so-called), and not just in literature, as well as a return to generalism, by which I mean “writing for a well-informed non-specialist audience” (and by which I do not mean “writing for stupid,uneducated people who will never really understand the sophisticated stuff we do.")

"This would involved the renunciation of the positivist dream of grounding everything on Science and Truth. It would be a less resolvable, more plural discourse. "

Perhaps it is appropriate that the question of why we don't pay more attention to literary theorists would only occur to other literary theorists.  At the same time, it raises the question of why other professionals don't attempt to grab for this particular ring of public legitimization.  Pundits on TV, not surprisingly, are pulled from the pool of people who decide early in their careers that rather than actually making policy, they want to talk about it.  Moreover, they have decided that rather than taking the somewhat more "legitimate" tack of going into print journalism, they want to do it in the most mediocre medium available -- television.  It actually pays off, since in this case, to paraphrase Marshall MacLuhan, the medium is the messenger.

But my purpose here is not to shoot the messenger.  It is rather to wonder why other professionals don't feel this entitlement to speak for others over matters concerning which they have no expertise.  Tech people certainly feel they have more insight into policy and long-term planning given their unique vantage point upon the ways technology transforms the workplace as well as our very sense of time.  Why don't they chomp at the bit and demand that people pay more attention to them?  Doctors, more than any other profession, take for granted their God-like role in determining who lives and who dies based on their insurance coverage.  Should they not be afforded the opportunity to make oracular pronouncements about the health of the nation?  Lawyers recognize that the only truth is the truth they are able to argue before an appropriate audience.  Shall they be given the chance to argue before the citizenry?

Yet it is only the lit crit folk-- those peculiar scholars who work in the butt cracks of philosophy -- that feel an entitlement about making public declamations.  Moreover, they are in the unusual position of feeling that somehow this entitlement has been taken away from them.  How did this ever happen?

posted by J Ashley on Saturday, June 07, 2008 1:51:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
 Monday, June 02, 2008

impedance_mismatch

Impedance mismatch is a concept from electronics that is gaining some mindshare as an IT metaphor.  It occupies the same social space that cognitive dissonance once did, and works in pretty much the same way to describe any sort of discontinuity.  It is currently being used in IT to describe the difficulty inherent in mapping relational structures, such as relational databases, to object structures common in OOP.  It is shorthand for a circumstance in which two things don't fit.

Broadening the metaphor a bit, here is my impedance mismatch.  I like reading philosophy.  Unfortunately, I also like reading comic books.  I'm not a full-blown collector or anything.  I pick up comics from the library, and occasionally just sit in the bookstore and catch up on certain franchises I like.  I guess that in the comic book world, I'm the equivalent of someone who only drinks after sun-down or only smokes when someone hands him a cigarette, but never actually buys a pack himself.  A parasite, yes, but not an addict.

The impedance mismatch comes from the sense that I shouldn't waste time reading comics.  They do not inhabit the same mental world that the other things I like to read do. I often sit thinking that I ought be reading Schopenhauer, with whom I am remarkably unfamiliar for a thirty-something, or at least reading through Justin Smith's new book on WCF Programming, but instead find myself reading an Astro City graphic novel because Rocky Lhotka recommended it to me.  The problem is not that I feel any sort of bad faith about reading comic books when I ought to be reading something more mature.  Rather, I fear that I am actually being true to myself.

A passage from the most recent New Yorker in an article by Jonathan Rosen nicely illustrates this sort of impedance mismatch:

Sometime in 1638, John Milton visited Galileo Galilei in Florence. The great astronomer was old and blind and under house arrest, confined by order of the Inquisition, which had forced him to recant his belief that the earth revolves around the sun, as formulated in his “Dialogue Concerning the Two Chief World Systems.” Milton was thirty years old—his own blindness, his own arrest, and his own cosmological epic, “Paradise Lost,” all lay before him. But the encounter left a deep imprint on him. It crept into “Paradise Lost,” where Satan’s shield looks like the moon seen through Galileo’s telescope, and in Milton’s great defense of free speech, “Areopagitica,” Milton recalls his visit to Galileo and warns that England will buckle under inquisitorial forces if it bows to censorship, “an undeserved thraldom upon learning.”

Beyond the sheer pleasure of picturing the encounter—it’s like those comic-book specials in which Superman meets Batman—there’s something strange about imagining these two figures inhabiting the same age.

posted by J Ashley on Monday, June 02, 2008 10:25:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]