Web Development 2012: Game Changing Technologies and Tools From Microsoft

Microsoft has done an excellent job in the last few years with .NET, WCF, WPF/Silverlight technologies and the famous Visual Studio IDE. When we see how well these new technologies and tools can solve real-world problems and make all of us very productive, naturally we are all excited to make that extra effort to learn and take advantage of them. Some of us might be feeling a little relaxed now that we have a good understanding of .NET 4.0 and understand what LINQ, Silverlight, ASP.NET MVC are all about.

Well, don't take too long of a break. Make it quick and be ready for more exciting and mind-blowing multidimensional technologies and tools coming from Microsoft in 2012.

Not all of us get the opportunity to get to learn or have the time to quickly get a hold on these new tools and technologies. My experience is that it is best to work with new technology right from the beta. But not all of us can do this. So this article is my humble attempt to share my experience on what is new from Microsoft in 2012, in a way to return the favor to the community.

Most of what is presented in the article is coming directly from my hands-on experience, added with additional interactions I had with a few Microsoft speakers at TechEd 2012. Yes, it was a great experience to attend TechEd 2012 and as a bonus, I will try to give a few pointers on some interesting topics from TechEd 2012, in case you missed it.

Instead of focusing on code samples, the goal of this article is to talk about the best choices of tool technologies in the overly confusing development world out there. This article is targeted for a general audience in the software industry: Project Managers, developers, architects.

Finally my goal is to provide some guidance [if I can] from my experience, on how to go about these tools and technologies, instead of just listing out details on new technologies. I tried to provide a few unbiased technical justification where possible, instead giving the impression that I use it because I like the approach.

ASP.NET MVC 4

ASP.NET MVC is the way you would like to do any new web development in ASP.NET. You might have heard from Microsoft that ASP.NET is one team and they have same investment in both ASP.NET Web Forms and MVC. So they are not favoring one over the other. But the reality is tht ASP.NET MVC is a new and cleaner way to do web development. Ask any Microsoft person doing a demo of new tools/technologies using MVC, on how to do the same with ASP.NET Web Forms? Usually the answer you get is that you should talk to vendors and see if you can use any components that the vendor supports for Web Form scenario [but don't look for Microsoft to support one?].

The bottom line is that it is time to leave that code-behind, post-back model behind and move on to a superior, truly MVC-based implementation. The following are a few key reasons that might convince you:

  • ASP.NET MVC can co-exist and can be used in the same ASP.NET Web Form website

    • Yes, you don't have to rewrite existing Web Forms websites. Just use MVC for new development to start with.
     
  • You build one controller (Actions/Service Layer) but can build various Views (UIs) easily to address Desktop website and Mobile Website
  • You have a lot of control over the generated HTML and it is clean [Just compare HTML view source from ASP.NET Web site and ASP.NET MVC website and decide for yourself]
  • Razor View engine and new improvements in MVC4 are very productive and powerful
  • The best part is that MVC4 can be installed on VS 2010 and it works with .NET 4.0
  • All works with copy/paste bin deployment [So works in Cloud (Windows Azure) OR with your web hosting provider [as long as .NET 4.0 is installed]
  • Mobile website development is well thought out and supported out of the box [Makes it even better when used with JQuery Mobile]

Given the focus on the article, I tried to focus only on key features. Please see http://www.asp.net/vnext for more details.

ASP.NET Web API

Modern web development makes heavy use of Ajax and JSON when it comes to service interaction. MVC Controller actions or WCF Rest API are a few options in this area, to name a few. But none are as simple to use, supports multiple formats and OData out of box and is scalable. ASP.NET Web API is best to fit under the category of Web API for the following key reasons:

  • A single service API can support various client requirements: Desktop web sites, mobile apps and mobile websites
  • Simple/easy-to-use, scalable, true HTTP based API with many key features out of box.
  • Out of box support for OData [More features of OData are in the plan]
  • Open source [Yes. Who says Microsoft is against Open Source projects?]
  • Out-of-box support for various data formats [XML, JSON]
  • Easily customizable [add your additional formats, customize routes etc]
  • Can work with .NET 4.0 [No need for .NET 4.5]

When you try the Web API, Microsoft tries to push for a pattern that each controller needs to have one Get, Put and Delete operation and recommends creating one controller per resource. This approach is a better and cleaner approach. This is what Microsoft recommends. But there is no limit to what you can do if you want to customize.

For example, you might have a scenario where you want to use the Web API purely for managing specific custom methods on a resource. You can change the default routing to include "Action" and create any custom action methods on a single controller.

Should I care about WCF anymore?

  • WCF is still the best choice when you are developing Windows Metro Apps, Silverlight client development and middleware solutions.
  • WCF provides a richer object interface to work between the client and server.
  • Example: You can generate a proxy on the client for the easier use of WCF services in a client application; you can use a named-pipe or TCP binding for intranet service or client integration.
  • The Web API is a good fit for Web and mobile client development, where generation of a WCF proxy or the additional overhead of WCF configuration/complexity gives way for more simpler and scalable Web API.

Windows Azure/Cloud computing

It used to be a bit painful a years ago if you are hosting on Windows Azure. Now Windows Azure has a nice web console that makes pushing your ASP.NET Website to a cloud with a push of a button from VS 2012.

Web hosting

  • The Visual Studio 2012 publish option can publish your website to the Cloud [Windows Azure] very easily just like you publish using file deployment.
  • Using Windows Azure console you can tweak many aspects of your website and monitor your website traffic very easily.
  • Try out the offer that allows you to host up to 10 websites for free on Windows Azure.

Service Bus

Many of us are not ready to put everything in a cloud for many reasons. We want to leverage the cloud but somehow integrate the cloud into our enterprise world. With a minimum change to the client (enterprise) environment, we can leverage a Service Bus from within an enterprise.

You can host your website in the cloud and take advantage of scalability and all the power you get from Windows Azure. You can have your website or worker process in the cloud publish a message onto the service bus. You can subscribe to these message topics from within premises, in your existing services to process the message. You can also do another way to push data or publish messages from services within the premises to the cloud.

Azure Queue vs Service Bus

Azure Queues are based on Windows Azure storage and they are a good choice when you are working for a Queue type solution to connect a Web Role and Worker Role processing using message based infrastructure. Once you start needing more than a Queue you should explore a Service Bus. The Service Bus infrastructure has a lot more support for transactions (allowing to split messages and send multiple sub-messages to many subscribers and also aggregate all messages in a transaction with sequence order processing support).

In premises Service Bus

There is talk about supporting in premises Service Bus but no clear details on this yet. It is an interesting alternative to TIBCO type pub/sub infrastructure, if Service Bus is going to be available in premises. There are no details available on this yet but you can start taking advantage of the Azure Service Bus in a cloud.

ASP.NET SignalR

SignalR is an excellent option for real-time web development. It is like saying we can use HTML5 Web Sockets and ASP.NET Web Sockets today, even with older browsers and without requiring IIS 8/ASP.NET 4.5? It also works on many popular mobile browsers. What is more is that it comes with very easy to use samples.

What is SignalR?

Many times we display data on web pages that need to be refreshed frequently, for data to be meaningful and useful to the user. Stock ticker is a good example of this scenario. Or you are on a website and want to chat with a customer service agent. HTML5 WebSockets are first to come to our mind. But not all browsers are ready with this support. So we either do what we do (Use MIME tag or JavaScript timer or ask user to refresh page). SignalR makes this all an easy problem to solve, by doing the hard work for us. So why reinvent the wheel? We all can make the wheel better and run faster by contributing if we can, to this open source project OR at least use it where it fits best.

Why it is best choice for real-time web development:

  • The ASP.NET team is behind it
  • Uses HTML5 WebSocket and/or ASP.NET WebSocket [on server-side] if supported
  • Uses fallback options; so your code works in older environments and with older browsers
  • Works also with popular mobile browsers/OS [There are NuGet packages available for this but I have not yet tried them personally on a Mobile browser]
  • Very easy to use with great support

Windows 8 Metro Apps

Well I thought we are talking about web development. What we have to do with Metro apps? What is Metro App anyway and why do I care?
Windows 8 OS introduces a whole new concept of how to develop touch-enabled applications that are more intuitive and user-friendly. They did a lot of hard work for us from creating working projects to finalizing all good UI concepts, principles and patterns. The best part is that all these UI patterns and principles for the most part are provided to us in out-of-box VS 2012 project templates.

The reason I wanted to cover Metro Apps is that they are not going to stay just as Desktop apps. For the first time Microsoft has well thought out the Windows 8 Tablet that can run all your Metro apps. It is very possible that even the Windows Phone new version will support the same Metro apps (Just my wish and opinion only; no official news on this yet).

HTML5/JavaScript Metro App

Another reason it is important to cover Metro Apps is for the fact that you can develop the same application in both HTML5/JavaScript OR using XAML/C#. The important point is that if you are a web developer who is very comfortable with HTML5/JavaScript and don't want to learn XAML/C#, then I would suggest Metro App development in HTML5/JavaScript.

XAML/C# Metro App

If you either know both XAML/C# and HTML5 or are great at XAML/C#, I suggest you to stick to XAML/C# for Metro app development. I think Microsoft has started supporting HTML5/JavaScript also as an alternative to developing Metro Apps, to get more people developing applications easily rather than forcing everyone to learn XAML/C#. But if you are already doing Silverlight development in XAML/MVVM/C#, then it makes an excellent choice to stick with the XAML/C# environment.

Desktop development

Do Metro Apps mean we are ending the era of Desktop development, WPF/WinForms applications and moving to Metro Apps?

Honestly it is almost impossible to think of working without a desktop. Most of us need the power of great machines that we use daily. At the same time many of us are also getting into more mobile environments and want to have some part of desktop applications. Metro App is all about rich touch-enabled client experience on both desktop and on Windows tablets. Some of the desktop applications may very easily be converted to Metro Apps to take advantage of new features. On the other hand some desktop applications are too heavy to be converted to a Metro app and may very well stay as a desktop app in WPF/WinForms implementation.

The bottom line is that you have better options if you are planning to develop new applications and working on major migration projects. Knowing what is new and where it fits best is more important.

Mobile development using Metro Apps

There are a few news articles claiming that it is a dumb step for Microsoft to start introducing yet another tablet and trying to compete with Apple. I think it is dumb enough to ignore the facts and jump to this conclusion. Microsoft OS is heavily used in many enterprise environments. We need to develop applications that work in this environment anyway. Metro Apps are giving us a choice to also make our applications touch-enabled and mobile-enabled (Agree it is only on Windows Tablet) easily. For a developer this is an add-on benefit without extra work. Microsoft did great work in this area, more than just introducing a new tablet.

If Microsoft did not think of this, many of us will have no option to start looking at iPAD application development? So I think it is not by choice but a necessary step for Microsoft and I think it is better late than never. The Microsoft Tablet won't be an iPAD killer but over time will have its share in the mobile market (My opinion only).

Visual Studio 2012

NuGet: Almost everyone knows about NuGet by now. It is a great way to get your environment ready.

A word about NuGet packages: Many packages you install from NuGet might be from third-party. Sometimes it is best to install the package on sample and see the implementation details or what package has changed. Sometimes you can optimize your project better by borrowing ideas/code than directly using all packages as-is (mainly some third-party light-weight packages). You be the judge on what is easy to use; sample type package vs core infrastructure package.

End-to-end debugging in JavaScript world

  • Excellent debugging and intellisense support
  • JavaScript console, inspecting HTML markup and updating in debug session (bi-directional)
  • IE 10 Developer tools are also lot better (If you are using IE10 env)

VS 2012 is great IDE and it is not clear if many of new features can be installed on VS 2010 with a feature pack (There is talk about it). Also the fact that we can target older .NET versions means you can take advantage of a great IDE (VS 2012 RC) now even if you are not using .NET 4.5.

Microsoft Web Developers FOCUS Today?

The following are my recommendation mixed with my opinion about web development today, using Microsoft technologies and what are the best choices.
Microsoft: ASP.NET MVC4, ASP.NET Web API, Windows Azure, VS 2012/VS 2010

Other Web tools/Technologies:

  • JQuery/JQuery UI - Desktop web client development
  • JQuery/JQuery Mobile - Mobile web client/app development
  • Knockout - Very good MVVM implementation in JavaScript
  • SignalR - Real-time web development
  • JQGrid - Powerful data grid for web development

Using more tools, technologies and vendor controls does not necessarily make a successful project. Often you get into complex external dependencies and limitations. The best option is to stick with limited, well proven and well supported tools and technologies. This means a little bit of extra work in some areas, but at the end it pays off most of the time.

Silverlight for Intranet LOB applications?

Everyone these days says that Silverlight is dead. But I don't think that is true. Actually Silverlight is not dead yet. One reason you don't hear much about it is that with Silverlight 5, we got all that we need for what Silverlight is created in the first place. Sliverlight is a good choice if you are developing Intranet LOB RIA applications.

Yes, we are excited about HTML5/CSS3 and now we all think we can do everything that Silverlight does in HTML5/CSS3. Why Silverlight and why do we think HTML5 killed Silverlight? A long time ago people argued with me for hours that Silverlight will kill HTML.

On the surface it looks like we can easily build HTML5 websites in no time and create an exact rich interface that Silverlight applications provide. Yes if we have an expert team with skills in: HTML5, CSS3, JavaScript, JQuery, JQuery UI, ASP.NET MVC, JSON, Ajax - you can develop great applications that can match RIA developed Silverlight. This does not cover the testing you need to do on multiple browsers etc.

But with just XAML/C# you can quickly develop RIA LOB app in Silverlight (good fit in Intranet).

So for Intranet application development if you have a team that is skilled in XAML/C# already, going the Silverlight way makes sense. My point is not to underestimate the complexity involved in HTML5/CSS3 and the list of technologies mentioned above. It is not just HTML5 alone that will solve the problem.

Silverlight still has its place in Intranet LOB application development today?

Mainly for Intranet based LOB applications, Silverlight is still the best choice for a quick turnaround, if you need a solution that works off a browser and works with multiple browsers. Total Web development using HTML5 is not easy enough yet, compared to Silverlight quick approach in terms of complexity (unless you have right team that can handle it). Even with the release of Windows 8, not all enterprises are going to move quickly to use Windows 8, company-wide. Metro App development is good for Intranet LOB applications but not today?

So if you are in a rush to build Intranet LOB applications today, if your team is well trained and invested heavily around XAML/C#, I see no reason to use Silverlight today. After all it is all XAML and if you make sure the team follows a clean MVVM implementation, it should be easy to even port it as a Metro App as needed in the future.

TechEd 2012 highlights

Although a key-note focus is all about Windows 2012, Windows 8, Metro Apps, there is much more interesting stuff happening in many areas. The following are a few areas to watch Videos from TechEd 2012 website if you are interested:

  • What is new in WCF 4.5
  • ASP.NET Mobile development
  • ASP.NET Real-time web/SignalR
  • Metro App development in HTML5/Javscript or XAML/C#
  • SQL 2012
  • AppFrabric
  • Windows Azure, Service Bus
  • Hadoop on Windows Azure

Conclusion

I encourage you to watch videos from TechEd 2012 to gain a better understanding of what to look for from Microsoft. Hope this article helped to clear some confusion or strengthen your understanding around new technology/tools. All opinions expressed in the article are my own and please use your own judgment when using any tools or technology, keeping your team and project environment in context.


Similar Articles