Got word today that I have received the Microsoft MVP Award for the third time. Of course it is April 1, so it could all be a big joke. I am hoping not.

Dear Nik Kalyani,  

Congratulations! We are pleased to present you with the 2008
Microsoft® MVP Award! The MVP Award is our way to say thank you for
promoting the spirit of community and improving people’s lives and the
industry’s success every day. We appreciate your extraordinary efforts
in ASP/ASP.NET technical communities during the past year…

I am honored. Thanks Microsoft.

DotNetKicks is a Digg-like site focused on .NET development. Thanks for Jon Galloway’s useful tip, I figured out how to add a dynamic Kick image to my posts. He has Javascript code, but I just hard-coded the following into the DasBlog itemTemplate.blogTemplate file for the theme in use:

Posted by nik at 8:00 am Tagged with:

InfoWorld’s recent comparison of Open Source web CMS systems gave DotNetNuke high marks with a “Very Good” rating. DotNetNuke was the only ASP.NET-based contender in the field of five. We are working hard on many exciting new enhancements and it won’t be long before we will bridge the gap from “Very Good” to “Excellent.”

You can see the report on which this comparison table is based:
 





  DotNetNuke Alfresco
Community Edition
Drupal Plone Joomla
Version 4.4.5 2.1 5.2 3.0 1.0.13
Publisher DotNetNuke Corporation Alfresco Software Drupal Plone Foundation Open Source Matters
           
Rating Very Good Excellent Very Good Very Good Very Good
           
Criteria
(weight)
         
Ease-of-use
(25%)
9 9 8 9 8
Features
(25%)
8 10 8 8 8
Security
(15%)
8 9 9 8 8
Scalability
(15%)
9 9 8 9 9
Management
(10%)
8 8 8 9 9
Value
(10%)
8 9 9 9 9
Score 8.4 9.2 8.3 8.6 8.4
           
Cost FREE FREE FREE FREE FREE
License BSD-style license GPL 2 with FLOSS exception GPL GPL GPL
Platforms ASP.NET, Windows Server, SQL Server 2005 Windows and Linux Apache or IIS Web servers; Unix, Linux, BSD, Solaris, Windows or
Mac OS X; PHP; PHP-supported database server (MySQL or PostgresSQL)
Windows, Mac OS X, BSD, Solaris and SuSE Apache, PHP, MySQL
Support          
Website dotnetnuke.com alfresco.com drupal.org plone.org joomla.org
           
Bottom
Line
Written in VB.Net, DotNetNuke is an extensible content management
system suitable for intranets, extranets, and public Web sites. The core
distribution includes three dozen CMS modules, including a skin system (based
on simple templates) that separates design from content, personalization, and
search; other modules range from e-commerce systems and photo galleries to
blogs, forums, and wikis. Commercial publishers offer other components.
This very inclusive offering, developed using Java, sits on top
of a JSR-170 content repository. Out of the box Alfresco provides a Web
portal framework; CIFS (file share) interface that works on Windows and Linux
clients; and a Web-content management system –- plus document, imagine, and
records management. Further, Alfresco scales well with options for deploying
content to multiple servers.
Written in PHP, Drupal’s Web application framework anchors a
content management system that includes modules for e-commerce and workflow.
Drupal, unlike other systems, also has a taxonomy system to classify content
– but this does take extra work to configure (as does setup). Themes are
created with the standard PHPTemplate engine. A blogging system makes this
system good for building online communities.
The Plone CMS, which is built on top of the Zope application
server, performs well for intranets – as well as a document management server
and team collaboration tool. The system is easy to use and also notable for
its multi-lingual capabilities. Additionally, Plone powers a number of
high-traffic Internet sites, though this configuration should included
additional components, such as Squid caching.
Joomla, written with PHP and back-ended by a MySQL database, is
appropriate for external Web sites and intranets. The system’s caching
provides good performance on higher-volume sites while various extensions
cover essential CMS functions; these plug-ins include news, blogs, polls,
search, and internationalization. To further expand functionality, such as
site backup, both free and commercial components are readily available.

Several months after the official release of Microsoft’s ASP.NET AJAX, I am still waiting to be amazed by slick web components from Redmond that make it possible to create rich, interactive user interfaces without third-party component suites. From the looks of it, my wait is not going to end anytime soon. With all the attention Microsoft is showering on Silverlight, it is now obvious that the component aspect of its AJAX solution has been and will continue to be a step-child. The message is clear — if you want to make your apps more responsive with fewer postbacks, use AJAX; if you want to create graphically rich user interfaces without spending a lot of time, use Silverlight; if you want to create graphically rich user interfaces that are also usable, keep looking. 

Seriously, what is the ASP.NET team thinking? Is the crap officially named ASP.NET AJAX Control Toolkit the best Microsoft can do? With a handful of exceptions, these components are a joke. They are ugly, clunky and lack consistency in their usability. What is the deal? Are there no designers or usability engineers in the company that can help the ASP.NET team fix this garbage?

In all fairness, I should not single out Microsoft. This problem occurs more or less across the board. Every major AJAX framework is so heavily focused on the technology, that usability and elegance are after-thoughts. DOJO and YUI have the exact same problem at varying levels. Excellent frameworks…mediocre components.

If you want slick components, you have only one choice – break out the wallet and check in with Telerik, ComponentArt or Infragistics, or write them yourself.

Crappy components are just one small aspect of the problem as I see it. There is a much, much bigger problem — each of these free (and commercial) frameworks is guilty of delivering a solution that puts the responsibility on developers to work out the appearance and overall user experience of an app that makes use of its components. Let me repeat that…the responsibility for appearance and user experience is placed on DEVELOPERS.

Take those alluringly elegant components from Telerik and ComponentArt, put them into the hands of your average ASP.NET developer, and what do you have — disaster. Why? Because there is nothing that makes it easy for a developer to:

  1. Determine in which situations it is appropriate to use a certain component
  2. Make multiple components work together so the user experience is fluid
  3. Style components so they have a consistent appearance, different from the shipping default
  4. Interchange or mix in the same app, components from different vendors without going insane

It seems to me that components are not the solution, they are the problem. Ever since Visual Basic 1.0 gave developers the means to easily drag all manner of UI widgets onto a canvas, we have been stuck with this problem of horrible user interfaces. And no one has fixed it. Now, don’t be telling me about Silverlight or Flex or RIA. They all are stuck in the same evolutionary rut. All they are doing is swapping out the what and the where; the how remains unchanged.

There are enough desktop and web applications out now where it should be possible for us to evolve past UI components and isolate and identify UI patterns that can then be used to create “UI Pattern Panels” that snap together to form a complete application.

How would these be different from components? Well, for one, they would represent a complete solution. Let’s take a common situation — tree on the left, data grid on the right, some action icons on the top, some action buttons on the bottom. I have just described some 90% of apps that allow management of any kind of hierarchical data. Instead of a developer wiring all this together with individual components, this should be a “Tree-Grid Data Panel.” Instead of having a zillion places where a developer can customize the styles, colors, fonts etc. there should be one for the panel. That’s it. You can’t muck with individual pieces. This might be painful at first, but once you get used to not mucking with the individual pieces, it leaves you with more time to focus on more important things and create a better solution. Does this sound familiar? You bet…it’s “convention over configuration.”

To its credit, the YUI! team has taken a small step in this direction with its Design Pattern Library. This is not nearly enough. TIBCO, which has arguably the most elegant and powerful UI suite of all, the TIBCO General Interface is heading in the generally correct direction with a SOA emphasis on UI components.

Who will put UI’s on Rails? What do you think about component-centric versus pattern-centric approaches to user interfaces?

As AJAX and Javascript widgets get more popular, it is not unusual to see Javascript from multiple parties running on the same page. This greatly increases the chances of collisions in variable and function names. For instance, two unrelated scripts might define the function “modifySomething()”. In this case, the last definition of “modifySomething()” on the page will be the one called. This is an invitation to disaster.

One way to prevent this is to practice defensive Javascript coding through the use of namespaces. In .Net and Java, the use of namespaces clearly delineates classes and prevents collisions. While Javascript does not have a built-in mechanism for using namespaces, it is relatively easy to implement them. In fact, just about every library such as Dojo Toolkit, Yahoo UI and ASP.Net AJAX provides a mechanism for registering and using namespaces in Javascript. This is fine if you are using one of the libraries, but if you are not, then how do you go about creating namespaces in your Javascript code. Read on.

Let’s create a simple “Cube” class with properties of Width, Height, Depth and methods grow() and shrink(). This class must reside in the “Speerio.Web.Solids” namespace.

If we try something like this: 

Speerio.Web.Solids.Cube = function(width, height, depth)
{
      this.width = width;
      this.height = height;
      this.depth = depth;
}

…we get an error. This is because Javascript expects to find an object “Speerio”, with a child object “Web”, which has a child object “Solids”. To make this work, we will first need to define a way to tell Javascript that the “Speerio.Web.Solids” hierarchy exists. We can do this by creating a function to create the hierarchy like this:

function $register(ns)
{
    var segs = ns.split(".");
    var namespace = window;
    for(var s = 0; s < segs.length; s++)
    {
        var seg = segs[s];
        if (typeof(namespace[seg]) == "undefined")
            namespace[seg] = new Object();
            
        namespace = namespace[seg];
    }
}

This function adds our namespace as a hierarchy of objects that are children of the top-level “window” object. It only works if the object has not already been defined, so it’s OK to register the same or similar namespaces multiple times. Now, it’s a simple matter of calling the function:

$register(“Speerio.Web.Solids”);

Once the namespace is registered, we can use it in our code as we would any other object. Since we are talking about defensive coding, let’s go further and define the “Cube” class.

Speerio.Web.Solids.Cube = function(width, height, depth)
{
       this.__width = width;
       this.__height = height;
       this.__depth = depth;
}
 
Speerio.Web.Solids.Cube.prototype =
{
       shrink : $Speerio_Web_Solids_Cube_Shrink,
       grow : $Speerio_Web_Solids_Cube_Grow,
       getWidth : $Speerio_Web_Solids_Cube_GetWidth,
       setWidth : $Speerio_Web_Solids_Cube_SetWidth
}

We start by defining the Cube class whose constructor takes three parameters — width, height and depth. In the definition of the class, these parameters are used to initialize properties __width, __height and __depth respectively. Why the underscores you ask? Mainly to discourage them from being directly modified. Javascript does not provide a set/get mechanism so to protect properties from being set directly, a small layer of obfuscation is necessary. It is not fool-proof…anyone studying your code will see this right away. However, it should be obvious that the intent is to protect the integrity of the data and prevent it from being modified directly.

Next, we define the various methods for the Cube class. For each method, the “public” method name is clear and simple. The actual method that does the work has a longer name. I used the following convention:

  • prefix all class methods with $
  • append the namespace and class name, replacing periods with underscores
  • append the name of the method, prefixed with “Get” or “Set” if the method is intended to be a property getter/setter

Now, we can define the actual methods:

function $Speerio_Web_Solids_Cube_Shrink()
{
    if ((this.__width > 1) && (this.__height > 1) && (this.__depth > 1))
    {
        this.__width--;
        this.__height--;
        this.__depth--;
    }
}
 
function $Speerio_Web_Solids_Cube_Grow()
{
    this.__width++;
    this.__height++;
    this.__depth++;
}
 
function $Speerio_Web_Solids_Cube_GetWidth()
{
    return(this.__width);
}
 
function $Speerio_Web_Solids_Cube_SetWidth(w)
{
    if (w > 0)
       this.__width = w;
}

And finally, some code to test the class:

var cube = new Speerio.Web.Solids.Cube(10, 10, 10);
cube.grow();
cube.grow();
cube.shrink();
alert("The cube width should be 11; the actual value is " + cube.getWidth());
cube.setWidth(100);
alert("The cube width should be 100; the actual value is " + cube.getWidth());

The above namespace-based class definition protects your code when it is running on a page where code from other parties is also executing. In addition the code is readable and likely easy to manage, even if months have elapsed since you last took a look at it. There may be a small performance hit the first time the script file is downloaded to the user’s browser due to the verbosity, but I’ll take verbose code that works over concise code that breaks the page any day.