Tuesday, October 21, 2008

ASP.Net AJAX 4.0 - New AJAX Support For Data-Driven Web Apps


Once again, ASP.Net is ahead of Dev Teams – AJAX 4.0 is in queue.

Background –

AJAX is an exciting Web platform for many reasons. Using AJAX, many tasks that were traditionally performed on the server happen in the browser instead, resulting in fewer round-trips to the server, lower bandwidth consumption, and faster, more responsive Web UIs. While these outcomes are the result of offloading a good deal of work to the client, the browser still isn't the environment of choice for many developers who would rather have the full power and flexibility of server apps at their disposal.

The solution employed until now has involved the UpdatePanel control, which has allowed developers to build AJAX applications while still retaining the full array of server tools. But UpdatePanel carries a lot of weight from the traditional postback model—an UpdatePanel request is still a full postback. This is again Not A Good Option, though 90% of the applicaions are using it very frequently.

A pure AJAX approach will almost always perform better than the UpdatePanel approach. In a purely AJAX solution, the rendering happens on the client and the server sends back only data. This approach can also substantially reduce the number of network requests: having the data on the client allows much of the application's UI logic to run in the browser.

The main problem with the pure AJAX approach, however, is that the browser lacks the tools to turn data into HTML. Out of the box, it has only two crude facilities for doing so: innerHTML, which replaces the full contents of an element with the HTML string you provide, and the somewhat slower DOM APIs that operate on tags and attributes. In an all this again very tedious to take the data and format it as HTML.

This is good option but lacks in the HTML rendering. HTML is only half of the story. AJAX applications really are about active content, not just client-side updates to the DOMagain. This is again Not A Good Option. However the solution to the HTML generation problem will be resoved in AJAX 4.0

Mx has planned to use this approach and even used it in one of the page. Later on we found that there are lot of hiccups with this appraoch due to HTML rednering. This made the decision towards ‘Update Panel’ – An easy but with performance trade-offs approach.

Solution - ASP.Net AJAX 4.0:

AJAX 4.0 will be launching with the below new concept.

· Server-side data manipulation

· UpdatePanel and the client

· Reducing postbacks and payloads

· Client-side template rendering

As mentioned above - There are two basic ways you can turn data into HTML. – innerHTML and DOM APIs. Apart from the HTML generation problem these two approaches has some major drawbacks.

innerHTML drawbacks –

· Injection attacks

· Expression language

· Code Interpersing

· Event Hooks

DOM APIs drawbacks –

· Lot slower than innerHTML

· Not very expressive, and the resulting code is hard to read and harder to maintain – However some tools like jQuery to make your life easy - but even with such tools, it's harder than it needs to be.

To overcome this Microsoft had already developed a Template Engine in ASP.NET AJAX Futures, but it was too slow and complex in design and we wanted to do a lot better. The bad thing about this failed first attempt.

But now MS has given solution to it and developed a new Template Engine. The dev team tested many different designs for a new template engine for ASP.NET AJAX, from string concatenation to full DOM manipulations, and it has been evaluated on performance, simplicity, and flexibility. Also been compared in terms of what scenarios they prevented from happening.

The principle of the new engine is simple: we take your template code, which contains HTML, data fields, expressions, declarative component instantiation and imperative code, and we turn that auto-­magically into JavaScript that creates the equivalent HTML.

Injection attacks take care of themselves.

Expression language - Simply JavaScript

The Finished Product

This solution will behaves very much like the UpdatePanel version, but there is no comparison in terms of network traffic.

Hope this helps.

Thanks & Regards,

Arun Manglick Senior Tech Lead


Once again, MS is ahead of Dev Teams - Microsoft Announces Visual Studio 2010

Microsoft is offering a first look at the next version of its Visual Studio integrated development environment (IDE) and platform, which will be named Visual Studio 2010 and the .Net Framework 4.0.

One of the main goals with the next generation of Microsoft's development platform will be to "democratize ALM - Application Life Cycle Management" by making it easier for developers, database pros, architects, and testers to work together in Visual Studio Team System 2010, code-named "Rosario,"

Microsoft is putting its attention on improving Visual Studio for the benefit of every one of its users—from the CIO to the software architect to the enterprise developer to the software testing team.


Rosario - Visual Studio Team System 2010

· A key goal in VSTS 2010, is to bringing all members of a development organization into the application development lifecycle, and removes many of the existing barriers to integration.

· VSTS target is to break down the roles, from the business decision maker (who needs a project overview but doesn't want to be bogged down in details) to the lead developer or system architect (who enables the software infrastructure and draws the blueprint), to the developer who writes the code and the database administrator (DBA) who integrates it with the company database to the testers (who make sure the software is of high quality).

Agile Tools, Built-In

· Visual Studio 2010 also will support features to integrate Agile methodologies into the tech stack using Team Foundation Server.

· This involves including an Excel workbook that can hook up to the back-end Team Foundation Server repository, and better build management.

· This will in turn help the Scrum process, so they can get burndown from their project.

· These features will let Agile teams track daily progress, see projects broken down into iterations and use sprints.

Must-Do Testing feature –

· Developers often neglect regular testing when they are writing code because it's time consuming or difficult to figure out which unit tests to run.

· VS 2010 have made some significant strides here. In Visual Studio 2010, tools will help create a direct relationship between unit tests that Must Be Run and the code a developer is writing. This "must-do" testing feature, called Test Prioritization, will get the developers to check their code against at least the highest-priority unit tests. (It, too, shows the impact of Agile methodologies.)

Microsoft's "Oslo" modeling strategy

· Visual Studio Team System 2010 will include some pieces of Microsoft's "Oslo" modeling strategy, as first demonstrated at Microsoft's TechEd conference earlier this year.

· The Architecture Explorer will allow architects and developers to build, customize, and see an architectural diagram of an application and enforce architectural consistency on builds of a piece of software.

· The software will support the Object Management Group's Unified Modeling Language and domain-specific languages.

There's no set date for release for Visual Studio 2010 or even a beta schedule, though the final release won't necessarily come as late as the name implies.

Microsoft will be folding together two formerly separate products, Visual Studio Team Edition for Software Developers and Visual Studio Team Edition for Database Professionals.

Hope this helps.

Thanks & Regards,

Arun Manglick Senior Tech Lead

No comments:

Post a Comment