I'd like to share my thoughts and insicts on the Microsoft ASP.NET Atlas project. ASP.NET Atlas is a library of rich UI functionality using Ajax.
The thing that caught my interest at first was the way the JavaScript library was created. First of all it is not solely created for Internet Explorer, as most of Microsoft products have been before, but also for Firefox, Mozilla and Safari.
After going through all of the JavaScript code you can find some rellay interesting things that have made the JavaScript APIs really nice:
- Namespaces - organizes the classes and methods into a nice hierarchy
- Class inheritance - makes it possible to create abstract classes and inherit from other classes
- Interfaces - makes it possible to define an interface from which a class can derive
- Delegates
- Callbacks
For example the class Web.UI.TextBox inherits from the Web.UI.InputControl class which is derived from the Web.UI.Control class and the Web.UI.IValidationTarget interface.
This is all achived using a few methods, two of the caught my immidate attention:
registerNamespace(namespacePath): Creates a namespace
Type.registerClass(typeName, baseType, interfaceType): Defines a class with a typeName which inherits from the baseType and optionally derives from an interface.
All defined classes that inherits from another class uses the initializeBase(instance, baseArguments) method, which is a kind of constructor. The initializeBase method is a prototype function on the Function function (Function.prototype.initializeBase =function(instance,baseArguments)).
Going through this opened a new way of programming with JavaScript, for me. Please do check it out, and make nice rich UI web applications.
Note: The Atlas API's are used on Start.com, Windows Live and others.