Roll your own Web Part

Web Part was introduced in SharePoint Portal and will be adopted in ASP.NET 2.0. The whole Web Part infrastructure involves with the aspects in catalog, configuration, persistence and connection. I’m particularly interested in the connection feature.

To make a Web Part connectable to other Web Parts, it has to implement a set of interfaces. They are ICellProvider/ICellConsumer, IRowProvider/IRowConsumer, IListProvider/IListConsumer and IFilterProvider/IFilterConsumer. To coordinate the communication among the parts, each part also needs to override a few methods such as CommunicationConnect, CommunicationInit and CommunicationMain.

In the implementation, there are two base classes desgined to set up the framework. The BaseControl class is listed here.

	public class BaseControl : UserControl, IMessage	{
		public BaseControl() : base() {
		public event ErrorMessageEventHandler ErrorMessage;
		public event MessageEventHandler Message;
		protected void OnMessage(object sender, MessageEventArgs e) {
			if (this.Message != null)
				this.Message(sender, e);

		protected void OnErrorMessage(object sender, MessageEventArgs e) {
			if (this.ErrorMessage != null)
				this.ErrorMessage(sender, e);

		protected override void Render(HtmlTextWriter writer) {

		public virtual void CommunicationConnect() {}
		public virtual void CommunicationInit() {}
		public virtual void CommunicationMain() {}

	public interface IRowProvider {
		event RowProviderInitEventHandler RowProviderInit;
		event RowReadyEventHandler RowReady;
	public interface IRowConsumer
		void RowProviderInit(object sender, RowProviderInitEventArgs e);
		void RowReady(object sender, RowReadyEventArgs e);

The BasePage class defines the overall page layout and style, it also fires the CommunicationConnect/Init/Main methods on each connectable controls, plus other basic features that each page needs to share in common.

One needs to refactor and refactor the GUI design to get the best out of this architecture since suddenly many basic features of modern web user interface becomes reusable components that can be connected or composed into elaborate user interface to accompish rather sophisticated work.

Shadowfax and SOA

SOA has been the buzz word recently. I’m considering to use Shadowfax reference architecture for an inventory project. I like to maintain the capablity of XCOPY in deployment, which would be an issue since Shadowfax does need to intstall some programs that can not be deployed with XCOPY such as Exception and Instrumentation related functionalitites. Any ExterperiseServices related components might need installation program as well. You can get a copy of Shadowfax source code from here.

Plugin Architecture

Today is the last day of my five-week architecture project at AspenTech. We have completed a very flexible and extensible architecture design with a working prototype for highly integrated desktop application framework and runtime infrastructure used in the process control and online optimiation applications.

At its core, it’s so-called Plugin concept that enables the runtime to be configured based on meta data. The runtime starts with an empty stack with some minimal bootstrap to discover and load the plugins. All the application functionalities are provided by the plugins. The plugins can work together based on the meta data instructions.

We have provided a set of default plugins to interpret the meta data, support a sophiscated GUI interface that utilizes the Model-View-Control design pattern. There’s a default Undo/Redo stack. All operations can be undone/redone. The object persistence is available as well.

The techniques used are XML seralization, object serialization, reflection, code generation, dynamic evaluation, etc. The prototype is implemented in C#. We have been using Extreme Programming and Pair Programming via Net Meeting all the time. The results are very good.

Design Patterns and .NET

Microsoft has published a suite of design patterns using .NET. Not surprisingly, you can find striking similarities with the design patterns published by Sun Microsystems for the J2EE platform. Here’s the link for Patterns & Practices .

It’s definitely a good resource for architecting any solutions.

For discussion on patterns, visit this Patterns Community.

By the way, Mono project team has released Mono 0.24, which implements .NET on Linux.