Redmond Diary

Blog archive

WebMatrix, Razor and a Return to Simplicity

This week, Scott Guthrie, Corporate Vice President at Microsoft's Developer Division, announced, via blog post, the early Beta release of a new tool called WebMatrix. WebMatrix is a free developer tool that enables Web development geared toward what I might call Markup-and-Script developers (more on that in a minute). And although WebMatrix draws upon technologies already, or soon to be, present in the fuller ASP.NET Web development platform and the Visual Studio integrated development environment (IDE), it is a radical departure from what those technologies have evolved into. Some review of Microsoft developer tool history might bring this into perspective.

Simple Beginnings
In the early and mid 90's, Microsoft's developer tools were pretty simple and straightforward. For Windows development, Microsoft had its Visual Basic (VB) product, and for Web development, it had something called Visual InterDev. For hardcore developers there was Visual C++, and for adherents to the acquired FoxPro product (now called Visual FoxPro, of course) there was that too.

The four products were sold together as a single entity called Visual Studio, but that name was really a bundle and umbrella brand for the four constituent products. Most Visual Studio customers used VB and InterDev for their work. VB featured an easy drag-and-drop design environment for building Windows desktop applications: drop controls on the form, set some properties, add a little code, and you could have a functional application. Visual InterDev provided an IDE for developing Active Server Pages (ASP) applications, which were simple text files consisting of HTML and Visual Basic code (actually a scripting version of VB, called VBScript). The VBScript was embedded within the HTML markup within <% and %> tokens so that the ASP engine on the Web server would know to parse it and send it to the Active Scripting engine. The files ended in an .asp extension so that the ASP engine would be invoked in the first place.

None of this was especially difficult, and yet it was impressively powerful. With VB, and ASP/Visual InterDev, Microsoft provided a way for clever, logical thinkers to be productive programmers in a short amount of time, and to use the same programming language expertise for both desktop and Web applications.

It was the best of times; it was the worst of times. Microsoft made programmers productive, but the low barrier to entry meant that lots of VB and ASP applications were written by bad programmers, and it gave the platform a bad name. Meanwhile, Java and its Java 2 Enterprise Edition (J2EE) flavor were eating VB and ASP for breakfast. J2EE was more complex and fragmented, but also more robust, scalable and, to be honest, more appealing to a higher caliber of developer.

Redmond's Revenge
Microsoft's response was to create the .NET Framework. Version 7 of Visual Studio was the first version of Visual Studio .NET. It provided a single IDE for desktop development and Web development, which could be done in a new version of VB (called VB .NET), or in a new langauge called C#, which bore an uncanny resemblance to Java. C++ could be used inside this IDE as well, and so could Microsoft's own licensed version of Java, called J#.

This version of Visual Studio and its Web technology, now called ASP.NET, extended the forms metaphor to Web development, such that the old "VB" and "ASP" were now called WinForms and WebForms, and they worked in a very similar manner. A (surprisingly) little known fact is that ASP.NET applications could still be developed using the old <%... %> syntax in the markup, without the need for forms and controls, but there was no encouragement from anyone to write ASP.NET code as if it were ASP.

The new IDE was more complex than any of the old ones, but in unifying them, it added simplicity too. A universal forms metaphor and a unified IDE, with the added rigor of the .NET Framework, and fully object-oriented programming made .NET very competitive with J2EE. Also, the programming was just enough harder to filter out many of the less capable developers who were on the Microsoft platform before. Microsoft made a big bet, and it won.

The Plot Thickens... And So Does the Platform
But Microsoft lost too. In political terms, it abandoned its base. And I think it did so based on a notion of false choice: it thought it had to cater to enterprise developers or productivity programmers, but that it couldn't do both.

And then it got worse: after the 2005 edition of Visual Studio and version 2.0 of the .NET Framework came out, Microsoft added a trio of technologies: the Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF). Originally these three technologies were planned to be part of what became Windows Vista, and were to be known collectively as WinFX. When they shipped, however, Microsoft decided to dissociate them from Vista and allow them to run on XP as well. Since they were really extensions to .NET, Microsoft rebranded the collection as .NET 3.0.

And this is where things started to get really complex. WCF and WF were not, and are not, for the faint of heart. WPF introduced a completely new way to create desktop applications. And while it added a slew of new capabilities, its designer for Visual Studio removed most of the productivity from its WinForms counterpart. These technologies have since been updated and have been joined by Silverlight (a relative of WPF, remade for Rich Internet Application use), ASP.NET MVC (which does away with the WebForms metaphor, but does not return us to the single-file comingled code + markup model), Language Integrated Query (LINQ), the Entity Framework (a data access model which sits atop, but effectively replaces, the native data access core, known as ADO.NET) and an array of application lifecycle management features within the Visual Studio IDE itself.

This is neat stuff. This ups the challenge to Java. It accommodates development of very large applications, built by big teams, distributed across the world. All of that is good. Much of it is crucial and necessary. But none of it helps that original constituency of developers who want a highly productive environment in which they can build entire applications (albeit smaller ones), quickly, easily, and largely by themselves. And those folks have been willing to be neglected for only so long.

Voting with Feet
Many of those productivity programmers have left the Microsoft platform, and many newer, younger programmers who also fit that profile, have steered clear of .NET and Microsoft completely, for this and a variety of other reasons. A lot of them have moved to languages like PHP.

If you look at PHP, you'll see it bears a strong resemblance to the old ASP: code comingled with markup, contained in blocks offset with <?php and ?>, inside files with a .php extension. There's no huge framework, nothing really like WCF and WF, and most PHP developers use very light tools for editing their code -- thick IDEs exist, but aren't so much the norm. PHP has a huge and enthusiastic community around it too. And while it may not be the right environment for those huge enterprise apps, it's good enough: Yahoo and Facebook run it, in fact.

So we're left with a situation where Microsoft is losing in market share, passion and enthusiasm to a development environment that works quite similarly to something Microsoft had 15 years ago. Yes, there are important differences: PHP runs on Linux as well as Windows. PHP is open source. Its syntax looks much more like C or JavaScript than it does Visual Basic. But the fact remains it has a simplicity and short path to productivity that intrigues developers and empowers them, and that's exactly what Microsoft knowingly and willfully jettisoned

Microsoft could always promote the fact that code + markup still works with ASP.NET. You can still use <%... %> syntax... and store everything in single files with an .aspx extension that you can then just push up to a Web server. You can edit these files pretty easily in Visual Studio. If you have the discipline to ignore all the other stuff in ASP.NET and the .NET Framework and all those menu options and toolbars and dockable windows in Visual Studio, you'll be fine. But advising abstinence and calm is no way to win over an entire population of developers that wants to spread out in territory that is friendly and navigable to them

Back to Basics
So instead of providing guidance around using a subset of ASP.NET Web Forms and a subset of Visual Studio, or just bringing back the old tools, Microsoft has done something far better. Through the introduction of a technology code-named Razor and its use in a new code + markup environment called ASP.NET Web Pages (not Forms) and provision of the new, highly streamlined WebMatrix IDE, Microsoft is beckoning the productivity programmers back, in a credible way, without condescension.

Now instead of starting your code with <%, you can use a simple @ sign for embedded expressions (and you don't need to end the expression with anything!) or use @{ and } for full-on code blocks. You put everything into files with a .cshtml extension (you can use .vbhtml too, with the inline code in VB.NET but the Razor code block syntax differs slightly). Razor also provides so-called HTML Helpers that make short work out of complex tasks. Want a scrolling window with tweets from me? Just embed this code in a page:

@Twitter.Profile("andrewbrust")

There's another helper just like that for Facebook, and a collection of others for creating data-driven user interfaces, sharing links on social networking sites and performing Web Analytics tasks.

WebMatrix also comes with a workstation-hostable version of Microsoft's Web server (Internet Information Server, or IIS) called IIS Developer Express. And it comes with a small, file-based database engine called SQL Server Compact, which is entering its 4th version, but only its first version optimized for ASP.NET. SQL Server Compact databases, and SQL Server Compact itself, can be easily deployed to any Windows Web server over any file copying protocol, including FTP. And WebMatrix can do that for you, with just a couple of clicks. It can even help you find a hoster and provision an account. There's also built-in starter features for creating and editing data, and for performing SEO analysis on your pages.

Web Matrix isn't exclusive to ASP.NET and SQL Server by the way. It also lets you edit and create applications using PHP and MySQL! That's a HUGE step for Microsoft, especially with regard to the database.

Gimmick, Experiment or New Leaf?
WebMatrix isn't perfect, certainly. And it's streamlining sometimes borders on plain old bare-bones. There's no IntelliSense (pop-up syntax completion), no rendered view of your Web Pages (you have to run the pages in a browser for that) and not much documentation that I can find, either on the tool itself or on Razor and the HTML helpers it includes.

Also, this is not the first product Microsoft has had called WebMatrix. An earlier product with the same name, back in the early days of .NET, which provided a simplified IDE for creating ASP.NET WebForms, was put on offer, also for free. That product gave rise to the Visual Studio "Express" Editions... but the original Web Matrix project died.

Will its successor suffer a similar fate? Is this just a freebie tool that Microsoft will obsess on for a while and then let languish? Is it just a cynical attempt at converting PHP developers over to the full-blown ASP.NET stack? It's hard to say, and Microsoft needs to make a real commitment to this WebMatrix if it wants developers to invest in it.

But it's a great start, and it's the first thing I have seen in a while from Microsoft that makes programming powerful and fun at the same time. I hope it's a precedent, and not mere anomaly.

Posted by Andrew J. Brust on 07/12/2010 at 12:52 PM


comments powered by Disqus

Reader Comments:

Wed, Apr 20, 2011

Instead of keeping the huge base of loyal developers (VB6/ASP Classic guys/gals) happy by offering an incremental approach to .NET, MS cast off the productivity base of enterprise developers. Now, 2011, that MS realizes that ruby/scala/php/sqlite have been eating its lunch do they come around to lure those guys back. Pretty funny how they do things. Also as part of the history lesson you left out 1.0 and 1.1 versions of .NET which MS cast out with the trash when 2.0 came out. Funny again how they are doing the same now with WPF and Silverlight for HTML5. Can't wait to see Windows8 and the new programming paradigm that will bring and what the next dying tech from microsoft will be. Ten+ years on the MS stack have left a bitter taste.

Thu, Aug 5, 2010 infocyde

This is a great step in a strategy for capturing the minds of younger developers. However, it is not a complete step. Every effort needs to be made to crush that growing Apple Market share amoung the young hipsters, or make the tools compatible with through an Apache module would be a few other steps off the top of my head. A targeted marketing campaign on non MS developer blogs/websites, maybe target "designers" oriented websites instead as they tend to by the casual users of PHP and would be a good segment to target. MS developers seem to be flaming the Matrix, and to me that is a good sign that this direction that Microsoft is taking is EXACTLY what needs to happen. The uber anal retentive types who spend all night pleasuring themselves to terms like DRY, OOP, TDD, ORM, etc... are the kind of folks that drive even middleweight developers who use the tech being the terms when needed away from Microsoft out of sheet repugnance for the over indulgent and condescending resume driven over engineering types. Microsoft has given a big ear to those types for a while, time to listen to others as well and expand that market base.

Wed, Aug 4, 2010 LG

What are the implications of downloading and installing WebMatrix if you already have IIS 5.1, VS2005, and SS2005 Standard? (on XP SP3 workstation) I couldn't find any such info. Can you or can you direct us to some source? Thanks.

Sun, Jul 18, 2010

To be more specific, there is WebMatrix beta documentation and tutorials at http://www.asp.net/webmatrix/fundamentals. You can get a single-article overview of creating a site using WebMatrix at: http://www.asp.net/webmatrix/tutorials/create-an-asp-net-website-from-scratch. And the following article overviews the Razor syntax: http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax. A detailed features listing is at: http://www.microsoft.com/web/webmatrix/features/

Sun, Jul 18, 2010

It might be worth noting that Microsoft has a substantial set of documentation for WebMatrix and the new Razor Syntax online at: http://www.asp.net/webmatrix

Wed, Jul 14, 2010 Gboluwaga USA

...Yep, Microsoft needs to add complexity to Visual Studio for enterprise development. We need some respect, just as Java developers. With WebMatrix, Microsoft can bring back the defectors!

Wed, Jul 14, 2010 Gboluwaga USA

I downloaded WebMatrix, and I have not done much of anything with it. I will give it a short though. However, I still prefer the king of all IDEs: Visual Studio.NET

Mon, Jul 12, 2010 Tybron

Great rundown. I think you failed to mention MS' technologies being so far over a beginning users head. Adoption of Php has really skyrocketed in the last few years, as a result. Open source and code logic that just makes sense to code.

Add Your Comment:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above