Tuesday, August 23, 2005

Tenets of SOA

Last time we discussed some points about SOA. We analyzed what SOA really is from a laymans perspective. Today if you start you browser and search (obviously Google) for SOA, you will be inundated by numerous results. You just skim through some links or papers on SOA, and you will find yourself totally lost. Everybody who is in market of SOA and having some kind of product to support is, has his own definition and terms for SOA. So when already there are so many definitions, let me also make my own stance. Because I am not a big think tank who can propagate his own definition, so I will re-iterate Microsofts definition of SOA. Now you will ask, why only Microsoft. It is because, any way we are going to use Microsoft technologies (i.e. Indigo) so why not to follow what Microsoft says.

Backbone of SOA is Service. Service may be any thing from A-Z that provides any kind of Service to Consumers. Now what is this alien thing Service is? Service is a program you interact via message exchange. Another buzz word, Message? Message is any kind of data that is sent to a Service. You send some data to Service in form of Message and Service replies with result set in form of another message. Whenever you try to build up some kind of framework, you have to define the guidelines, you have to lay down some definition to recognize what comes under such framework and what not. When proposing SO (Service Orientation) to its developer camps, Microsoft laid out following four doctrines (MS says them as tenets):
1. Boundaries are Explicit
2. Services are Autonomous
3. Services share schema and contract, not class
4. Service compatibility is determined based on policy

Now some work of Ctrl-C and Ctrl-V. Richard Turner, Program Manager in Indigo team, explains these four doctrines in following way:

1) Services have explicit boundaries, that services, the only way to interact with a service or to obtain information or modify the state of the service is via the technology exposed in its out-of-boundary edge.
2) Services are autonomous. And what this means is that if I was to build an application that consumed a service that was outside of my boundary of control then I would not expect the service at the other end to implement its functionality in any particular way or manner. I wouldnt be able to influence it in any other way. I wont be able to connect my SQL Server database to directly to the SQL Server database or Oracle database or whichever inside the remote service. Im simply talking to that service through its boundary and it also automatically enforces an isolation layer between our two services. This allows us them to construct very flexible, very de-coupled applications.
3) Services share schema and contract, not class.And more accurately maybe, not objects. Services are about passing information back and forth between two entities such that those entities can communicate in a common fashion. This is not about remoting an object that actually runs on a service remote from me and controlling it from my environment because the other service maybe running on a platform completely different to mine and I may not have knowledge as to how to affect that component and how it runs in that environment. So services are all about passing information back and forth passed by a value if you will, or ratherthan by reference.
4) Services interoperate based on policy.And the policy can be information such as, for example, as a service if you want to speak to me you must support some kind of security mechanism. Or you must support TCP as a transport protocol. Orthat you must support transactions, for example. Now some of those capabilities are available today through things like COM+ or Enterprise Services in that I can mark a component as requiring transactions and if I state that transactions are required youmust interoperate with me using transactions fully supported through DTC. This isnt necessarily fully available through all technologies however and were working to make this a reality in the near future.

Are you still there or disappeared? I am re-iterating that this was not my explanation. Ok, let me create my own explanation. Do you like pizza? How many times a week you call for a pizza? Come, well try to understand these four tenets through pizza delivery process.

1) Services have explicit boundaries: There is no specific technical definition for this tenet. Lets try to understand it this way; you called up pizza corner in kormangala, but you stay in Jayanagar. When you tell pizza corner that you are calling from Jayanagar and wants pizza to be delivered there, then pizza corner representative may divert your call to Jayanagar branch or may express his inability to deliver pizza to there door step. Why so? He cant, because cost of delivering pizza from kormangala to jayanagar will exceed his benefit. The same lies with Services. Any service has its own boundary and it is assumed to be expensive to traverse.To balance this behavior service calls should chunky not chatty. Based on you should decide on what can be made as Service? Whether it would be a good candidate to make it as service? Does it do some good amount of processing that will equate the expense occurred due to traversing across boundary? At this point, we can alter first tenet of SOA to Services have explicit boundaries and are assumed to be expensive to traverse in order to make it more understandable and expressive.
2) Services are autonomous (I do, what I need to do): This is quite easy to understand. This means, I should not bother how one particular service did its job. My job is to just pass a messageand get back a message. I have explained it earlier also a bit. Suppose today pizza corner has only one phone line to receive your orders. But it doesnt matter to you. Right? Tomorrow due to satisfy he increases the no. of phone lines through internal extension or whatever for that sake. This way you are decoupled from implementation of this component or say service. Now that service may gradually enhance its implementation, but it doesnt affect you by any means. This is one beauty of Service Orientation.
3) Services share schema and contract not class: Again come pizza corner. They let you know what kind of pizzas do they have and how many people that particular pizza serves up to. This is your schema that what kind of pizza do they have. Based on this you decide whether to continue your talk further or not? Same way you will decide based on particular services schema, whether it is useful to you or not? Telephone no. of pizza corner is the contract between you and their service. Service says, you call me on such and such no. and I will let you know my services, yet it doesnt give you out its implementation.
4) Services interoperate based on policy: This is the last point. You may be well versed with this. Have you noticed that after taking your order for pizza that pizza corner girl asks you, Sir, would you like to pay cash or through card? This is policy. In case of pizza corner, human factor and hospitality is coming into picture that is why they asked about policy at the last. But in case of accessing any service both the points have to come to one consent that how they will talk to each other.Whether they will talk over TCP or HTTP? Whether their will be any kind of security implementation like handshaking or other kind of security implementation. These are the policies.

Hope due to this pizza corner example, I didnt worsen the situation. Happy journey to Service Orientation!

PS: Here is one good article on Service Orientation. No camping, nothing. In my openion it's a must read on SO: http://www.oracle.com/technology/oramag/oracle/05-may/o35design.html

Saturday, August 06, 2005

Little about SOA

You can say SOA is Service Oriented Architecture. But question comes is what is this Service Oriented or Service Orientation? I am not going to take you to any technical details here. We will simply discuss what can be service oriented environment. Service orientation is a means of building distributed computing system. At its most abstract service orientation views everything from a mainframe system to the printer to the clerk at RTO office to the shipping company - as a service provider. Service provider expose their capabilities through interfaces. Service Oriented Architecture maps all these capabilities and interfaces so that they can be orchestrated in a process. The key factor of service oriented model is the separation between interface and implementation. The invoker of service need not (or should not) know implementation. Invoker just has to understand the interface provided. Over the period of time implementation can evolve. For example - Citibank provides you with number of their call center. It is a service according to service orientation. You dial the number and receive the service. You need not to bother whether they use EPBAX system within the system or some other method. You need not to know whether 10 people are their to attend your call or 101. This loose coupling between interface and implementation gives freedom to implementor to change implementation (no. of people attending the call) at any time and retain the compatibility as long as interface (in this case phone number of call center) is not changed. Ok at this point you know what Service Orientation is. But what is it good for?

Ok, take a case with egg. To a farmer it would turn out to be a chicken. A cook might see it as omelet. A little kid may foresee one vibrant easter decoration. So, service orientation is an egg.

To developers and architects it could turn out to be a mans for creating dynamic collaborative system. Service orientation allows them to pick up specific capabilities and lay them down to make one system. To the IT manager it can be a means to effectively integrate the capabilities of different system to make one much better system. To CIO it may be a way to save organization investment on different system over a period of time. By encapsulating a business application behind capability-based interface the service model provides controlled access to mission critical application. To the business analyst service orientation is a means of bringing technological investment more in line with business needs.

Here I have just touched the generic view of SOA (much hyped word and everybody wants to have it now a days). I didn't go into any technical depth here. It was a layman's definition to SOA. You can try on your own to find out how big shots may describe service orientation (long live Google). You will find that every body is busy touting SOA according to their benefit. Will see how we can escape through this and learn some good points about SOA.

Motivation behind Indigo and Service Orientation

Hello Friends, after a long hibernation I am back. Some time back I had promised about delivering content on services and Indigo. So now you should expect some good amount of content on services. This one is going to be on making of Indigo.

At this point I can expect one question from you. Why another technology from Microsoft with yet another fancy name? To describe the necessity of Indigo I would like to take you to early days of programming. Code-Reuseis a holy grail of software development. Even when people used to code in assembly, they were inclined towards code reuse. Jump statements used to accomplish code reuse. However this reuse is enough to make your code hard to maintain and gibberish. Thencame the age of procedural programming where emphasis was on reusing procedures. Did it make any good for business? It was pure code level reuse and it has nothing to do with business aspect of software. After this in 1980s object revolution came. It forced each and every developer to see his software piece as an object. It was great to think every noun in your software as an object, an object that has some properties, some functions, some private data and some public data to share with outside world. Encapsulation provided some way to create boundaries in your system. But it was very hard to maintain and needed religious OO developers.

In 1990s flaws of object oriented software development became clear. Objects were good to be reused within one application. But how another application can use object sitting inside one other application? Was it a trivial job? Object oriented programming relied totally on implementation inheritance and behavioral polymorphism as extensibility points. When developers tried to use these technologies to extend the functionality of existing system, they got interrelated type hierarchies those were tough to maintain and understand. Moreover from business perspective it was not adding any value. You can not have specific functionality of one application, being used by another application.From DLLs point of view, you had to share some kind of metadata (in form of C++ header files). Another point is cross library calling convention is still not standardized. DLL compiled through Microsoft C++ will not be callable in Borland C++ compiler. By 1990s it was clear that even objects are not the solution to the problem of code reuse. This gave the rise to Component Oriented technologies like OLE, COM and JavaBeans in the early 1990s.

Goal of component oriented software was simple: provide the common infrastructure to make binary object possible in general case.Fundamental behind COM is to provide one standard way so that component can be reused and be treated as object. Though COM is just the standard, the way a software piece should be developed, it was long time job of only and only C++ programmer. Later VB closed that gap and COM became one of the most successful technology out of Microsoft.Over the invasion of internet to normal persons life by mid 90s, COM became on hulk. At this moment enhancement like DCOM and some other similar solutions like CORBA and Java RMI came into picture. All of them shared a simple concept of invocating a method against a local object and stretch it across networks. Theoretically it sounds good but in actual life it turned out as a big flaw. The premise that local method invocation isnt all that different from remote method invocation gave rise to the great fallacy of distributed components: location transparency.

The idea of location transparency proved one fact that theory is very different than practical aspects. For example-
   foreach(User user in userCollection)
   {
      
Process user
   }

In theory it doesnt matter at all where userCollection is lying locally or in a remote machine. But in practice it was felt that location awareness is necessary. For instance think that code that is executing this loop is in Bangalore and userCollection is on a slow network in Mysore. Suddenly this turns out to be a nightmare. If this was the only technology problem, it could be solved out by employing better technology at place. Other issues were security and reliable messaging. How will you make sure that the other end whom you are communicating with is a reliable one? How will you make sure that message you sent to other end reached successfully? Efforts to solve these problems came into picture and paradigm sifted from Object orientation to Service orientation. Service orientation is all about passing message to a distant entity and let that entity to process it locally at its end and passing back the result back in form of another message. Service orientation is about composing loosely-couple entities to make complex distributed systems. It uses message-passing as its core metaphor and is implemented using standardized set of interoperable technologies:
  • A common data model (XML Infosets)

  • A common message format (SOAP)

  • A common way of describing message contents (XSD)

  • A common way of describing behavioral capability (WSDL)

  • A common way of describing infrastructure (WS-Policy)

So does this mean that Indigo solves all these issues with regard to code reuse and building complex system that can be used by business? Does this mean that employing Indigo gives you service orientated system? Even after all this preaching, what is Indigo all about? Hmmm, let me first think over first two questions. Meanwhile we can continue our journey to know Service Orientation in a better manner and then I will let you know what this new animal on planet "Indigo" is.

Tuesday, June 21, 2005

My Fantasies

When I was attending session on "Windows Forms Internals" at TechEd, I came to know about some really good features in Windows Forms 2.0. Here is a big list:
1. Now you can have menus (MenuStrip) looking similar to those are in Office 2003. Before Windows Forms 2.0, you had to achieve this by buying some third party control.
2. Your menus may have an icon for each MenuItem. Previously you had to write some junk code to first make it in OwnerDraw mode and then draw custom icon.
3. Common item of general menus will be added for you by default. It is another fact that you have to do code to implement the logic behind them. Any way it saves you some amount of time from coding those items.
4. Now you can have toolbar (ToolbarStrip) similar to Office 2003.
5. It also does have common items created out for you.
6. Now you can place a dropdown list box on toolbar without doing much wrestling with this control
7. Another amazing control is ToolbarStripContainer. It may host MenuStrip as well ToolbarStrip and guess what feature does it give to you. You make it the parent of MenuStrip and ToolbarStrip and set its dock mode as DockFill and see the magic. Now you can move either your MenuStrip or ToolbarStrip to any corner of your Form. Isn't it cool? Do you strill remember how much juggling you had to do with native APIs to achive the same thing.
8. Another sibling of these controls is StatusbarStrip. It does have same amount of exciting as other controls are having. Now you can have ProgressBar as well as DropDownlist in statusbar without digging into the details of owner drawing.
9. Do you remember yourself trying to accomplish out something with Windows Forms in .Net 1.1 or earlier. You poor boy. Windows Forms datagrid control in .Net 1.1 was the worst control in universe. Do you still remember, how much wrestling you had to do with DataGridColumnStyle to put a dropdown list in Windows datagrid. Now gone are those days. Windows datagrid in .Net 2.0 gives you all kinds of column styles those you need in simple life. It is a boon, if you need to give some sort of tabular capabilities to your application.

Now what? After getting these many new features, you are ready to create your next killer application. A great amount of thanks to Microsoft Windows Forms team, which has done a great job. All of my fantasies about Windows Application have come true. :)

Monday, June 20, 2005

Office Smart Clients and Visual Studio Tools for Office... From Tech Ed 2005

To get a better picture of smart clients we have to look for thin client and rich client application models.

Rich Client Rich client mostly used to be in 2-tier applications. Presentation tier used to have entire business logic and data store used to dothe job of data layer. These kinds of applications are hard to update, in case of any update to presentation tier or business logic. You have to distribute all files to each and every user who are using your application. Though it provides rich experience and response to users, installation of another application may break existing application (widely known as DLL Hell).

Thin Client With the advent of internet and its wide availability gave us opportunity where all business logic sits at server. If any modification is needed in any logic, we can go and update the server. Though thin client application model solves the problem of deployment, but it lacks the rich UI experience. This kind of application may not provide drag and drop support, undo-redo andcontext sensitive help. Due to business logic sitting at server, all clients need to have network connection all the time. Once you request to server, you have to wait for server to get the response. This makes thin client application less responsive, usable and efficient.

Solution to these problems?

Smart Clients Smart client application model gives you the benefit of both the worlds. It gives you deployment manageability of thin clients and user experience of rich clients. Though striking the perfect balance of both worlds depends upon you. In smart client application you can have following characteristics:

· Use of local resources
·
Use of network resources
· Support for occasionally connected users
· Provide intelligent installation and update.
· Provide client device flexibility

You can have your next killer smart application in three ways:

· Windows smart client application
·
Office smart client application
· Mobile smart client application

I will just bring out some main points about advances of office smart client applications.

Developer Productivity
· Support for Excel 2003, Word 2003, Outlook 2003 (Add in support).
·
Full access to .Net framework
· Integrated debugging through VS.Net 2005
· Support for managed controls. No more ActiveX controls
· CLR based security
· Support for Smart Tags
· Support for Action panes. Sadly still no support for Research pane

Deployment Made Easy
There are three ways you can deploy the application:
· Local / Local Your document as well as assembly both will be at client computer. Do you notice any thing important here? This model gives you maximum offline support but has all problems of rich clients. You have to take trouble of updating all clients in case of any update.
· Local / Network In this model only document will be at client machine. Assemblies used by this document can be hosted at server. Document maintains dependency of assemblies based on embedded application manifest. In case you update one assembly at sever, document will be able to see the updates and it downloads the latest assembly from server.
· Network / Network In this model both your document and assembly will sit in server. You can update document as well as assembly without troubling your clients. But this brings the issue with thin clients. Now you need network access even if you want access only to document.

Maintaining Security
Do you smell anything wrong here? Do you see the issues those were with Office macros?
No not at all. After all CLR is there to maintain security. .Net code within document will run only when all four security policies (Enterprise, Machine, User and Application) agree to grant the permission. When permission is asked by document, an intersection is done of all four policies and if it agrees then only document gets the permission and can execute.

Requirements
· Office 2003 Professional Edition SP1
·
.Net 2.0
· Visual Studio Tools for Office runtime (Client machine)
· Office Primary Interop Assemblies (PIA)
· Appropriate Security Policies

Could not load package xxx. Contact package vendor error comes in Visual Studio 2005 Beta 2

It was saturday night, when I started with Visual Studio 2005 Beta 2. I had got the DVDs at Tech Ed 2005, B'lore. It started well. It started installing products one after another. After some one hour of wait installation was through. Ahhh... now I could try out my hands with Visual Studio 2005 Beta 2. But alas! It didn't work out. It spit out one big error message, "Could not load package xxx". It was package related to Team System, so I ignored it. I went ahead and IDE came properly. I started with creating a new Windows Application. VS 2005 created it but again gave me somewhat similar message, "Could not load package Microsoft.VisualStudio.CommonIDE". Hmmm... What could be the issue? I checked for this DLL in installation folder. This DLL was not there. So I added it to GAC. After doing this I tried to open design surface of Form. It said "Could not load package from Microsoft.VisualStudio.Interop.Shell.8.0. Contact package vendor". Hmmm... now what? I searched for similar DLL in installation folder. No vain. I searched DVD also but to no avail. At this point I was not ready to give up. Package vendor without any doubt is Microsoft. They might not be wrong, but something wrong with installation. I peeked into GAC again and here comes the solution. There are two versions of "Microsoft.VisualStudio.Interop.Shell.8.0" with similar version and culture. I deleted one of them and voila, VS 2005 has started working properly. Now it's time to put some controls over form. It cried "Could not load package from Microsoft.VisualStudio.Interop.Design". :) Now I know where to go and fix. After fixing this, I am ready to go. Pressed F5. Wow this time, VS 2005 crashed. But by this time I knew, where to go and fix these issues. Delete one entry of Microsoft.VisualStudio.Interop.Debugging DLL from GAC and now you should be back in business. I am running fine after doing this much solution hunting around VS 2005 Beta 2 installation. Hope to have some good experience around .Net 2.0.

Friday, June 17, 2005

Summary of Tech Ed 2005

Well it started with all fancy things like laser show etc. Then Director of Developer Evangelist in India came and said, "Do you know why am I wearing sun glasses? Because future is so BRIGHT in Microsoft horizon." Though I am fan of Microsoft technologies and its innovations, I could not bear this statement. Any way after this key note session started. It was full of demos of some upcoming technologies that include Visual Studio Team System and Visual Studio Tools for Office. All these demos made me kind of sleepy. Actually I was expecting some marekting guys to come there and display some good looking presentations on upcoming technologies. As against of this, some techie guys came and ruined the key note session.
Any way after this I decided to attend "Smart Clients and Connected Systems" track. It started off with introduction to Visual Studio Tools for Office. It was a good session. Presenter showed the next version of VSTO and showed how well they are integrated with .Net framework. All the control to be used in VSTO are managed controls. VSTO gives amazing felexibility in order to develop Office Smart Client Applications.
At the end of Tech Ed 2005 India, I realized that Micorost is screaming SOA like any thing. They are plumbing their money in SOA. Microsoft is getting SOA in its dreams as well. Each of their product is getting aligned with the concept of SOA. You see Office Smart Client Application. It gives you capabilities to develop SOA application. You see Biztalk Server 2004. It gives you amzing features to enable your application SOA. You see Indigo, see at SQL Server 2005. All are touted to support SOA from their heart. As obvious, I heard enough of SOA in Tech Ed, hence I am going to repeat all that here too. Wait for upcoming posts...

Friday, June 10, 2005

Food for brain...

Today when I was browsing, I got two wonderful links on net.

Below is the link to patterns and practices wiki on security. It is extremely good in order to prevent your application from any security threat. In this site you will find scenarios where you can save your application. Authorization, cryptography and lots of other points are discussed in detail at this place. Plus of this site is, it is addressing ASP.Net 1.1 as well as 2.0
http://channel9.msdn.com/wiki/default.aspx/Channel9.TestDriveSecurityWiki

For those who won't be able to make it to Tech Ed 2005, here is the link of live webcat of tech Ed 2005. You can watch almost of them online...
http://www.microsoft.com/events/series/teched2005.mspx

Friday, June 03, 2005

Attending TechEd 2005 India

TechEd2005

Recently I am nominated to attend Tech Ed 2005. I will be attending it in Bangalore. I have chosen to take part in "Connected Systems and Smart Clients". It has sessions of Indigo, BizTalk Server 2004 etc. I am really eager to see, how Indigo is going to change developer's life. BizTalk Server 2004 has already proven itself as a matured and successful product. Let's see if we put Indigo and BizTalk Server 2004 together, what kind of wonders can be accomplished. See you there at Tech Ed 2005 B'lore India.

Saturday, May 21, 2005

Exception Handling

Many times, I have been asked the way exceptions should be handled. This is a frequently asked question to me, so I am going to post details abuot it here. For Demonstration purpose I have written three small classes. UserInterface deals with user interaction. ProcessService will take care of all processing job or delegation to business layer. BusinessService is our dear business layer. My code goes as following:

using System;

public class UserInterface
{
public static void Main()
{
ProcessService processService =
new ProcessService();

try
{
processService.ChangeStatus(
true);
}
catch(Exception exp)
{
Console.WriteLine(exp.Message);
Console.WriteLine(exp.StackTrace.ToString());
}
}
}


public class ProcessService
{
public bool ChangeStatus(bool status)
{
BusinessService businessService =
new BusinessService();
try
{
return businessService.ChangeStatus(status);
}
catch(Exception exp)
{
//Just say throw. Don't ever say throw exp
throw exp;
}
}
}


public class BusinessService
{
public bool ChangeStatus(bool status)
{
//Some logic to change status

//if logic fails, throw an ApplicationException
throw new ApplicationException ("Some business error ocurred");
}
}


Now can you tell me what is wrong with this code? If you get, very well. If not than just see the code in catch block of ProcessService. I am catching the exception "exp" and throwing it again "throw exp". In this case you will loose original stack trace. A new stack trace will be generated and that stack trace will show you that exception was raised by ProcessService, but originally exception was raised by BusinessService. Your stack trace would be something like this:

Some business error ocurred
at ProcessService.ChangeStatus(Boolean status)
at UserInterface.Main()

This stack trace was not expected! It is not giving me clear picture that what happened. Error was raised by BusinessService but here it is depicted that it ocurred in ProcessService. To correct this thing, don't say "throw exp;". You got to just say "throw". Throw it as you throw any garbage, without touching that. Now your stack trace will look like this:

Some business error ocurred
at BusinessService.ChangeStatus(Boolean status)
at ProcessService.ChangeStatus(Boolean status)
at UserInterface.Main()

Now we have clear picture that Exception was actually raised by BusinessLayer. Here again we have one point to ponder. Do you see that now my stack trace is one line bigger. Can you imagine the scenario when you have 10-20 or more than that calls when exception occurres. It is going to just bloat your system and bring down the performance of your application. My suggestion for this kind of scenarios is "Don't catch exceptions until you want to catch them." Let them bubble upto UserInterface and UserInterface will handle them in a graceful manner. You got to change ProcessService in following manner:

public class ProcessService
{
public bool ChangeStatus(bool status)
{
BusinessService businessService =
new BusinessService();
return businessService.ChangeStatus(status);
}
}


No try{}catch{} in middle layers, OK! Now our stack trace would look like this:

Some business error ocurred
at BusinessService.ChangeStatus(Boolean status)
at UserInterface.Main()

This gives me clear picture that what is happening and where is happening, without much clutter.

one last point before leaving you guys on exception handling is, don't leave your try{} without catch block. Some time you would have coded like try{}finally{}. Never do this again. To read more on this issue go through following article. It will open your eyes.
http://pluralsight.com/blogs/keith/archive/2005/03/31/7149.aspx

Summary
  • Don't ever use throw exception;

  • Catch Exceptions when you really want to catch them.

  • Never leave your try{} block without catch{} block.


Sunday, April 10, 2005

Access is Denied; An error occurred during the processing of a configuration file required to service this request.

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

<add assembly=<System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a>/>
<add assembly=<System.EnterpriseServices, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a>/>
<add assembly=<*>/>
</assemblies>

Have you ever seen this kind of error while running your web application. I am one of the victim of this kind of error and bet it is not at all related to your code. Not even to any of assemblies you are using. Root Cause for this error lies somewhere else, where you wouldn't suspect at all. Root Cause of this problem is Indexing Service. Microsoft describes this behaviour in following manner...
If you run Index Server (Cisvc.exe), then Index Server may rescan the Temporary ASP.NET Files directory while it requests a Microsoft ASP.NET page. Cisvc.exe then holds a lock on the Temporary ASP.NET Files directory for one to five minutes. The length of time of the lock depends on the size of the directory that causes the Aspnet_wp.exeprocess (or W3wp.exe process for applications that run on Microsoft Internet Information Services [IIS] 6.0) to not load the particular DLL.

Solution to this problem is to disable indexing service on your computer. To disable this service follow below steps:

1. Click Start -> Run and then type Services.msc.
2. Locate Indexing Service from the list of services, and then click Indexing Service Properties from the subform.
3. On the General tab of the Indexing Service Properties dialog box, in the Startup type drop-down item list, click Disabled.
4. Click OK.

For more elaborate information on this issue, please check with following article on Microsoft Support
http://support.microsoft.com/default.aspx?scid=kb;en-us;329065

What Does it Take to be a Great .Net Programmer

Have you ever been in search of some good .Net questions? I am confident, you would have definitely got them somewhere on the net. But here I have got a link for you, that presents some trivial questions and some nuggets about .net programming questions. Go through the following link and you will find what all were you missing...

http://www.hanselman.com/blog/WhatAGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx

On the same page you will get lots of other links for .Net questions. Enjoy Reading...


Memory Leak in Configuration Application Block

The Enterprise Library team recently became aware of a memory leak issue in the Configuration Application Block, which is used by all other blocks in Enterprise Library. Patch 1475, available in the Releases section of the Enterprise Library community site, contains a fix to the issue. Because the issue has the potential to impact many applications that use Enterprise Library, Microsoft strongly advises all users of Enterprise Library (January 2005) to install this patch and recompile all applications that use any of the application blocks.
See the gotdotnet workspace.
http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=295a464a-6072-4e25-94e2-91be63527327

In case you are using EntLib in your application, I would suggest you to go and get this patch. This is particularly very important as Configuration Block can be treated as Mother of all other blocks. Every other block depends upon Configuration block to have access to configuration files.

Monday, March 28, 2005

Wake Up to VS.Net 2005

In their own words, We have just released a glorious beast onto the world - Beta 1 of Visual Studio 2005.Even VS 2005 is in its infancy, but it has got some very useful capabilities this time those may be useful to increase individual productivity by many folds. There are some new features in VS IDE. The most prominent one is the use of partial classes. Other features I will discuss as we go ahead.I am going to use Express Editions of different products to show the new changes.

Before diving to any thing, I bring up one important point to you. After installing .Net Framework 2.0 Beta your existing applications may break, particularly Web Applications. Why because, when .Net Framework 2.0 is installed, it sets active ASP.Net version to 2.0. To fix that go to Default Web Site Propertiesdialog box and set the ASP.Net version back to 1.1 or 1.0 as opposed to 2.0.

Default Web Site Properties

Now while I am dealing with ASP.Net things, I would like to mention one another small change. Now you can change your Machine configuration and Web configuration files directly from Default Web Site property dialog box or from your web sites property dialog box.

ASP.Net Configuration Settings

Now we will look into some other new improved areas in VS 2005. Before going ahead you would like to visit the following link to see what is no more backward compatible:
http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx

The prominent change I found in VS 2005 is support for Partial Classes. Now you can split your classes into multiple files. In previous versionswe were forced to implement a class into single file, irrespective of how large it is. In that case it was developers responsibility to write code in a sensible manner. Now with the help of partial classes you can write one particular section of code into one file and other one to other file. It is compilers job to merge all those implementation split into several files. We as developers have to implement partial class with the same name in all files then only compiler will be able to pick up correct definitions to merge into one class definition.Take a look into following example:
partial class Demonstration //Demonstration.cs
{        
public Demonstration ()
{
InitializeComponent();
}
}


partial class Demonstration //Implementation.cs     
{        
private voidInitializeComponent()        
{            

//Implementation Goes Here        
}    
}

Code of both the classes will be merged while compiling. In case of C# project, your code will be in FormName.cs file and control related information would be in FormName.Design.cs. The same is in case of VB 2005.

I found Partial class is the only common feature in VS 2005 through out the languages. All other features are specific to languages. Like in C# there is a new IDE feature called Refactoring. Basically refactoring means enhancing the existing design of your code. Refactoring is the art to make your code more readable, performance oriented and adhering to best OO practices. There are seven refactoring features as given below:

Extract Method - Allow to create a new method based on selected code.
Encapsulate Field - This turns a public field to a private field encapsulated by .Net property.
Extract Interface - Defines a new interface type.
Reorder Parameters - Provides a way to reorder member arguments.
Remove Parameters - Removes a given argument
Rename - Renames the provided code token.
Promote Local Variable to Parameter - Moves a local variable to the parameter set of the defining method

I will demonstrate, how to Rename a method. Select the method you want to rename and select Rename from either Refactor menu or from context menu.

Refactoring

VS 2005 will ask you for a new name for particular code token. Instead of blindly renaming, VS 2005 will show you the predicted changesin following manner:

Preview Changes

To read more about Refactoring go through following link:
http://msdn.microsoft.com/vcsharp/default.aspx?pull=/library/en-us/dnvs05/html/VS05_refac.asp

There are whole lot of changes in C# at language leve. Some major changes done to this finest language are Generics, Iterators and Anonymous methods. However these things are now supported at CLR level, that means all langauge will enjoy these new features. I think these topics are vast enough in themselve and need separate treatement. I will not deal with these things right now.

However I will show you one amazing enhancement in VB 2005. VB developers will just love this fetaure. This is called My. This fetaure is implemented under My namespace. My provides you full control over your computer resources, user identities and not to say on your application. Suppose you want whether you are connected to network or your mouse is working or not, you can get all these information using My.

My

You can use Exists* property of Mouse to get the status.To find out network connectivity you can use IsAvilable* property of Network. You can further explore the power of My.

Before wrapping this off, I will tell you little about SQL Server 2005 Express. Right now there is no tool is out for this, one like Enerprise Manager to SQL Server 2000. I heard that you can connect to SQL Server 2005 Express using Quesry Analayzer of SQL Server 2000. If you really want to mangle with database using visual tool, then try to connect to database from VC# express or VB Express.

SQL Server in Action

Make sure before trying connecting to SQL Express, you start your SQL Express instance from your Computer Management Console. Run COMPMGMT.MSC and follow the nodes Service and Applications -> SQL Computer Management - > Services -> SQL Server. Then start your particular SQL Server instance. You will able to accomplish almost everything expected from SQL Serever.

Here I covered some new features those will come with VS 2005. I have not coverd any thing at the CLR level or language level. It sure that some of the things covered here may change, when final version of .Net Framework will ship. The fetaures covered here were to make you aware about forthcoming spices with .Net and to put you onto to gear with .Net Framework 2.0.

Note: Exists property of Mouse will not be available in next release of .Net 2.0 due to a bug reported by me. IsAvailable property of Network is also being diagnosed and I am doubtful about it existance in the next release of .Net.

Developing Windows Applications - III

Its very rare that one application doesnt take any input from user. Almost all application depends upon users input in some sort. In most application user enters information through user interface. Data validation ensures that all data entered by user falls under the acceptable reason. For example you asked user to give the time she worked. Here application has to validate that she should not give more than 24 hours. Even 24 hour is also non human but acceptable. Purpose of validating user data is to develop robust application and not to have any unexpected behavior at application or database level.

We can categorize validation in two categories.
1. Form-level validation
2. Field-level validation
Form level validation can be termed as where you require values in some fields must be provided. In such scenarioyou at least need some sort of values. From level validation is usually performed when user is about to submit her inputs. In case of field level validation you check for value whether it is under acceptable range or not.

Field-Level Validations
TextBox is much used control that is used to take user inputs. So the way it provides some properties to control user input in specific manner. Some of these properties include:

· MaxLength
· ReadOnly
· PasswordChar

MaxLength
This property lets you set the maximum number of character a textbox can take.

ReadOnly
If set this property makes a textbox to behave in non editable mode. A user would not be able to make any changes to content of textbox.

PasswordChar
Though not restricting user to some particular value, but useful because passwords are sensitive data and should be displayed in non readable mode. You can give any character as PasswordChar and when user types, her password will be non readable to others.

Using Events to perform Field-Level validations

KeyPress
This is an important event to track while performing field-level validation. This is event is fired when user presses a key that has corresponding ASCII value. This excludes special keys like CTRL, SHIFT, ALT, DEL, arrow keys etc.Rest all keys we can track in this event. KeyPressEventArgs is the type of event that is passed to the event handler of KeyPress. KeyPressEventArgs provides us KeyChar and Handled property. KeyChar contains the key that was pressed. If we set Handled property as true then that key will be treated as user has not pressed that key. Char class provides us methods perform some basic validation for each key that is pressed. These methods include:
· Char.IsNumber
· Char.IsDigit
· Char.IsPunctuation
· Char.IsLetter
We can perform validation as shown below:
private void textName_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{

if (char.IsNumber(e.KeyChar) || char.IsPunctuation(e.KeyChar))
{
//Dont pass it to textbox. Filter it here.
e.Handled = true;
}
}


The Validating and Validated Events
Easiest way to validate user data is to validate it in Validating event. Validating event occurs before control loses focus. This event is occurred when CausesValidation property of control that is about to receive the focus is set to true. To use Validating property CausesValidation of control to be validated should also be true. By default all controls have CausesValidation set to true while they are created in design mode.Validating event takes one parameter of type CancelEventArgs. It does have Cancel property. Set it to true, if you want to push the focus back to control for which validation is failed.
Validated event is fired when a control is successfully validated. Following is the way you can implement validating event:

private void textName_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
if (textName.Text.Equals(string.Empty))
{
e.Cancel =
true;
}
}


The code shown above will force user to enter at least one character in name field. Without entering some value user cant leave this textbox. Even user cant close current screen. Did you recall something at this point? Yes, we should not force user to behave in some particular manner. They would not like it. I have described Validating event for sake of completeness of this discussion, however in my humble opinion you should avoid Validating event as it forces user to enter data in a very rude manner.

Form-Level Validation
Form level validation is a way to implement validation for all input controls at once. To perform form level validation we can implement centralized procedure that will be consulted before user us about to go to next level. We can implement form level validation is following manner:

private bool ValidateData()
{
f
oreach (Control control in this.Controls)
{
if (control.Text.Equals(string.Empty) && control is System.Windows.Forms.TextBox)
{
MessageBox.Show("You can't leave " + control.AccessibleName + " empty",
"Validation Test");
if (control.CanFocus)
{
control.Focus();
}
return false;
}
}
return true;
}


To ensure, this code flags error message in correct sequence, you have to make sure that you added the controls to Forms.Control collection in a desired sequence. Otherwise it willflag the message for bottom most control in form before other controls.

The ErrorProvider Component

The ErrorProvidercomponent provides an easy way to communicate validation errors to your users. The ErrorProviderallows you to set an error message for each control on your form whenever the input is invalid. An error message produces an error icon next to the control, and error message text is shown as a Tool Tip whenthe mouse hovers over the affected control. The ErrorProvider component is found in the Windows Forms tab of the Toolbox.

Using ErrorProvider
Following are the steps to accommodate ErrorProvider:
1. Drag and drop ErrorProvider component in your form.
2. Call its SetError method, when validation is failed.

SetError method takes two parameters. First one is the control for which validation is failed. Using this value ErrorProvider will blink error icon next to the control. Second parameter is string value that will be shown when user hovers her mouse over blinking error icon. Following is the demonstration to accommodate ErrorProvider in code:

private void textName_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (char.IsNumber(e.KeyChar) || char.IsPunctuation(e.KeyChar))
{
e.Handled =
true;
errorProvider.SetError(textName,
"Name can not have numbers or punctuation marks");
}
else
{
errorProvider.SetError(textName,
string.Empty);
}
}


When you feel that validation is successful, call SetError method with empty string. This will clear the blinking error icon. You can further customize ErrorProvider by setting BlinkRate and BlinkStyle properties of ErrorProvider control. These properties are self explanatory. Arent they? Using BlinkRate we can control the blink rate of ErrorProviders error icon.BlinkStyle will let you decide when to blink, when not to or not at all.

We have covered many aspects of windows applications however we feel that it is not even the tip of iceberg. But we are at the point from where you can take off. Better luck and all the best with .Net windows programming.

Developing Windows Applications - II

Did you go through previous article in a careful manner? Didn't you miss anything there? Yes! We didn't talk about toolbar and status bar in our previous article. Here we will have a look into toolbar and status bar plus validation controls and other tips about windows forms.

Toolbar
Toolbar is another important aspect in Windows application. It's a rare instance when an application doesn't have toolbar with it. ToolBar contains the collection of ToolBarButton. It's the collection of ToolBarButton that makes visual representation of toolbar. To add a toolbar to your application go to View ' Toolbox. Select ToolBar control from toolbox and drop it on the form. This action makes a blank strip at top edge of your form. That is the toolbar. Now you got a question. How to add buttons to this blank strip? Simple; Right click on this strip or now onwards a toolbar. Select Buttons property and you will get another window something like given below:

ToolBar-I

Now you are free to add as many toolbar buttons as you want. Give proper values to Name, Tag, Text and ToolTipText property. Notice Style and ImageIndex properties. These are two crucial properties for toolbar. Style property is used to set the button of proper type. Whether you want toggle button in toolbar or should it be a separator. ImageIndex will be useful to assign a proper image to button of toolbar.

To have images in our toolbar we have to use another control, ImageList. ImageList provides methods to manage a collection of Images objects. ImageList is typically used by other controls, such as the ListView, TreeView, or ToolBar. You can add bitmaps, icons files to the ImageList, and the other controls are able to use the images as they require. To add ImageList to your form drag it from toolbox to your form. As it is not a visual component, it will sit in component tray. To assign images to ImageList, select its Images property. This property will let you visually add images to ImageList. Once you are done, come back to property window for toolbar. Pull down the drop down menu of ImageList property and select the appropriate value. You should have it as the name you gave to your ImageList component.

Now we come to our original topic. We were supposed to add images to our toolbar buttons. Here are the steps to do that:
1. We should have ImageList in our Form. We do have now!
2. Add images into this ImageList component. We have done that!
3. Assign ImageList property of toolbar as the ImageList component we have added. Done!
4. Click on Buttons property of toolbar and now you will have appropriate values in ImageIndex property as shown below:

ToolBar-II

Once your toolbar is visually ready, double click on this. You will get an empty event handler, where you will have to identify that which was the clicked button. That we have to do based on its index in following manner:

private voidtoolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{

switch (toolBar.Buttons.IndexOf(e.Button))
{
case 0:
//Your code goes here
break;
}
}


Status Bar
Status bar is used to inform user about certain kind of activities or some static data such as current date etc. To add status bar to your form, drag and drop StatusBar control from toolbox to your form. It will be bottom docked to your form by default. StatusBar has a property panels that is collection of StatusBarPanel.This makes visual representation of status bar and we have to assign text values to these panels. To get your status bar up, follow given below steps:
1. Drag a status bar to your form.
2. Go to property window and selects Panels property.
3. Add panels to your status bar in a similar manner as you added toolbar buttons to toolbar.
4. As a final step, give some proper value to each panel when your form loads.

One little issue is here. To show your panels make sure you have ShowPanels property is set to true. By default this is set to false, I dont know why. You can set values of panels as given below:
statusBar.Panels[0].Text = DateTime.Now.ToShortDateString();
statusBar.Panels[1].Icon = SystemIcons.Information;


At this point we have decorated our application to look good enough. Following is the descriptions about some Form properties through which you can make you application behave better too.

AcceptButton
This is the property, when you want to accomplish some task when user hits Enter key. You will have all buttons those are part of your form listed in this property. Select one button from the list, you would like to act when user hits Enter key.

CancelButton
Button selected under this property works when users hits Esc key.

KeyPreview
You can track the keyboard on KeyDown, KeyPress and KeyUp events. But these events will be fired only when your form or particular control connected to these events is having focus.If any other control on your form is having focus and you are tracking a key on form level, you will never be notified. Should you ever get into situation like this? You set KeyPreview property as true and now you can track entire keyboard at form level. Form will be the first control to receive all the messages coming from keyboard. Once Form does the processing, then only message will be passed to other controls.

MinimumSize
Do you ever get into situation where you have to retain a minimum size of form? User should not be able to resize the form once she reaches the given points? In such situation, use this property. Assign it the minimum size of form that you would like to retain.

Opacity
Have you ever dreamt to make your form semi-transparent? Then your dream has come true. By default this property is set at 100%. That means your form will be opaque. Just play with this property to adjust opacity of your form.One caution: In property window this is treated in percentage. If you happen to set it through code part, you have to set it in following manner:
//To Set opacity at 50%
this.Opacity = 0.5;

While covering these aspects of windows application, I happen not to cover some simple controls like TextBox, Label etc. I leave these controls and other windows controls on you to explore further. You will find your journey really exciting to explore these controls. In next article we will see how can we validate user input?

Developing Windows Applications - I

After getting through basic guidelines to design Windows Application, we should now get our hands to basic elements of Windows Application. If we are talking about the windows elements, then in this case first element is Windows Form itself. Its like a drawing board, where all the drawing will be done. Windows form is defined inside System.Windows.Forms namespace. Control is its grand parent class under the same namespace. Control class has to be inherited by every component that has to have visual representation. Now its time to dive deeper into windows applications.

Visual Inheritance
Inheritance is not limitedto only classes those are having business logic. As Form itself is a class with visual appearance, rules of inheritance applies to Form too.This feature is handy when you want to retain some kind of image or theme through out all screens in your applications. You can accomplish this task in two ways. One way is through code:

public classParentForm : System.Windows.Forms
{
// Necessary elements to build a form
}

public class ChildForm : ParentForm
{
//Visual elements
}

Do you notice one thing in this code? ChildForm is not inherited from System.Windows.Forms. It is inheriting from ParentForm. This way our ChildForm will get all the visual elements and other characteristics those are there in ParentForm.
Other way to accomplish this task is inheritance picker in Visual Studio .Net. Following are the steps to use inheritance picker:
1. Right click on your project, select Add Add Inherited Form.
2. Select Local Project Items UI in opened dialog box.
3. Choose Inherited Forms and give a name for your child form. Click OK
4. Inheritance picker will come having all forms available for visual inheritance in your project.
Inheritance picker will resemble the screen given below:

InheritancePicker

Menus
Another basic aspect of any application is its Menus. In .Net we have facility to design our menu items through a menu designer. Main menu item is designed using a component MainMenu. It manages the collection of MenuItem controls, which form the visual element of menu structure. With the MainMenu component you can develop menus in an intuitive and rapid manner.

To add MainMenu in your form just drop it to your form from ToolBox. It will go and sit in component tray in Visual Studio.Net. It wont be a visible element in your form design. Select it and you will get a Type Here text in Menu bar of you form. Click there and you have your first MenuItem.

Now some tips to make your menus to resemble professional menus.
1. Logical Grouping: To group or separate your menu items on logical basic, create a menu item and give - as its Text property. This will make a horizontal seperation between menu items.
2. Access Keys: Most of the users like to have a way to menus through keyboard. Access key is a combination of ALT + character that can fire the command of a menu item. For example in above figure F in File is an access key. To achieve this precede the text of menu item with &. For example I gave &File as the text of menu item and now ALT + F will have effect same as of clicking the File using mouse.
3. Shortcut Keys: Shortcut keys enable instant access to menu commands, thus providing a keyboard shortcut for frequently used menu commands. Shortcut key assignments can be single keys, such as Delete, F1, or Insert, or they can be key combinations, such as Ctrl+A, Ctrl+F1, or Ctrl+Shift+X. When a shortcut key is designated for a menu item, it is shown to the right of the menu item. To show shortcut key, set ShowShortcutproperty of menu item to true. To assign a shortcut key to any menu item set the particular menu items Shortcut property from the drop down menu.

To make your menu item to work, simply double click on it. Visual Studio .Net will code an event handler for you as given below:

private void menuFileNew_Click(object sender, System.EventArgs e)
{

//Your code goes here
}

If you expand Windows Form Designer generated code region you will come to know that it has also created the association between click event and its handler as shown below:


this.menuFileNew.Click += new System.EventHandler(this.menuFileNew_Click);

Isnt it so simple? You just got to code for particular event. No other nonsense code :)

MenuExaple

Dock Property
Every windows control has one property called Dock. Its an inherited property from Control. Docking refers to attaching your particular control to one of the edge of parent control. Parent control is usually Form, but it can be anything from Tab control to panel.An example of a docked control can be a menu bar docked to top of form or a status bar docked to bottom of form.

To set the docking property of control,simply select that control and select Dock property in Properties window. You will get visual interface similar as show aside to set the docking. If you click the top bar, docking will be set as Top. To remove docking for your control, choose None. Selecting middle bar causes your control to fill entire available area of its parent as it is a Fill docking.

Docking

Anchor Property
If you see the above figure, you will see Anchor property before Dock property. Anchor is also an inherited property from Control. This property lets you to set a constant distance for your control from one or more edges of form. Let me explain this by an example. Lets assume that you have designed one wonderful screen as given aside. But user resizes this screen and then your screen looks like as given below.

Anchoring-I
Anchoring-II

Are you ready to deal with such kind of situations? Let your interface deal with such scenario in a graceful manner. Anchor is property that saves you in such kind of scenarios. Anchor property allows you to manage how controls respond to resizing the form. You can allow controls to remain fixed in the form by anchoring them to the top, left, right and bottom edges, cause them to stretch when resized, or allow them to float freely by releasing the anchor. To set the Anchor property of, select your control and then select Anchor property in Properties window. You will get another visual interface. Select the Anchor type you would like to give to your control. To deal with situation described in our example, anchor controls to bottom, right edges of screen. This will let your controls to keep a constant distance from bottom of form as well as from right of from. You can very well use Anchor and Dock properties while designing UI. But one caution, when Dock property is set, it makes Anchor to be as Top, Left.

Anchoring-III

In this article I brought theoretical concepts of inheritance to real world use. We got to know how to beautify our applications with menus. We saw some very handy properties like Dock and Anchor which can be helpful to deal with users actions against our screens. Hope you enjoyed this small tour to Windows applications.

Wednesday, March 23, 2005

Designing Windows Applications

In coming lines I willtry to figure out the guidelines of an intuitive User Interface. Have you tried to figure out the mind set of your user? Here are three major points why user may treat your software as hard to use:

1. User is not really concern about applications conceptual model: You might have followed a nice concept through out your application, but does it help your end user to accomplish her task. Its not like that your users are dumb. The fact is that they are inundated with daily routine and information. They dont have time and energy to understand the conceptual model behind your great software.
2. Most users dont master common procedures:While developing a new feature in your software you thought, after a while user will get used to that feature. But according to one study, users do not really notice the procedure when they are accomplishing one task. They may stumble while doing the same task in some future point.
3. Users face the problem to find the purpose of screen: You developed software for a user who has mastered the common procedure and conceptual model, but for majority of users each screen would be unwanted puzzle.

The best solution to deal with these problems is to develop a UI that is easy to learn and self explanatory. Users must be able to find out the feature every time they need it and they must be able to use that feature every time they want to.

Deductive User Interface
Now a days most software forces their users to infer the purpose of software. For example look at the screen below:

UnUsable

Experienced computer user like you and me will come out saying;oh this is a simple screen to add some items to list box provided there. And other buttons are there to further give some sort of functionality to this screen. But did you notice one thing in this screen.It is nowhere written the purpose and behavior of this dialog box.

Now just slide yourself into end users shoes. You will find one obvious question, What should I do with this dialog box? One another big point is when this dialog box pops up to user, she has to stop her current work and find out what this screen will do for her.

A normal end user may try to type in directly to list box as it appears like a normal edit box. End users will be detracted from their usual task when they have to figure out the behavior of screen. You might wonder why a user cant figure such a simple task. But according to studies most users are even confused about the capabilities of their software. They have difficulty understanding what the product can do for them, whereto go to perform an operation, and how to perform that operation once they have found it.
A Solution to this
The most basic solution to come out of this issue is Inductive User Interface (IUI). IUI's goal is to reduce the amount of extraneous thinking users must do to successfully move between parts of a product and use its features. The word inductive comes from the verb induce, which means to lead or move by influence or persuasion.

You can define IUI as an extension web-style interface, where each pagehas to be simple and task based because each piece of information has to be sent back to server and it should be correlated to primary task of that page. A well designed inductive interface help users to find answer to following two questions:
· What am I supposed to do now?
· Where do I go next to accomplish rest of the task?

A screen with a single, clearly stated, explicit purpose is easier to understand than a page without such a purpose. This fundamental premise can be expanded into a series of four steps for designing software that uses inductive interface:
1. Focus each screen on a single task.
2. State the task.
3. Make the screen's contents suit the task.
4. Offer links to secondary tasks.

Going forward we will try to change our dialog box to suit above four point. How? We will see...
Step One: Focus each screen on a single task. Each of your screens should be based on one primary task.Now how will you come to know about the primary purpose? You may express bunch of tasks as one task, if that are abstract enough to group in to one. So here is the rule of thumb; a screen is focused on one purpose if the designer can express that purpose with a concise, meaningful, and natural-sounding screen title. In our example we can define the primary task as to Change Item Details.

Step Two: State the Task. Each of your screens should have concise and explicit statement of its primary task. As we have given, Change Item Details.
Now just have a look on modified screen:

Usable

Step Three: Make the screens content suit the task. Did you interpret screen content as the text that you will put on the screen? No. Its all about the controls those are going to have on your screens. Controls on screen make the content of your screen. User should be able to easily figure out how to achieve their task. For example if you see, now our dialog box is having Remove and Details...button enabled. This facilitates user to click on these buttons rather then puzzling, when the become enable. By doing this you will have much more impressive effect on user when user clicks one of these buttonswithout selecting any item in listbox and alert her that she first has to choose one item from list. Another thing is to provide a clear exit to user, when she is done with her job. Dont try to retain her on screen saying, You HAVE to add at least one item. If she wants to go out of screen, let her do that. Being an intelligent software developer, take care of such scenarios in your code.

Step Four: Offer links to secondary tasks. Do you see our Details... button? In our modified dialog box it is enabled and provides the link to one secondary task. Clicking this user can go to next screen. Then it depends upon you, how much functionality you are giving her in next screen. However be sure give clear exit from next screen too and that screen also should follow usability guidelines as much possible.
We are through with basic guidelines to design Windows Application. Beside this you should also keep consistency through out your screens as far as controls font, size, placement and their grouping goes. Use color contrast to enhance users experience not to damage his confidence in your software. For Example Green text on Red background may look great to you, but just think about a user who is color blind to Green color. Hope all this discussion benefits you to develop your next great application.

Friday, March 11, 2005

Oracle SPs in C#/VB.Net

Do you know that Oracle's ODP.Net team is planning to give support for C#/VB.Net SPs too. That means soon Oracle will empower its RDBMS product to have SPs written in C#/VB.Net. Right now ODP.Net plug in allows you to do every thing that you can do with Server Explorer against SQL Server. You can create a new table, edit existing table, create a new SP, run a SP and get the result in a nice datagrid.
For a long time Oracle dedicated itself to Java language. They never really liked the concept of .Net and C#. But now what forced them to provide support for C# SPs is market share. Every one wants to extend their market share and to retain it. In many cases each project going to C# means backend might be SQL Server rather than Oracle. Now Oracle is forced to provide support for C#/VB.Net projects too. Good Step!

EntLib Binaries are Not Signed

If you have downloaded EntLib and started playing with it, you would have noticed that it comes with all of its source code and none of the assemblies are signed with a key. Why it is so? It is because of support issues. If Microsoft had come up with the signed files and binary only version then they would have to support it too. You should have notice one checkbox while installing EntLib, "Compile Enterprise Library". That is the point when EntLib's source code is compiled into binaries for you.
Microsoft Pattern and Practices group did not want to ship a product kind of thing. Microsoft EntLib is the guidance for rest of the world. It just guides you in your way to design and develop your enterprise application. So if you come across any issue while using EntLib, you can't ask for support from Microsoft. But you can very well pop the question in EntLib community. That's why I suggest you to join EntLib community. In case you are not happy with this situation, then just wait for a while. We are coming with ACA.Net V4.0. That will have signed version of EntLib binaries and you will get a full support from Avanade. Nobody can support EntLib better then us; after all its we who built it!
ACA.Net 4.0 gives you some very exciting fetaures on top of EntLib. ACA.NET 4.0 provides a service oriented application platform. Service oriented techniques typically produce coarsely grained, loosely coupled applications that can communicate with each other to compose large systems that deliver complex functionality. Using the principles of SOA, architects can build powerful distributed applications that are more flexible and easier to maintain over time than solutions built around distributed object technologies. Beside this ACA.Net 4.0 facilitates you to leverage your application with Aspect Oriented Architecture (AOA). The Aspect Architecture provides a flexible way to declaratively add behavior to your applications. It serves as the glue between the Service Architecture and the "sideline" Frameworks. If you want AOA and SOA features in your application, give a try to ACA.Net 4.0. Its free for use, however you will have to sign a license for our comfort.

Enterprise Library is Out

Finally Microsoft Enterprise Library is out. Enterprise library is collection of reusable software assets to address common enterprise development challenges, consistently, correctly and quickly. If you are not new to MS platform, you might be familiar with Applications Blocks, i.e. Data Access Block and Exception Management Block. There were several other application blocks as well.
In a much simple way you can define Enterprise Library as the collection of all old application blocks. But in a techie way you can not do so. Its first version is produced in partnership with Avanade, leveraging experience from customer engagements and incorporating aspects of the ACA.NET application framework. In first version of Enterprise Library you get following blocks:
  1. Data Access Application Block

  2. Exception Handling Application Block

  3. Configuration Application Block

  4. Caching Application Block

  5. Logging & Instrumentation Application Block

  6. Security Application Block

  7. Cryptography Application Block

Take the example of DAB. In EntLib aim was to keep to simplicitiy of DAB, and it is maintained. However it is refined further. Support for multiple database through database factory (SQL Server, Oracle, DB2 etc.) is added to EntLib that was not available in the age of DAB.
Exception Management Block is now known as Exception Handling Block. Now you can configure your exception using XML file. You can define different kind of policies (Global Policy, Wrap Policy, Replace Policy) and that too with full configurabililty. Thanks to EntLib Configuartion Console. EntLib Configuartion Console is code based on Avanade's ACA.Net Configuration Manager(See the snap shots). Actions provided through EntLib are extensible; we provide Logging, Wrapping one exception with another, and Replacing one exception with an other.

EntLib.JPG

Avanade Configuration Manager.JPG

Finally on behalf of Microsoft and Avanade, I invite you to join EntLib community site at:
http://www.gotdotnet.com/workspaces/workspace.aspx?id=295a464a-6072-4e25-94e2-91be63527327