Asp.Net MVC programming advice. Toodles, Evan Nagle.
Aug
03

Okay. So, if you live in the bowels of a horse, or if you were too busy watching reruns of Rubicon and Mad Men last night, you probably missed all of the chaos surrounding the upcoming release of the Microsoft.Data library. To recap: it started with this innocent little blog post by David Fowler. An excerpt:

It’s an awesome new assembly/namespace that contains everything you’ll ever need to access a database. In ASP.NET WebPages we wanted people to be able to access the database without having to write too many lines of code. Any developer that has used raw ADO.NET knows this pain:


using (var connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;
                                           Initial Catalog=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True")) {
    using (var command = new SqlCommand("select * from products where UnitsInStock < 20", connection)) {
        connection.Open();
        using (SqlDataReader reader = command.ExecuteReader()) {
            while (reader.Read()) {
                Response.Write(reader["ProductName"] + " " + reader["UnitsInStock"]);
            }
        }
    }
}

Wow, that’s a lot of code compared to:


using (var db = Database.OpenFile("Northwind")) {
    foreach (var product in db.Query("select * from products where UnitsInStock < 20")) {
        Response.Write(product.ProductName + " " + product.UnitsInStock);
    }
}

Shortly thereafter, Rob Conery had this to say:

Data Acess is hard! Let's go shopping! http://bit.ly/cbO9Kh - we've been down this road, oh so many times.

Then, Oren Eini wrote this scathing response. An excerpt:

I really don’t know where to start. Yes, compared to raw ADO.Net I guess that this is improvement. But being beaten only thrice a week instead of daily is also an improvement.

I mean, seriously, are you freaking kidding me? Are you telling me that you are aiming to make the life of people writing code like this easier?

Then, a baby calf was born.

Then, a bunch of developers started tweeting and making jokes at Microsoft.Data's expense!

Then, Andrew Nurse (one of the creators of Razor), wrote this defense. An excerpt:

David Fowler, fellow ASP.Net team member, posted about it earlier today, and the response has been … active. The message behind most of these responses has been that it encourages bad practices to novice developers. I think there’s an important point that’s being missed here: It doesn’t matter how hard we work, as professional developers, to create clean architectures and abstractions, there’s a whole world of novice developers who just don’t care about that. They want to write code now and be done with it. This is the audience targeted by Microsoft.Data, and the WebMatrix product as a whole.

Then, David Fowler wrote a follow-up post. In it, he clarified (perhaps fearful for his life, and the lives of his unborn children...):

These blog posts point out that WebMatrix targets a different audience than our traditional pro developer audience. These are people who are not yet developers (if they ever plan to be). They may never want to become a pro developer, but want to be able to put together a simple website. If you've internalized best practices and patterns and know your way around an ORM, then you will most likely never use this library. We are trying to attract a different kind of customer: people who are on other platforms and are already using SQL today in their web pages, and people that are trying to get into programming and haven’t chosen a platform as yet.

Most likely, if you're even reading this, you're not the intended audience, though we are still interested in your feedback.

Then, my friend, David Ebbo, chimed in:

As great as ORMs are, there is a measurable number of web developers who favor writing raw SQL over using an ORM. Now you may not think highly of people in that camp, but if you’re trying to pretend that they don’t exist, you’re in denial. Though they tend to be less vocal, there are a lot of people who prefer this approach, for a variety of reasons. They could be ‘SQL gurus’ who like full control, or more likely they are not experienced programmers, and all the OOP that come with ORMs are just not for them.

Then, Andrew Nurse, Scott Gu, and Rob Conery started fighting (with words) on Twitter.

Then, other stuff happened.

Then, my mom called me.

Then, after all the punch in the punch bowl had already been consumed and regurgitated, I started writing this very post. It's too late to save anyone. Or to say anything interesting. But I might be able to bring a little bit of comic relief to the battle zone. We'll see. Here comes the meta.


So, let's take a breath, and, before we punch anybody, let's reflect.

Okay. Reflection over. Now, let me shamelessly divulge my reflection-conjured thoughts.

Thought 1: Microsoft.Data is a bad name for a namespace. It's too generic, and novice developers won't be able to find documentation via a simple google search.

Instead of "Data", a name prefixed by ADO might be better, as it would be much easier to search for, and would be more likely to inspire the "novice" developer to get better acquainted with the ADO technology that he's fiddling with. "Data" is too myopic, especially for a library that serves as a light ADO wrapper.

Thought 2: Microsoft's response to the outcry is misguided. The anger is cultural, not technical.

Yes; everyone knows that Microsoft constructed WebMatrix, Razor, and Microsoft.Data as part of a pointed campaign to entice novice developers (and stupid people) into flocking to the pricey Microsoft stack. And, yes; the Microsoft.Data library will surely be a helpful library for those developers who want to throw a website together without thinking too much about the architecture of what they're constructing. Technically (and commercially) speaking, Microsoft has a slew of perfectly legitimate reasons for splattering the landscape with these "watered down" technologies. But, culturally speaking, it's painful to the professional Microsoft developer. It is. Because the Microsoft developer's personal and professional identity is tied up in the Microsoft stack, and that stack is now catering to a bunch of cat ladies and acne-laden teenagers. That's the real issue here.

To put this point another way, let's talk about the nowNEVER-defunct band, Tool. Let's say that, out of the blue, Tool decided to write a song about the importance of loving lambs and feeling all "gushy inside". A "professional" Tool fan would surely be outraged--not because Tool had done something stupid on a functional (i.e. musical) level, but because Tool had lost its sense of direction, and had thus muddied the waters that once helped the Tool fan construct and reinforce his/her identity. And, all the while, Tool frontman, Maynard James Keenan, only had this to say:

I think there’s an important point that’s being missed here: It doesn’t matter how hard we work, as professional musicians, to create hardcore sounds and abstractions, there’s a whole world of teenie boppers who just don’t care about that.

Thought 3: Shakespeare had it right.

Every Shakespeare play operates on three levels. The first level is embodied in a jester, who entertains the onlookers (mostly children) who are ill-equipped to understand what's going on in the plot. The second level is the plot, which entertains the onlookers who are capable of longer spurts of self-guided attention. And the third level is metaphorical, which entertains the onlookers who are capable of extracting a bottomless stream of interesting, non-explicit symbolic themes from the play's unraveling. Now, here's the kicker of it all: each level entices the onlooker to "upgrade" to the next level.

To put this another way: Shakespeare didn't employ the jester just to let stupid people off the hook. The jester prods the stupid onlooker into deeper contemplation. Isaac Asimov chimes in with this tidbit of interest about the function of the Shakespearean jester:

Some have argued that the clowning in Shakespeare's plays may have been intended as "an emotional vacation from the more serious business of the main action". Clowning scenes in Shakespeare's tragedies mostly appear straight after a truly horrific scene: The Gravediggers in Hamlet after Ophelia's suicide; The Porter in Macbeth just after the murder of the King; and as Cleopatra prepares herself for death in Antony and Cleopatra. Nevertheless, it is argued that Shakespeare's clowning goes beyond just 'comic relief', instead making the horrific or deeply complex scenes more understandable and "true to the realities of living, then and now" by shifting the focus from the fictional world to the audience's reality and thereby conveying "more effectively the theme of the drama."

So, for me, that's the real question here--namely, is WebMatrix (and, by extension, Microsoft.Data) just a space for stupid people to clown around and be perpetually and bottomlessly stupid? Or is it a means to attempt to help new developers attain a better grasp of the fundamentals of software development? Judging by the defeatist attitude of some of the Microsoft bloggers thus far (with sentiments like "people who will never be x"), I fear that the answer might be the former.

Thought 4: This isn't the end of the world. There are people starving. There are wars. There are women being traded as sex slaves right outside my window in Honolulu. In sum, Microsoft.Data isn't responsible for the totality of all human suffering.

Look, I understand that it's painful to watch a company like Microsoft cater to developers (i.e. old ladies) who aren't as technically proficient as "professional" developers are, but that's really no reason to rant about how "stupid" the world is (my own hypocrisy is intended here) and how "Microsoft fucks everything up". The reality is: not everyone can do the things that you can do, or learn the things that you so easily learned. And you should be proud of that. No need to lash out. Your prowess makes you special. You don't need Microsoft.Data to make your websites hum. And you'll surely get paid a good salary to fix the websites that do. So spend your energies fixing a real problem, like your crumbling relationship with your wife, or world hunger, or your T.V. set.

Thought 5: As a Microsoft developer, you have to trust Microsoft. You have to give up the need for cultural affirmation. You have to believe that Jesus is a Microsoft employee.

Culturally, OSS will beat Microsoft any day of the week. Because OSS is like love (sex for free), and Microsoft is like prostitution (sex for money). Love is definitely nicer (or "gushier"), but prostitution is a stabler source of long-term sexual relations. And that's the trade off you're making as a Microsoft developer. In twenty years, you know that Microsoft will still be pimpin' something nerdy, but RoR might be an abandoned ghost town full of broken twitter-like applications. Probably not, but who knows. After all, when something's free, it's beautiful. But it's more likely to flee. Whether that's a good thing or a bad thing, that's up to you to decide.


So, those are my thoughts for now.

Play dramatic music here.

Close curtains.

Cue flaming comments.

Read More

You can leave a response, or trackback from your own site.

24 Responses to “Microsoft.Data — Let’s Inject Some Love Into the Conversation”

 
  1. Eduardo says:

    Very nice and funny write. Congrats!

  2. Rodrigo says:

    Erm, nice post, but who said Tool is a defunct band?! They’re working on a new album and touring this summer.

    Don’t scare me, dude.

  3. Evan says:

    Hah! That’s amazing. Whatever happened to A Perfect Circle? And retirement? :)

    Anyways, I stand corrected. You win. Let’s replace “now-defunct” with “NEVER-defunct”.

  4. Steve says:

    Oh great now I’m a prostitute working for Ballmer ‘pimp daddy’!

  5. Evan says:

    Steve,

    Put on your tightest pair of pants!

  6. Bravo, sir. That is a great, thoughtful post in the midst of a shitstorm.

  7. [...] seems I’ve become (in)famous in the last two days. With all the buzz around Microsoft.Data, I figure I’d post on something else that [...]

  8. Jarrett says:

    Ought to be required reading in Redmond.

  9. Humorous and thoughtful, thanks a lot for this post!

  10. Lance Hunt says:

    Just for the sake of adding more contrast to this discussion, consider watching David Heinemeier Hansson’s (Ruby on Rails creator) perspective on Microsoft’s underlying goals with WebMatrix et al.

    Skip to the section titled “There’s No Such Thing as a “Pure” Programmer”
    http://bigthink.com/davidheinemeierhansson#ooid=42cDRtMTqgjwuTT9Uc59NxOVbFnnvmGs

  11. [...] para realizar el acceso a datos.  Ayende critica no sin razón este nuevo método y parece que no es el único, porque desde microsoft llegan explicaciones, realmente algo positivo que se genere [...]

  12. [...] and Microsoft.Data with equal parts bemusement and alarm.  I wont rehash everything, since Evan has already neatly done so in his blog post yesterday, but I will offer this [...]

  13. nelson says:

    “and that stack is now catering to a bunch of [...] acne-laden teenagers”

    I think you are forgetting that that is how most of us started. It wasn’t that long ago when, if you asked me, I would say I prefer PHP over ASP.net simply because I could better understand it, and wasn’t forced to use some “complicated” architecture to build software. And it was great, for a time. Then I started realizing the need for architecture, patterns and design. Once I had invested some time learning these things, it became apparent to me that ASP.net was a much better alternative for building more structurally sound applications. So I moved over and haven’t looked back.

    Now imagine that instead of me using PHP back then I had used WebMatrix. From my perspective it’s similar – but it has better support for my operating system, and the development environment is easier to setup and maintain. Now as I realize the need for software design, I can simply “step up” to asp.net mvc, or other .net framework, without changing platforms or languages. And then eventually I’ll get bored of writing SQL, and map up some POCOS to EF4. It would be a gradual and enjoyable experience – instead of the quite jarring one I had with the switch from PHP to C#.

    A final note:

    Unfortunately I was hired as a ColdFusion developer for my current job. It took a bit of persuasion, on behalf of the entire team, for us to switch to ASP.net. However, sometimes I find myself needing to transform data from one table, or one database, to another. Often times these are “nasty” legacy tables with a bunch of strange conventions and designs. If I have to do a one-off data transformation like this, I will use a ColdFusion script instead of C#. Why? Because I don’t want to waste the time mapping my entities to these crazy schemes – and there are already a bunch of pre-written SQL statements that will get me the data I need. I wouldn’t use C# because writing raw SQL was a pain in the ass, compared to CF. But when I saw the initial blog post about Microsoft.Data I was happy, because now I can easily use C# to solve these problems instead of having to write in that awful mind-numbing piece of garbage platform CF.

  14. Jim says:

    How did you know that my relationship with my wife is crumbling?

  15. Evan says:

    Nelson,

    That was an amazingly thoughtful response, so thanks.

    And, in short, I’d say: I think that YOU’RE approach to the WebMatrix story is miles ahead of the approach that Microsoft has taken thus far. The story should be: WebMatrix is an integrated tool (with its own ecosystem) that can help new developers (and non-developers) learn the basics of .Net development. Microsoft should say that they’re trying to tow the line between simplicity and good design, and that, in the cases where simplicity trumps good design, they’ll make sure to inform the new developers of other, more complex options.

    As a sidenote, it’s been really interesting to see the response on Twitter–seems like my post is vague enough that everyone is extracting whatever meaning best suits their fancy. In reality, I just wanted to point out that (a.) Microsoft has a valid reason for catering to new developers and non-developers, that (b.) developers have a valid reason to feel protective of their platform (it comes out of love, not out of hate), and that (c.) Microsoft doesn’t seem to really GET the fact that precept (b) requires some tender gloves when implementing a campaign driven by precept (a). Developers don’t want their favorite restaurant to be bought out by McDonald’s (possibly too late).

    Let me be clear: I don’t have anything against acne-laden teenagers or cat ladies. In fact, I’m STILL an acne-laden teenager (and I’ll continue to be one, late into my thirties). I’m also a cat lady. And I definitely don’t propose that MS (or its devoted developers) take an elitist stance against the untrained masses. In my opinion, elitism is just as off-putting as Microsoft’s current campaign for over-inclusiveness (if not more so). We should always be friendly to new developers (and to other human beings, in general). The fact that new developers want to learn something that we’re so invested in is a form of flattery, and we should try our best to help these new developers become transformative figures in the .Net world. If we belittle new programmers, or if we assume that new programmers can’t learn difficult technologies, we’re just spouting a prophecy that will inevitably be self-fulfilled.

    Like I said on Twitter today–I wrote this post as a means to calm tensions, and I think (with a little help from Ayende), it escalated the situation. I apologize for that. I apologize to the folks at Microsoft (like David Fowler) who really don’t deserve a pie in the face. I also apologize to any developers out there who’ve decided to continue to write crappy PHP because they don’t want to deal with the grumpy quips spouted by a bunch of old-faced basement-chained .Net developers.

    As Ezra Pound once said, it’s all about the poem. Pound didn’t care who wrote the poem; he didn’t care what method the poet used. If the poem was written, and if the poem was good, Pound was teleologically satisfied. For me, writing software should be all about the innovation. And innovation requires stupidity, and it requires a constant influx of new faces, new ideas, and new stupidities.

    So, yeah. Thanks for the insights. And thanks for not forgetting your roots (as a stupid person). :) I think you should consider applying for a PR job at Microsoft, if you don’t already have one.

    Cheers,
    Evan

  16. Evan says:

    Jim,

    Insert inappropriate joke about your wife here.

  17. Aaron says:

    Wonderful post, I really liked the analogy that you draw between Microsoft.Data and the “levels” in Shakespeare. However, I don’t believe that currently beginner developer tools do not exist, or we need more beginner tools to draw in Microsoft converts. I believe the complaint lies in the unintended results of this approach: 1) New or bad programmers learn and rely on these libraries to build applications which become an absolute horror to maintain — because it’s easier in the short-term to churn out garbage than to actually think about what you’re doing and try to imbue quality into your work — then I end up supporting a 80,000 line file of embedded SQL 2) Management adopts this policy as well, why bother with the ramp up time and training needed to learn another ORM? Why use non-Microsoft tools? Use Microsoft.Data, it’s so easy that I can understand it, how could that be bad?

    So to a beginning programmer (or someone who just doesn’t care) this is a blessing. Wow a simple way that I can do less work and get more done! To an architect or someone who’s responsibility is going to be to maintain this wreck for the next 5 years (after the 3 month dev time) — this becomes another source of frustration, another point of contention between himself and management, and another hurdle to overcome in the minds of those who just want to take the easy way out of everything (for themselves) and make life harder on us all.

  18. bretto says:

    Too complex hey? – there is a new library “Microsoft.Monkey.See.Do.dll” – 3 lines of code to write any app ever!

  19. I too beleive in enticing new developers into the .Net (particularly Asp.Net) stack, but I beleive in doing it from the deep end instead of presenting people with simplifications which, in all likelyhood, will present no clear upgrade paths (and thus an architectural nightmare) for anyone wishing to take their designs to the next level.

  20. Chris Sells says:

    Sadly, Jesus didn’t make it through the last round of cuts…

  21. [...] Microsoft.Data – Let’s Inject Some Love Into The Conversation (Evan Nagle) [...]

  22. [...] from Evan Nagle: This [Microsoft.Data] isn’t the end of the world. There are people starving. There are [...]

 

Leave a Reply