Choosing the right web technology for business applications
Before I continue with the rest of this post, I first need to make a disclaimer. I'm in no way an expert on all things Microsoft has to offer in the web realm and have yet to complete a full-fledged ASP.NET MVC & JQuery project.
However, I see myself as someone who quickly grasps the potential and limitations of emerging technologies and tools, not only by actively reading blog posts and Twitter discussions, but also by talking a lot with community experts and experimenting myself. Since the inception of the .NET Framework, I've been designing and building enterprise-class business applications in Windows Forms, Compact Framework, ASP.NET WebForms with AJAX, WPF and Silverlight. Although I love things like NHibernate, Silverlight and the practices of Scrum and XP, I don't believe in silver bullets and will always try to choose the right tools for the right job.
So, now that we got that clear and before I share my conclusion, lets see some of the advantages and disadvantages of using the different web technologies for building greenfield business applications.
ASP.NET AJAX Web Forms
Advantages
- Easy to learn the basics
- User control model allows for simple reuse
- Abstracts the complexities of web applications behind an object-oriented API
- Feels quite natural for Windows Forms developers
- Loads of experienced developers available
Disadvantages
- Not designed for rich and interactive user interfaces
- Has many pitfalls that most developers don't think about properly (e.g. ViewState, SessionState)
- ASP.NET Page Life Cycle will hit you in the face whenever you try to do something dynamic
- Does not force you to use JavaScript and JQuery for interaction and promotes misuse of AJAX UpdatePanels which can seriously degrade performance
- Not designed for testing, even with patterns like Model-View-Presenter or Presentation Model
- Compile and startup time significantly increases when the application grows in size and complexity. This seriously hampers productivity.
- User interface design is limited to what you can do with CSS and pictures
- I'm not sure how long Microsoft is going to continue investing in WebForms
ASP.NET MVC with JQuery
Advantages
- Designed for testability
- Forces you to use JavaScript making it easier to build a responsive, very interactive UI, without unnecessary postbacks.
- No page-life cycle to worry about
- Quick startup time, regardless of the size of the application
- Microsoft is investing heavily in it
Disadvantages
- Requires a considerable amount of time to get up to speed.
- Completely different mindset compared to ASP.NET WebForms. Expect for the HTML/CSS part, you to have to learn everything from scratch.
- Relies heavily on JavaScript and JQuery for anything that requires more than static content. Since JavaScript is a dynamic language, expect long painfull sessions in the Visual Studio debugger.
- No automatic state management (although the data binding mechanism is quite nice)
- Limited Intellisense in JavaScript (but that will change in the future)
- Not possible to reuse parts of a page as an encapsulated control with logic
- User interface design is limited to what you can do with CSS and pictures
Silverlight
Advantages
- Great for internal applications or Internet-facing apps that have a controlled user-base
- Unlimited possibilities for user interface design and providing a rich experience
- Only requires knowledge on XAML and C#
- Allows to treat an application as a compositation of object-oriented controls, with all benefits
- No page life-cycle issues
- Styling the application in XAML is much easier than using CSS, especially with Expression Blend
- Separation between XAML and C# code allows for clear separation of concerns
- Offloads the load on application servers by moving some of the load to the browser
Disadvantages
- Requires users to install a browser plug-in under administrative priveleges
- Deployment within an enterprise requires some planning
- Only runs on Windows and MacOS
- Asynchronous programming might take some time to get used to
- The Visual Studio design-time experience sucks, but Expression Blend makes up for that big-time.
- Debugging Silverlight control bindings is non-trivial, but will be improved in Silverlight 5
- Multiple overlapping, but conflicting data access frameworks
- Building custom controls requires you to learning about peculiar concepts like Attached and Dependency Properties
- You have to account for the security risks of the availability of all client assemblies in the browser.
But, that's not all, since a while we have two dedicated tools that, though mistreated as being for hobbyist and amateurs, provide serious opportunities.
Microsoft WebMatrix
Advantages
- Rapid Application Development
- Uses the MVC / Razor engine, IIS Express and SQL Server Compact
- Allows you to start small and painlessly move to full Visual Studio & SQL Server
- Built-in SEO support
- Many open source web site templates that can be used as a quick-start
- Built-in Web App Gallery where you can download all kinds of add-ins such as CMS projects, blog engines, etc.
Disadvantages
- Fixed architecture
- Is designed for external hosting, and deployment with a local IIS is non-trivial
Visual Studio LightSwitch
Advantages
- Great for CRUD applications
- Very extensible scaffolding engine (custom XAML controls, custom data types, etc)
- Build-in and customizable templates for various types of data entry forms
- Design can be fully customized
- Relies on WCF RIA Services, allowing you to connect a LightSwitch app to different data sources or existing service-oriented architectures
- Uses Entity Framework and SQL Server out-of-the-box. Support for other vendors is possible using commercial EF providers.
Disadvantages
- Fixed architecture
- Not very scalable
- Engine-based, so you don't get access to XAML views
- There's no migration to Visual Studio
- Not many people know the exact limitations of LightSwitch
Conclusion
As I said before, silver bullets don't exist - at least, not within our profession - and you always have to make a trade-off when choosing one technology over the other. But even though there are usually many more factors involved than those mentioned here, the table below list the first choice.
Users / Nature | Static Content | Data Entry / CRUD | Rich Experience |
Intranet | WebMatrix / ASP.NET MVC | LightSwitch | Silverlight |
Controlled group of internet users | WebMatrix / ASP.NET MVC | LightSwitch | Silverlight |
Internet | WebMatrix / ASP.NET MVC | WebMatrix / ASP.NET MVC | ASP.NET MVC |
Regarding Microsoft WebMatrix, I have not found much that refer to any serious drawbacks. And indeed, it does seem pretty impressive. If you don't think WebMatrix is for you, then I would suggest replacing it with ASP.NET MVC. It's scaffolding features are not bad at all.
I would never advice any company to invest in WebForms anymore. The only scenario where I might consider it, is when the team has no experience in ASP.NET MVC or Silverlight and the project is too short to deal with the learning curve. And don't think the switch from ASP.NET WebForms to MVC is trivial, because it's not. And I can only talk for myself, but I wouldn't be surprised if learning Silverlight takes less time than MVC and JQuery. It sure will give you a higher productivity.
I'd really like to hear about your own experiences. Do you agree or disagree? Have you run into the limitations of WebMatrix or LightSwitch yet?
PS. You can also reach me through my Twitter account @ddoomen.
Leave a Comment