Infosys Microsoft Alliance and Solutions blog

« March 2009 | Main | May 2009 »

April 24, 2009

WPF, XBAP, Silverlight - What do I use?

Microsoft introduced Windows Presentation Foundation (WPF) with .NET framework 3.0. What started as extensions to Visual Studio (VS) 2005 is a now a in-house native to VS 2008 and the VS 2010 designer is itself getting implemented in WPF (more details in Jason's blog here).

Needless to say that WPF is very powerful new presentation platform that really makes "imagination is the limit" a reality. Designers and developers can now work real closely like never before and create some really super cool user experiences.

Anyway, I am not planning to use this blog for explaining what WPF is all about. You can find many online articles on the same. WPF is native to .NET framework now and allows one to create thick client applications. However Microsoft didn't stop there and they had the support for XAML Browser Application (XBAP). XBAP is pretty much same as WPF and requires full .net framework on the system to run, but it runs in the browser security sand box.

Since WPF was targeted towards thick client, it was probably expected that MS will come up something that is for thin client applications. XBAP isn't really thin client since it needs full .net framework on client side. So we soon had Silverlight (SL), which is a sub-set of WPF (and fits snugly into a just around 4 MB download). Interestingly with SL 3, MS is adding the out of browser support for SL.

Given that SL really runs on the client side and uses WCF primarily to get server side data (unlike ASP.NET which runs on server side), SL application can continue to run even if there isn't a network connection, till the time one really makes a server call to pull/push data. Anyway, MS really took this forward but adding features that allows one to detect network connectivity and also take SL applications out of browser to give the real offline application scenario.

Now does this compete with WPF? Not really, since SL is a subset and you can't do all that you do in WPF, but for your typical business/departmental application, you would most likely anyway not use all features of WPF (some of them may still be restricted to game vendors). Hence the question really is where to use WPF? Where to use XBAP? Where to use SL? Where to use SL out of browser support?

If you are reading this for getting an answer to this, I regret to disappoint you, but I am also really looking at seeing how you are making use of these technologies. To me personally, there hasn't really been a real solid reason to do XBAP over WPF. Similarly people ask for offline support, but I am not convinced. If you can't connect, all your data isn't available and if you really want to cache some and do offline, then why not use WPF itself. People say that offline still allows you to target many different operating systems as against a full version of .net and WPF that will run only on windows, which seems reasonable.

However I will really like to hear from all you people out there as to what are your decisions points to select between WPF and XBAP and SL and offline SL? And do you think offline SL will impact usage of WPF?

April 8, 2009

"Oslo" Repository's Design Support for Schema and Data Versioning

An application has a lifecycle of its own and is prone to changes and enhancements. Hence when we talk about model driven applications, it becomes really important to think about how you can version your Schema and Data that you have in your "Oslo" repository. This whitepaper on MSDN provides an overview of the "Oslo" repository's design for supporting schema and data versioning.

April 2, 2009

Teach the Code to Hack Itself...

And the more it hacks itself, the more secure it becomes. Compilers are hard task masters. They cut out a distinct path for the application execution and force it to run that way, come hell or high water. Letting an application change its behavior by teaching it to understand itself has been a fairly less explored subject.

One main reason being, mainstream software developers typically confine themselves to the assortment of data structures provided by their favorite language. Say, a nice C# developer sticks to Hash Tables, Dictionaries and Generic entities or a hybrid collection of all these to represent all sorts of rules, constraints or any knowledge pertaining to the domain. But such objects aren’t mature enough to represent the kind of rules which can dynamically define the behavior of the application.

Let’s talk in non-technology terms. Here’s the most famous syllogism from the college-days.

Rule 1: All men are mortal

Rule 2: Socrates is a man

Question: Tell me about Socrates.

Answer: Socrates is mortal

How do you represent this when coded in your favorite language? If a software can be intelligent enough to automatically infer the Answer based on Rules 1 and 2, that would be its first step to modify its own behavior based on the business rules.

Let’s take the Outlook example we discussed in a previous post. We need to represent a rule where the software monitors a user’s actions of moving his emails from “Barack Obama” to the outlook archive “Obamaniac”. The software finds that the user always does this move, decides that this is his pattern of behavior, and it automatically creates an Outlook rule which moves all mails from “Barack Obama” to the “Obmaniac” folder.

One very useful method of representing such rules is the First-Order Logic. Mathematically, the rule for our Outlook example could be represented as below using First Order Logic. ( ThereExists= There Exists,And=And,ForAll= For All)

This would mean, “There exists a mail x, such that, at any given time t, the mail x is being moved to folder f”. The algorithm could involve a simple counting of the number of instances of MoveToFolder(x,t,f) being invoked, and if the count becomes more than 10 within the time range defined by t, then it gets identified as a pattern and Outlook creates a new rule for moving all mails x to folder f.

Implementing first-order logic in code is never simple. Prolog is one excellent language to represent first-order logic, but is too general purpose for our interest. What could be helpful, is something which, in principle, is similar to Prolog, but is more driven by the domain.

In the next post, we’ll explore the idea of domain driven representation of logic.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter