Monday, December 29, 2008

CSS HACKS - how to add styles based on the browser version using css

Dealing with different browsers is always an issue to most of the web developers. sometimes there is no reasonable way to accomplish a desired layout in all major browsers without the use of some special exception rules for certain layout engines.

hacks necessarily lead to potentiial complications and should be avoided whenever possible, but when the circumstances require hacks to be used.it's best to know what your options are and weigh the consequences appropriately. The purpose of this article is to describe some of the CSS hacks, also called CSS filters, with the least significant potential consequences.

Conditional comments
Due to its relatively poor level of standards support, Internet Explorer tends to be the subject of most CSS hacks. Luckily, as of version 5, it deliberately supports a rather safe-to-use hack called "conditional comments". Conditional comments are specially constructed HTML comments that Internet Explorer on Windows may treat differently from other browsers, optionally based on IE's version number. They can cause Internet Explorer to ignore the markup between comments or to include part of a comment as if it was regular markup. Conditional comments apply specifically to browsers using Internet Explorer's Trident layout engine, meaning IE-based browsers like Maxthon and Avant handle them like Internet Explorer does while browsers using other layout engines see them simply as regular comments. Internet Explorer on the Mac uses a different layout engine and doesn't support conditional comments.

The most beneficial aspect of conditional comments is that you are not relying on browser bugs when using them. When you use CSS hacks that rely on browser bugs, you run into the possibility of those bugs being fixed at an unwanted time or other browsers showing the same bugs. Conditional comments only work in browsers that specifically support them and claim to be based on Internet Explorer, which in this case all known browsers are honest about.

There are two forms of conditional comments: positive and negative. A positive conditional comment will expose the included markup only to web browsers that match the condition (meaning only the selected versions of Internet Explorer). A negative conditional comment will expose the markup only to web browsers that don't match the condition (meaning all non-IE web browsers and any versions of IE that the condition didn't match). Note that, since versions of IE older than IE 5 don't support conditional comments, you may get unexpected results in those browsers.

Syntax
The syntax for conditional comments is as follows:

Positive
<!--[if condition]> HTML <![endif]-->
Negative
<!--[if !condition]><![IGNORE[--><![IGNORE[]]> HTML <!--<![endif]-->
condition is one of the following:

IE
Any version of IE
lt IE version
Versions less than version
lte IE version
Versions less than or equal to version
IE version
Only version version
gte IE version
Versions greater than or equal to version
gt IE version
Versions greater than version
version is the version of Internet Explorer, typically 5, 5.5, 6, or 7

HTML is the HTML to be included if the condition does or doesn't match, depending on the type of conditional comment. When included, the HTML is placed right where the conditional comment is in the source.

For negative conditions, <![IGNORE[--><![IGNORE[]]> can be replaced with --> if the condition is simply IE. The longer version is only needed when Internet Explorer might parse the contents.

The <![IGNORE[ ... ]]> directive is not available in XML, so it is illegal to use it in XHTML. A solution would be to split it up into two special conditional comments: <!--[if !condition]> XHTML <![endif]--> <!--[if !IE]>--> XHTML <!--<![endif]--> where XHTML is the same both places. Note that Internet Explorer 7 and below don't yet recognize XHTML as a form of XML, so this is merely forward-looking.

Fixing stand-alone versions of Internet Explorer
Internet Explorer was not designed to allow multiple versions to be installed at once, and Microsoft doesn't officially support any such configurations. If you use one of the hacked third party packages that attempts to do this, you will experience problems with version-specific conditional comments, among other things. This is because the different stand-alone copies still rely on a common centralized registry for certain data, including version information.

Although there is no simple way to cut through all of the issues with stand-alone versions of Internet Explorer, it is possible to force them to look elsewhere for their version information, thus fixing this issue with conditional comments. The trick is to remove the normal centralized version indicator. To do this, first open up regedit.exe from the "Run..." dialog. Navigate to HKEY_LOCAL_MACHINE/Software/Microsoft/Internet Explorer/Version Vector/ (If HKEY_LOCAL_MACHINE doesn't exist, try HKLM instead). In the right pane, you should see a row with a Name value of IE. Rename this by clicking on it and changing it to zIE (or anything unique and different). Restart Internet Explorer to see the effects. Now when it looks for the IE key for its version information, the key will be missing and it will be forced to determine the correct version number from its own module.

Stand-alone versions of Internet Explorer have a number of other issues, and it therefore may be better to instead use a separate virtual machine for each version of Internet Explorer to ensure that what you see is what your users will see. I recommend VMware Server, which is completely free of charge and fairly easy to set up.

Conditional comments as a CSS hack
Conditional comments can be used as a CSS hack by including links to stylesheets based on the layout engine. Here is an example of how stylesheets can be separated in this way:
<!CDATA[
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<link href="all_browsers.css" rel="stylesheet" type="text/css">
<!--[if IE]> <link href="ie_only.css" rel="stylesheet" type="text/css"> <![endif]-->
<!--[if lt IE 7]> <link href="ie_6_and_below.css" rel="stylesheet" type="text/css"> <![endif]-->
<!--[if !lt IE 7]><![IGNORE[--><![IGNORE[]]> <link href="recent.css" rel="stylesheet" type="text/css"> <!--<![endif]-->
<!--[if !IE]>--> <link href="not_ie.css" rel="stylesheet" type="text/css"> <!--<![endif]-->

In the above example, all_browsers.css applies to all browsers, ie_only.css only applies to all versions of Internet Explorer, ie_6_and_below.css applies to all versions of Internet Explorer below IE 7, recent.css applies to all browsers except IE versions below 7, and not_ie.css applies to all non-IE browsers.

See also: Conditional Comments of IE

some more info
The syntax I use is:

<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>

CSS hack?
Are conditional comments CSS hacks? Strictly speaking, yes, since they can serve to give special style instructions to some browsers. However, they do not rely on one browser bug to solve another one, as all true CSS hacks do. Besides, they can be used for more than CSS hacks only (though that rarely happens).

Since conditional comments are not based on a browser hack but on a deliberate feature I believe they are safe to use. Sure, other browsers could implement conditional comments, too (though as yet none have done so), but they're unlikely to react to the specific query <!--[if IE]>.

I use conditional comments, though sparingly. First I see if I can find a real CSS solution to an Explorer Windows problem. If I can't, though, I don't hesitate to use them.

Comment tag
A reader told me Explorer (Windows and Mac) supports the (non-standard) <comment> tag.

<p>This is <comment>not</comment> Internet Explorer.</p>
This is Internet Explorer.

This tag might come in handily if you want to use tags or styles for all non-Explorer browsers. Unfortunately these situations are rather scarce, especially since both Explorer Windows and Mac support this tag and you usually want to serve special content or style to only one of them.

ASP.NET HACKS
http://wiki.lessthandot.com/index.php/ASP.NET_Hacks

Monday, December 8, 2008

Online Test Url

Attend Online Tests in the following urls.

http://www.thinkinterview.com/Interview-Questions/q108_Which-of-the-following-ways-can-you-proactively-clean-up-a-database-connect.aspx
http://www.allinterview.com/showanswers/20860.html
http://www.dotnetspider.com/questions/ViewInterviewQuestion.aspx?InterviewQuestionId=3707

More links:
http://www.devbistro.com/tech-interview-questions/.NET.jsp

SslStream Class

SslStream Class

Provides a stream used for client-server communication that uses the Secure Socket Layer (SSL) security protocol to authenticate the server and optionally the client.


Namespace: System.Net.Security
Assembly: System (in System.dll)
Syntax
Visual Basic (Declaration)
Public Class SslStream _
Inherits AuthenticatedStream
Visual Basic (Usage)
Dim instance As SslStream
C#
public class SslStream : AuthenticatedStream
Visual C++
public ref class SslStream : public AuthenticatedStream
JScript
public class SslStream extends AuthenticatedStream

Remarks
SSL protocols help to provide confidentiality and integrity checking for messages transmitted using an SslStream. An SSL connection, such as that provided by SslStream, should be used when communicating sensitive information between a client and a server. Using an SslStream helps to prevent anyone from reading and tampering with information while it is in transit on the network.

An SslStream instance transmits data using a stream that you supply when creating the SslStream. When you supply this underlying stream, you have the option to specify whether closing the SslStream also closes the underlying stream. Typically, the SslStream class is used with the TcpClient and TcpListener classes. The GetStream method provides a NetworkStream suitable for use with the SslStream class.

After creating an SslStream, the server and optionally, the client must be authenticated. The server must provide an X509 certificate that establishes proof of its identity and can request that the client also do so. Authentication must be performed before transmitting information using an SslStream. Clients initiate authentication using the synchronous AuthenticateAsClient methods, which block until the authentication completes, or the asynchronous BeginAuthenticateAsClient methods, which do not block waiting for the authentication to complete. Servers initiate authentication using the synchronous AuthenticateAsServer or asynchronous BeginAuthenticateAsServer methods. Both client and server must initiate the authentication.

The authentication is handled by the Security Support Provider (SSPI) channel provider. The client is given an opportunity to control validation of the server's certificate by specifying a RemoteCertificateValidationCallback delegate when creating an SslStream. The server can also control validation by supplying a RemoteCertificateValidationCallback delegate. The method referenced by the delegate includes the remote party's certificate and any errors SSPI encountered while validating the certificate. Note that if the server specifies a delegate, the delegate's method is invoked regardless of whether the server requested client authentication. If the server did not request client authentication, the server's delegate method receives a null certificate and an empty array of certificate errors.

If the server requires client authentication, the client must specify one or more certificates for authentication. If the client has more than one certificate, the client can provide a LocalCertificateSelectionCallback delegate to select the correct certificate for the server. The client's certificates must be located in the current user's "My" certificate store. Client authentication via certificates is not supported for the Ssl2 (SSL version 2) protocol.

If the authentication fails, you receive a AuthenticationException, and the SslStream is no longer useable. You should close this object and remove all references to it so that it can be collected by the garbage collector.

When the authentication process, also known as the SSL handshake, succeeds, the identity of the server (and optionally, the client) is established and the SslStream can be used by the client and server to exchange messages. Before sending or receiving information, the client and server should check the security services and levels provided by the SslStream to determine whether the protocol, algorithms, and strengths selected meet their requirements for integrity and confidentiality. If the current settings are not sufficient, the stream should be closed. You can check the security services provided by the SslStream using the IsEncrypted and IsSigned properties. The following table shows the elements that report the cryptographic settings used for authentication, encryption and data signing.

Element
Members

The security protocol used to authenticate the server and, optionally, the client.
The SslProtocol property and the associated SslProtocols enumeration.

The key exchange algorithm.
The KeyExchangeAlgorithm property and the associated ExchangeAlgorithmType enumeration.

The message integrity algorithm.
The HashAlgorithm property and the associated HashAlgorithmType enumeration.

The message confidentiality algorithm.
The CipherAlgorithm property and the associated CipherAlgorithmType enumeration.

The strengths of the selected algorithms.
The KeyExchangeStrength, HashStrength, and CipherStrength properties.


After a successful authentication, you can send data using the synchronous Write or asynchronous BeginWrite methods. You can receive data using the synchronous Read or asynchronous BeginRead methods.

If you specified to the SslStream that the underlying stream should be left open, you are responsible for closing that stream when you are done using it.

Note:
If the application that creates the SSLStream object runs with the credentials of a Normal user, the application will not be able to access certificates installed in the local machine store unless permission has been explicitly given to the user to do so.


Examples
The following code example demonstrates creating an TcpListener that uses the SslStream class to communicate with clients.

C# Copy Code
using System;
using System.Collections;
using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.Security.Authentication;
using System.Text;
using System.Security.Cryptography.X509Certificates;
using System.IO;

namespace Examples.System.Net
{
public sealed class SslTcpServer
{
static X509Certificate serverCertificate = null;
// The certificate parameter specifies the name of the file
// containing the machine certificate.
public static void RunServer(string certificate)
{
serverCertificate = X509Certificate.CreateFromCertFile(certificate);
// Create a TCP/IP (IPv4) socket and listen for incoming connections.
TcpListener listener = new TcpListener(IPAddress.Any, 8080);
listener.Start();
while (true)
{
Console.WriteLine("Waiting for a client to connect...");
// Application blocks while waiting for an incoming connection.
// Type CNTL-C to terminate the server.
TcpClient client = listener.AcceptTcpClient();
ProcessClient(client);
}
}
static void ProcessClient (TcpClient client)
{
// A client has connected. Create the
// SslStream using the client's network stream.
SslStream sslStream = new SslStream(
client.GetStream(), false);
// Authenticate the server but don't require the client to authenticate.
try
{
sslStream.AuthenticateAsServer(serverCertificate,
false, SslProtocols.Tls, true);
// Display the properties and settings for the authenticated stream.
DisplaySecurityLevel(sslStream);
DisplaySecurityServices(sslStream);
DisplayCertificateInformation(sslStream);
DisplayStreamProperties(sslStream);

// Set timeouts for the read and write to 5 seconds.
sslStream.ReadTimeout = 5000;
sslStream.WriteTimeout = 5000;
// Read a message from the client.
Console.WriteLine("Waiting for client message...");
string messageData = ReadMessage(sslStream);
Console.WriteLine("Received: {0}", messageData);

// Write a message to the client.
byte[] message = Encoding.UTF8.GetBytes("Hello from the server.");
Console.WriteLine("Sending hello message.");
sslStream.Write(message);
}
catch (AuthenticationException e)
{
Console.WriteLine("Exception: {0}", e.Message);
if (e.InnerException != null)
{
Console.WriteLine("Inner exception: {0}", e.InnerException.Message);
}
Console.WriteLine ("Authentication failed - closing the connection.");
sslStream.Close();
client.Close();
return;
}
finally
{
// The client stream will be closed with the sslStream
// because we specified this behavior when creating
// the sslStream.
sslStream.Close();
client.Close();
}
}
static string ReadMessage(SslStream sslStream)
{
// Read the message sent by the client.
// The client signals the end of the message using the
// "" marker.
byte [] buffer = new byte[2048];
StringBuilder messageData = new StringBuilder();
int bytes = -1;
do
{
// Read the client's test message.
bytes = sslStream.Read(buffer, 0, buffer.Length);

// Use Decoder class to convert from bytes to UTF8
// in case a character spans two buffers.
Decoder decoder = Encoding.UTF8.GetDecoder();
char[] chars = new char[decoder.GetCharCount(buffer,0,bytes)];
decoder.GetChars(buffer, 0, bytes, chars,0);
messageData.Append (chars);
// Check for EOF or an empty message.
if (messageData.ToString().IndexOf("") != -1)
{
break;
}
} while (bytes !=0);

return messageData.ToString();
}
static void DisplaySecurityLevel(SslStream stream)
{
Console.WriteLine("Cipher: {0} strength {1}", stream.CipherAlgorithm, stream.CipherStrength);
Console.WriteLine("Hash: {0} strength {1}", stream.HashAlgorithm, stream.HashStrength);
Console.WriteLine("Key exchange: {0} strength {1}", stream.KeyExchangeAlgorithm, stream.KeyExchangeStrength);
Console.WriteLine("Protocol: {0}", stream.SslProtocol);
}
static void DisplaySecurityServices(SslStream stream)
{
Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer);
Console.WriteLine("IsSigned: {0}", stream.IsSigned);
Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted);
}
static void DisplayStreamProperties(SslStream stream)
{
Console.WriteLine("Can read: {0}, write {1}", stream.CanRead, stream.CanWrite);
Console.WriteLine("Can timeout: {0}", stream.CanTimeout);
}
static void DisplayCertificateInformation(SslStream stream)
{
Console.WriteLine("Certificate revocation list checked: {0}", stream.CheckCertRevocationStatus);

X509Certificate localCertificate = stream.LocalCertificate;
if (stream.LocalCertificate != null)
{
Console.WriteLine("Local cert was issued to {0} and is valid from {1} until {2}.",
localCertificate.Subject,
localCertificate.GetEffectiveDateString(),
localCertificate.GetExpirationDateString());
} else
{
Console.WriteLine("Local certificate is null.");
}
// Display the properties of the client's certificate.
X509Certificate remoteCertificate = stream.RemoteCertificate;
if (stream.RemoteCertificate != null)
{
Console.WriteLine("Remote cert was issued to {0} and is valid from {1} until {2}.",
remoteCertificate.Subject,
remoteCertificate.GetEffectiveDateString(),
remoteCertificate.GetExpirationDateString());
} else
{
Console.WriteLine("Remote certificate is null.");
}
}
private static void DisplayUsage()
{
Console.WriteLine("To start the server specify:");
Console.WriteLine("serverSync certificateFile.cer");
Environment.Exit(1);
}
public static int Main(string[] args)
{
string certificate = null;
if (args == null ||args.Length < 1 )
{
DisplayUsage();
}
certificate = args[0];
SslTcpServer.RunServer (certificate);
return 0;
}
}
}

Url Rewriting with ASP.NET

Url Rewriting with ASP.NET
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications. This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have the option to structure the URLs of your application however you want.
Why does URL mapping and rewriting matter?
The most common scenarios where developers want greater flexibility with URLs are:
1) Handling cases where you want to restructure the pages within your web application, and you want to ensure that people who have bookmarked old URLs don't break when you move pages around. Url-rewriting enables you to transparently forward requests to the new page location without breaking browsers.
2) Improving the search relevancy of pages on your site with search engines like Google, Yahoo and Live. Specifically, URL Rewriting can often make it easier to embed common keywords into the URLs of the pages on your sites, which can often increase the chance of someone clicking your link. Moving from using querystring arguments to instead use fully qualified URL's can also in some cases increase your priority in search engine results. Using techniques that force referring links to use the same case and URL entrypoint (for example: weblogs.asp.net/scottgu instead of weblogs.asp.net/scottgu/default.aspx) can also avoid diluting your pagerank across multiple URLs, and increase your search results.
In a world where search engines increasingly drive traffic to sites, extracting any little improvement in your page ranking can yield very good ROI to your business. Increasingly this is driving developers to use URL-Rewriting and other SEO (search engine optimization) techniques to optimize sites (note that SEO is a fast moving space, and the recommendations for increasing your search relevancy evolve monthly). For a list of some good search engine optimization suggestions, I'd recommend reading the SSW Rules to Better Google Rankings, as well as MarketPosition's article on how URLs can affect top search engine ranking.
Sample URL Rewriting Scenario
For the purpose of this blog post, I'm going to assume we are building a set of e-commerce catalog pages within an application, and that the products are organized by categories (for example: books, videos, CDs, DVDs, etc).
Let's assume that we initially have a page called "Products.aspx" that takes a category name as a querystring argument, and filters the products accordingly. The corresponding URLs to this Products.aspx page look like this:
http://www.store.com/products.aspx?category=bookshttp://www.store.com/products.aspx?category=DVDshttp://www.store.com/products.aspx?category=CDs
Rather than use a querystring to expose each category, we want to modify the application so that each product category looks like a unique URL to a search engine, and has the category keyword embedded in the actual URL (and not as a querystring argument). We'll spend the rest of this blog post going over 4 different approaches that we could take to achieve this.
Approach 1: Use Request.PathInfo Parameters Instead of QueryStrings
The first approach I'm going to demonstrate doesn't use Url-Rewriting at all, and instead uses a little-known feature of ASP.NET - the Request.PathInfo property. To help explain the usefulness of this property, consider the below URL scenario for our e-commerce store:
http://www.store.com/products.aspx/Bookshttp://www.store.com/products.aspx/DVDshttp://www.store.com/products.aspx/CDs
One thing you'll notice with the above URLs is that they no longer have Querystring values - instead the category parameter value is appended on to the URL as a trailing /param value after the Products.aspx page handler name. An automated search engine crawler will then interpret these URLs as three different URLs, and not as one URL with three different input values (search engines ignore the filename extension and just treat it as another character within the URL).
You might wonder how you handle this appended parameter scenario within ASP.NET. The good news is that it is pretty simple. Simply use the Request.PathInfo property, which will return the content immediately following the products.aspx portion of the URL. So for the above URLs, Request.PathInfo would return "/Books", "/DVDs", and "/CDs" (in case you are wondering, the Request.Path property would return "/products.aspx").
You could then easily write a function to retrieve the category like so (the below function strips out the leading slash and returning just "Books", "DVDs" or "CDs"):
Function GetCategory() As String If (Request.PathInfo.Length = 0) Then Return "" Else Return Request.PathInfo.Substring(1) End If End Function
Sample Download: A sample application that I've built that shows using this technique can be downloaded here. What is nice about this sample and technique is that no server configuration changes are required in order to deploy an ASP.NET application using this approach. It will also work fine in a shared hosting environment.
Approach 2: Using an HttpModule to Perform URL Rewriting
An alternative approach to the above Request.PathInfo technique would be to take advantage of the HttpContext.RewritePath() method that ASP.NET provides. This method allows a developer to dynamically rewrite the processing path of an incoming URL, and for ASP.NET to then continue executing the request using the newly re-written path.
For example, we could choose to expose the following URLs to the public:
http://www.store.com/products/Books.aspxhttp://www.store.com/products/DVDs.aspxhttp://www.store.com/products/CDs.aspx
This looks to the outside world like there are three separate pages on the site (and will look great to a search crawler). By using the HttpContext.RewritePath() method we can dynamically re-write the incoming URLs when they first reach the server to instead call a single Products.aspx page that takes the category name as a Querystring or PathInfo parameter instead. For example, we could use an an Application_BeginRequest event in Global.asax like so to do this:
void Application_BeginRequest(object sender, EventArgs e) { string fullOrigionalpath = Request.Url.ToString(); if (fullOrigionalpath.Contains("/Products/Books.aspx")) { Context.RewritePath("/Products.aspx?Category=Books"); } else if (fullOrigionalpath.Contains("/Products/DVDs.aspx")) { Context.RewritePath("/Products.aspx?Category=DVDs"); } }
The downside of manually writing code like above is that it can be tedious and error prone. Rather than do it yourself, I'd recommend using one of the already built HttpModules available on the web for free to perform this work for you. Here a few free ones that you can download and use today:
UrlRewriter.net
UrlRewriting.net
These modules allow you to declaratively express matching rules within your application's web.config file. For example, to use the UrlRewriter.Net module within your application's web.config file to map the above URLs to a single Products.aspx page, we could simply add this web.config file to our application (no code is required):

The HttpModule URL rewriters above also add support for regular expression and URL pattern matching (to avoid you having to hard-code every URL in your web.config file). So instead of hard-coding the category list, you could re-write the rules like below to dynamically pull the category from the URL for any "/products/[category].aspx" combination:

This makes your code much cleaner and super extensible.
Sample Download: A sample application that I've built that shows using this technique with the UrlRewriter.Net module can be downloaded here.
What is nice about this sample and technique is that no server configuration changes are required in order to deploy an ASP.NET application using this approach. It will also work fine in a medium trust shared hosting environment (just ftp/xcopy to the remote server and you are good to go - no installation required).
Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7
The above HttpModule approach works great for scenarios where the URL you are re-writing has a .aspx extension, or another file extension that is configured to be processed by ASP.NET. When you do this no custom server configuration is required - you can just copy your web application up to a remote server and it will work fine.
There are times, though, when you want the URL to re-write to either have a non-ASP.NET file extension (for example: .jpg, .gif, or .htm) or no file-extension at all. For example, we might want to expose these URLs as our public catalog pages (note they have no .aspx extension):
http://www.store.com/products/Bookshttp://www.store.com/products/DVDshttp://www.store.com/products/CDs
With IIS5 and IIS6, processing the above URLs using ASP.NET is not super easy. IIS 5/6 makes it hard to perform URL rewriting on these types of URLs within ISAPI Extensions (which is how ASP.NET is implemented). Instead you need to perform the rewriting earlier in the IIS request pipeline using an ISAPI Filter. I'll show how to-do this on IIS5/6 in the Approach 4 section below.
The good news, though, is that IIS 7.0 makes handling these types of scenarios super easy. You can now have an HttpModule execute anywhere within the IIS request pipeline - which means you can use the URLRewriter module above to process and rewrite extension-less URLs (or even URLs with a .asp, .php, or .jsp extension). Below is how you would configure this with IIS7:

Note the "runAllManagedModulesForAllRequests" attribute that is set to true on the section within . This will ensure that the UrlRewriter.Net module from Intelligencia, which was written before IIS7 shipped, will be called and have a chance to re-write all URL requests to the server (including for folders). What is really cool about the above web.config file is that:
1) It will work on any IIS 7.0 machine. You don't need an administrator to enable anything on the remote host. It will also work in medium trust shared hosting scenarios.
2) Because I've configured the UrlRewriter in both the and IIS7 section, I can use the same URL Rewriting rules for both the built-in VS web-server (aka Cassini) as well as on IIS7. Both fully support extension-less URLRewriting. This makes testing and development really easy.
IIS 7.0 server will ship later this year as part of Windows Longhorn Server, and will support a go-live license with the Beta3 release in a few weeks. Because of all the new hosting features that have been added to IIS7, we expect hosters to start aggressively offering IIS7 accounts relatively quickly - which means you should be able to start to take advantage of the above extension-less rewriting support soon. We'll also be shipping a Microsoft supported URL-Rewriting module in the IIS7 RTM timeframe that will be available for free as well that you'll be able to use on IIS7, and which will provide nice support for advanced re-writing scenarios for all content on your web-server.
Sample Download: A sample application that I've built that shows using this extension-less URL technique with IIS7 and the UrlRewriter.Net module can be downloaded here.
Approach 4: ISAPIRewrite to enable Extension-less URL Rewriting for IIS5 and IIS6
If you don't want to wait for IIS 7.0 in order to take advantage of extension-less URL Rewriting, then your best best is to use an ISAPI Filter in order to re-write URLs. There are two ISAPI Filter solutions that I'm aware of that you might want to check-out:
Helicon Tech's ISAPI Rewrite: They provide an ISAPI Rewrite full product version for $99 (with 30 day free trial), as well as a ISAPI Rewrite lite edition that is free.
Ionic's ISAPI Rewrite: This is a free download (both source and binary available)
I actually don't have any first-hand experience using either of the above solutions - although I've heard good things about them. Scott Hanselman and Jeff Atwood recently both wrote up great blog posts about their experiences using them, and also provided some samples of how to configure the rules for them. The rules for Helicon Tech's ISAPI Rewrite use the same syntax as Apache's mod_rewrite. For example (taken from Jeff's blog post):
[ISAPI_Rewrite]# fix missing slash on folders# note, this assumes we have no folders with periods!RewriteCond Host: (.*)RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [RP]# remove index pages from URLsRewriteRule (.*)/default.htm$ $1/ [I,RP]RewriteRule (.*)/default.aspx$ $1/ [I,RP]RewriteRule (.*)/index.htm$ $1/ [I,RP]RewriteRule (.*)/index.html$ $1/ [I,RP]# force proper www. prefix on all requestsRewriteCond %HTTP_HOST ^test\.com [I]RewriteRule ^/(.*) http://www.test.com/$1 [RP]# only allow whitelisted referers to hotlink imagesRewriteCond Referer: (?!http://(?:www\.good\.comwww\.better\.com)).+RewriteRule .*\.(?:gifjpgjpegpng) /images/block.jpg [I,O]
Definitely check out Scott's post and Jeff's post to learn more about these ISAPI modules, and what you can do with them.
Note: One downside to using an ISAPI filter is that shared hosting environments typically won't allow you to install this component, and so you'll need either a virtual dedicated hosting server or a dedicated hosting server to use them. But, if you do have a hosting plan that allows you to install the ISAPI, it will provide maximum flexibility on IIS5/6 - and tide you over until IIS7 ships.
Handling ASP.NET PostBacks with URL Rewriting
One gotcha that people often run into when using ASP.NET and Url-Rewriting has to-do with handling postback scenarios. Specifically, when you place a form server control on a page, ASP.NET will automatically by default output the "action" attribute of the markup to point back to the page it is on. The problem when using URL-Rewriting is that the URL that the form control renders is not the original URL of the request (for example: /products/books), but rather the re-written one (for example: /products.aspx?category=books). This means that when you do a postback to the server, the URL will not be your nice clean one.
With ASP.NET 1.0 and 1.1, people often resorted to sub-classing the form control and created their own control that correctly output the action to use. While this works, it ends up being a little messy - since it means you have to update all of your pages to use this alternate form control, and it can sometimes have problems with the Visual Studio WYSIWYG designer.
The good news is that with ASP.NET 2.0, there is a cleaner trick that you can use to rewrite the "action" attribute on the form control. Specifically, you can take advantage of the new ASP.NET 2.0 Control Adapter extensibility architecture to customize the rendering of the form control, and override its "action" attribute value with a value you provide. This doesn't require you to change any code in your .aspx pages. Instead, just add a .browser file to your /app_browsers folder that registers a Control Adapter class to use to output the new "action" attribute:

You can see a sample implementation I created that shows how to implement a Form Control Adapter that works with URLRewriting in my sample here. It works for both the Request.PathInfo and UrlRewriter.Net module approaches I used in Approach 1 and 2 above, and uses the Request.RawUrl property to retrieve the original, un-rewritten, URL to render. With the ISAPIRewrite filter in Approach 4 you can retrieve the Request.ServerVariables["HTTP_X_REWRITE_URL"] value that the ISAPI filter uses to save the original URL instead.
My FormRewriter class implementation above should work for both standard ASP.NET and ASP.NET AJAX 1.0 pages (let me know if you run into any issues).
Handling CSS and Image Reference Correctly
One gotcha that people sometime run into when using Url Rewriting for the very first time is that they find that their image and CSS stylesheet references sometimes seem to stop working. This is because they have relative references to these files within their HTML pages - and when you start to re-write URLs within an application you need to be aware that the browser will often be requesting files in different logical hierarchy levels than what is really stored on the server.
For example, if our /products.aspx page above had a relative reference to "logo.jpg" in the .aspx page, but was requested via the /products/books.aspx url, then the browser will send a request for /products/logo.jpg instead of /logo.jpg when it renders the page. To reference this file correctly, make sure you root qualify CSS and Image references ("/style.css" instead of "style.css"). For ASP.NET controls, you can also use the ~ syntax to reference files from the root of the application (for example:

Bubbling an Event

Bubbling an Event
The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy. Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the original control as well as to the control that exposes the bubbled event.

Event bubbling is used by the data-bound controls (Repeater, DataList, and DataGrid) to expose command events raised by child controls (within item templates) as top-level events. While ASP.NET server controls in the .NET Framework use event bubbling for command events (events whose event data class derives from CommandEventArgs), any event defined on a server control can be bubbled.

A control can participate in event bubbling through two methods that it inherits from the base class System.Web.UI.Control. These methods are OnBubbleEvent and RaiseBubbleEvent. The following code shows the signatures of these methods.

[C#] Copy Code
protected virtual bool OnBubbleEvent(
object source,
EventArgs args
);
protected void RaiseBubbleEvent(
object source,
EventArgs args
);
[Visual Basic]
Overridable Protected Function OnBubbleEvent( _
ByVal source As Object, _
ByVal args As EventArgs _
) As Boolean
Protected Sub RaiseBubbleEvent( _
ByVal source As Object, _
ByVal args As EventArgs _
)
The implementation of RaiseBubbleEvent is provided by Control and cannot be overridden. RaiseBubbleEvent sends the event data up the hierarchy to the control's parent. To handle or to raise the bubbled event, a control must override the OnBubbleEvent method.

A control that has an event bubbled to it does one of the following three things.

It does nothing, in which case the event is automatically bubbled up to its parent.
It does some processing and continues to bubble the event. To accomplish this, a control must override OnBubbleEvent and invoke RaiseBubbleEvent from OnBubbleEvent. The following code fragment (from the Templated Data-Bound Control Sample) bubbles an event after checking for the type of the event arguments.
[C#] Copy Code
protected override bool OnBubbleEvent(object source, EventArgs e) {
if (e is CommandEventArgs) {
// Adds information about an Item to the
// CommandEvent.
TemplatedListCommandEventArgs args =
new TemplatedListCommandEventArgs(this, source, (CommandEventArgs)e);
RaiseBubbleEvent(this, args);
return true;
}
return false;
}
[Visual Basic]
Protected Overrides Function OnBubbleEvent(source As Object, e As EventArgs) As Boolean
If TypeOf e Is CommandEventArgs Then
' Adds information about an Item to the
' CommandEvent.
Dim args As New TemplatedListCommandEventArgs(Me, source, CType(e, CommandEventArgs))
RaiseBubbleEvent(Me, args)
Return True
End If
Return False
End Function
It stops bubbling the event and raises and/or handles the event. Raising an event involves invoking the method that dispatches the event to listeners. To raise the bubbled event, a control must override OnBubbleEvent to invoke the OnEventName method that raises the bubbled event. A control that raises a bubbled event generally exposes the bubbled event as a top-level event. The following code fragment (from the Templated Data-Bound Control Sample) raises a bubbled event.
[C#] Copy Code
protected override bool OnBubbleEvent(object source, EventArgs e) {
bool handled = false;

if (e is TemplatedListCommandEventArgs) {
TemplatedListCommandEventArgs ce = (TemplatedListCommandEventArgs)e;

OnItemCommand(ce);
handled = true;
}
return handled;
}
[Visual Basic]
Protected Overrides Function OnBubbleEvent(source As Object, e As EventArgs) As Boolean
Dim handled As Boolean = False

If TypeOf e Is TemplatedListCommandEventArgs Then
Dim ce As TemplatedListCommandEventArgs = CType(e, TemplatedListCommandEventArgs)

OnItemCommand(ce)
handled = True
End If
Return handled
End Function
For samples that demonstrate event bubbling, see Event Bubbling Control Sample and Templated Data-Bound Control Sample.

Note While the method that enables event bubbling, OnBubbleEvent, follows the standard .NET Framework naming pattern for methods that raise events, there is no event named BubbleEvent. The bubbled event is exposed as a top-level event in the control that stops event bubbling. For example, the DataList control exposes Command events from controls in its template as ItemCommand events. Note also that the standard signature of OnEventName methods in the .NET Framework has one argument (protected void OnEventName (EventArgs e)). However, OnBubbleEvent has two arguments because the event originates outside the control; the second argument supplies the source.
The discussion so far shows how a control can respond to an event that is bubbled up to it. The following section shows how to author a control that defines a bubbled event.

Defining a Bubbled Event
If you want your control to enable event bubbling for an event that it defines, it must invoke the RaiseBubbleEvent from the OnEventName method that raises the event. No additional work needs to be done from within the control. The following code fragment shows a control that defines a Command event that enables bubbling.

[C#] Copy Code
protected virtual void OnCommand(CommandEventArgs e) {
CommandEventHandler handler = (CommandEventHandler)Events[EventCommand];
if (handler != null)
handler(this,e);

// The Command event is bubbled up the control hierarchy.
RaiseBubbleEvent(this, e);
}
[Visual Basic]
Protected Overridable Sub OnCommand(e As CommandEventArgs)
Dim handler As CommandEventHandler = CType(Events(EventCommand), CommandEventHandler)
If Not (handler Is Nothing) Then
handler(Me, e)
End If
' The Command event is bubbled up the control hierarchy.
RaiseBubbleEvent(Me, e)
End Sub
Note Event bubbling is not limited to command events. You can use the mechanism described here to bubble any event.

Usefull Questions on Asp.NET

What is the roll of JIT in asp.net?

JIT convert Intermediate languge(IL) to machine code at run
time or at the point where the software is installed.

1)Pre JIT - JIT convert Intermediate languge(IL) to machine
code before compilation time

2)Eco JIT -JIT convert Intermediate languge(IL) to machine
code At the time of compilation

3)Normal JIT - JIT convert Intermediate languge(IL) to
machine code After the time of compilation

Types of caching. How to implement caching?

there are 3 types of caches is there they ara
1)page caching
2)page fragmentaion caching
3)data caching
in case of the page caching the total page will be cached
for certain amount of time(i.e the time will declared by
ourself)and in case of page fragmentation caching only a
part of the data will be cached for some amount of time
Data caching, which allows developers to programmatically
retain arbitrary data across requests

ASP.NET Caching Features
ASP.NET Web Applications


------------------------------------------------------------
--------------------

When clients access an ASP.NET page, there are basically
two ways to provide them with the information they need:

the ASP.NET page can either obtain information from server
resources, such as from data that has been persisted to a
database, or
the ASP.NET page can obtain information from within the
application.
Retrieving information from a resource outside the
application will require more processing steps, and will
therefore require more time and resources on the server
than if the information can be obtained from within the
application space.

If the information that will be sent to the browser has
already been prepared by a previous request, the
application will be able to retrieve that information
faster if it has been stored in memory, somewhere along the
request/response stream.

Known as caching, this technique can be used to temporarily
store page output or application data either on the client
or on the server, which can then be re-used to satisfy
subsequent requests and thus avoid the overhead of re-
creating the same information.

Caching is particularly suitable when you expect to return
the same information in the same format for many different
requests.

ASP.NET provides the following types of caching that can be
used to build highly responsive Web applications:

Output caching, which caches the dynamic response generated
by a request.
Fragment caching, which caches portions of a response
generated by a request.
Data caching, which allows developers to programmatically
retain arbitrary data across requests.


What is the difference between an EXE and a DLL?
EXE file has Entry point, but in dll no Entry point.
EXE file is a excutable file which runs in a seperate
process which is managed by OS,where as a DLL file is a
dynamic link library which can be used in exe files and
other dll files.
In .net frame work both are assemblies.
EXE is a Self Executable File where as dll is not self
executable file,To run dll file we need a exe file

DLL:
1)it has versioning
2)it is not self executable
3)it runs in application process memory
4)it has no entry point
5)it is reusable

Exe:
1)it is self executable
2)it has no versioning
3)it runs in own memory
4)it have main function(Entry point)
5)it is self executable

Note:DLL is Superset of Exe

Which property on a Combo Box do you set with a column name,
prior to setting the DataSource, to display data in the
combo box?
DataTextField property

What is shadowing?

When two programming elements share the same name, one of
them can hide, or shadow, the other one. In such a
situation, the shadowed element is not available for
reference; instead, when your code uses the shared name,
the Visual Basic compiler resolves it to the shadowing
element.
Shadowing through inheritance is hiding a method of a
base class and providing a new implementation for the same.
This is the default when a derived class writes an
implementation of a method of base class which is not
declared as overridable in the base class. This also serves
the purpose of protecting an implementation of a new method
against subsequent addition of a method with the same name
in the base class.

http://www.allinterview.com/showanswers/4575.html

ASP.NET 2.0 Profile: Simple User Personalization for Your Web Apps

Most enterprise Web applications need to track user preferences across multiple visits. In ASP.NET 1.x, you need to write lots of code to create this functionality. ASP.NET 2.0 introduces a new object named profile that simplifies the steps involved in tracking personalization information. This article provides an introduction to the profile object and differentiates it from the session object. It also demonstrates how to define user profiles, both simple name/value pair profiles and profile groups. Finally, it explains the procedures involved in configuring profiles to work with different providers.
An Overview of Profile Object
In an ASP.NET profile, information is stored in a persistent format and is associated with an individual user. The ASP.NET profile allows you to easily manage user information without having to create and maintain your own database. You can store any type of object in the profile because of its generic storage system. In addition, you can also make the same data available in a type-safe manner.
Is the Profile Object the Same as the Session Object?
At first look, the profile object might look very similar to the session object. But there are a number of differences between the two objects. Table 1 outlines these differences.

Table 1. Differences Between the Profile and Session Objects
Characteristics
Profile
Session
Scope
Each user has his own profile object
Each user has his own session object
Strongly typed nature
Profile object is strongly typed
Session object is not strongly typed and requires type casting when assigning and retrieving from the session object
Persistent duration
Profile values are available for the users, even between visits
Session object contents are available only for the duration of the current browser session
Persistent location
Profile object can be stored in a SQL Server Express database or in a SQL Server database and can be configured through the Web Site Administration tool
Session object can be configured to be stored in a database, IIS in-process, or in a session state server, depending on the configuration setting
Performance
Profile may have a negative impact on performance because of the chatty interface between the profile object and the persistent data store
Can be configured using properties such as EnableSessionState attributes at the page level
IntelliSense
Provides IntelliSense because of its strongly typed nature
No support for IntelliSense

Now that you have a general understanding of the important characteristics of the profile object, take a look at an example.
Defining User Profiles
You define a user profile within the application root web.config file. You cannot create a web.config file containing a profile section in an application subfolder. This means that you can have only one profile element declaration for one Web application. The following declaration in the web.config contains a simple profile definition:









-----
-----



As you can see, the profile defines two properties: Name and UserCount. The default data type for profile properties is the System.String data type. In the above example, the Name property explicitly declares the data type to be of System.String. The UserCount property is assigned the type Int16 since it is used to represent an integer value.

Once you define a profile, whenever someone requests a page from the Web site ASP.NET automatically generates a class named ProfileCommon that corresponds to the profile definition. This class is stored in the Temporary ASP.NET Files directory, and an instance of this class is made available through the profile property of the HttpContext object.

The following section shows how to utilize this class to access the profile properties.
Working with User Profiles from an ASP.NET Page
Once you have the profiles declared, the next step is to access the profile object from within the ASP.NET page so that you can set or get the values stored in the profile properties. The following code uses the Name and UserCount properties declared in the previous section:

<%@ Page Language="C#" %>

The above listing declares two command buttons. The first, btnSetName, assigns the name entered in the textbox to the Profile.Name property. The click event of the second command button, btnGetProfileValues, results in the values of the profile properties being displayed in the label controls that in turn are contained in a Panel control. In the Page_Load event, the UserCount property is incremented by 1. As you can see from the code listing, setting the value of a profile property is very simple:

Profile.Name = txtName.Text;

Similarly, retrieving the values stored in the profile object is also very simple and straightforward:

lblName.Text = Profile.Name;

Note that you don’t need to typecast when retrieving the profile values since the properties stored in the profile object are strongly typed. Navigate to the above page using your browser, set the name, and click on the Get Profile Values button. You should see an output similar to

This example enabled Windows authentication through IIS and enabled impersonation through the following settings in the web.config file:



Note that it enabled impersonation so that the ASP.NET code has sufficient permissions to create a new SQL Server Express database for the first time.
How Profile Properties Are Stored
You might be wondering where exactly the profile properties Name and UserCount are stored in the above example. By default, ASP.NET 2.0 comes with two profile providers: SQL Server Express and SQL Server. By default, the SQL Server Express provider is used. (A later section will show how to change the provider.)

If you refresh your project listing in Solution Explorer, you will notice a database file called ASPNETDB.MDF within the App_Data folder. If you double click on this database, you will see that the database is opened through the Server Explorer view. Within this database, you will see a table called aspnet_Profile. Figure 2 shows the contents of the table and the values that have been saved through the Profile properties shown in the previous example.

UML INTERVIEW QUESTIONS

1. What is UML?
2. What is modeling
3. What are the different views that are considered when building an object-oriented software system?
4. What are diagrams?
5. What are the major three types of modeling used?
6. Mention the different kinds of modeling diagrams used?
7. What is Architecture?
8. What is SDLC?
9. What are Relationships
10. How are the diagrams divided? The diagrams are divided into static diagrams and dynamic diagrams.
11. Static Diagrams (Also called Structural Diagram): Class diagram, Object diagram, Component Diagram, Deployment diagram.
12. Dynamic Diagrams (Also called Behavioral Diagrams): Use Case Diagram, Sequence Diagram, Collaboration Diagram, Activity diagram, Statechart diagram.
13. What are Messages?
14. What is an Use Case?
15. How do you represent static members and abstract classes in Class Diagram?
16. Can we use UML for user interface (UI) design?
17. Every object has : state, behavior and identity - explain
18. How to reverse engineer C++ code in UML?
19. What are the tools you used for OOAD?
20. Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?
21. What are the four phases of the Unified Process ?
22. How do you convert uses cases into test cases?
23. Explain Class Diagram in Detail.
24. What are the Design Patterns you know.
25. When do you prefer to use composition than aggregation?
26. UML: IS it a process, method or notation?
27. Does a concept HAVE to become a class in Design?
28. What are the good practices to use while designing for reuse?
29. Can you think of some nice examples where *multiple* actors are associated with a use case ?
30. How to use CRC Cards for Class Design?
31. What is the difference between static and dynamic Classificaition.Give some examples.
32. Explian following terms: Constraint Rules, Design by contract.
33. What is Object Constraint Language (OCL)?
34. Difference Between Attribute and Association.
35. What are associative classes?
36. What is inheritance?
37. Difference between Composition and Aggregation.
38. Difference: Sequence Diagrams, Collaboration Diagrams.
39. Difference: 'uses', 'extends', 'includes'
40. What shall I go for Package Diagram?
41. What is Polymorphism?
42. Is class an Object? Is object a class?
43. Comment: C++ "includes" behavior and java "imports"
44. What do you mean by "Realization"?
45. What is a Presistent, Transient Object?
46. What is the use of Operator Overloading?
47. Does UML guarantee project success?
48. Difference: Activity Diagram and Sequence Diagram.
49. What is association?
50. How to resolve many to many relationship?
51. What are parameterized classes in UML?
52. What are the uses or application of UML?
53. What is aggregation in UML?
54. When was UML standard adopted?
55. How to identify strong aggregation (composition) relationship between classes and what is difference
56. Explain few Class Diagramming Guidelines?
57. What is UML? How it is usefull?
58. UML Diagrams
59. How usecase diagrams are used in software creation & what about their functions?
60. Analyse the system in terms of UML
61. Who developed UML?
62. How to indicate static methods within a UML class diagram?
63. What is the difference between an API and a framework?
64. What is a stereotype in UML?
65. What is agregation & Composistion ?
66. Is there any difference between Containment and Composition?
67. What is a Persistent, Transient Object?
68. What do you mean by "Realization"?
69. Explian following terms: Constraint Rules, Design by contract.
70. What is the difference between static and dynamic Classificaition.Give some examples.
71. What are associative classes?
72. Difference Between Attribute and Association.
73. What is Object Constraint Language (OCL)?
74. How to use CRC Cards for Class Design?
75. Can you think of some nice examples where multiple actors are associated with a use case ?
76. What are the good practices to use while designing for reuse?
77. Does a concept HAVE to become a class in Design?
78. UML: IS it a process, method or notation?
79. When do you prefer to use composition than aggregation?
80. Explain Class Diagram in Detail.
81. What is the purpose of UML?
82. What are the different views that are commonly used when developing Software in Java?
83. Explain Use Case View?
84. : What is a Use Case ?
85. What is an Actor?
86. What are the rules for defining an Actor?
87. What is a Scenario?
88. What is a Class Diagram?
89. How are classes represented in a class diagram?
90. What are the different kinds of relationships in Class diagram?
91. : What is Association?
92. What is Aggregation?
93. What is Composition?
94. What is Generalization?
95. What is Realization?
96. What is a Sequence Diagram?
97. What are activation boxes in a sequence diagram?
98. When one method call to a class results in several method calls to other classes how is it represented?
99. What is an USECASE? Why it is needed?
100. Who is an Actor?
101. What is guard condition?
102. Is class an Object? Is object a class?
103. Comment: C++ "includes" behavior and java "imports"
104. What do you mean by "Realization"?
105. What is a Presistent, Transient Object?
106. What is the use of Operator Overloading?
107. Does UML guarantee project success?
108. Difference: Activity Diagram and Sequence Diagram.
109. What is association?
110. How to resolve many to many relationship?
111. How do you represent static members and abstract classes in Class Diagram?
112. Can we use UML for user interface (UI) design?
113. Every object has : state, behavior and identity - explain
114. How to reverse engineer C++ code in UML?
115. What are the tools you used for OOAD?
116. Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?
117. What are the four phases of the Unified Process ?
118. How do you convert uses cases into test cases?
119. Explain Class Diagram in Detail.
120. What are the Design Patterns you know.
121. When do you prefer to use composition than aggregation?
122. UML: IS it a process, method or notation?
123. Does a concept HAVE to become a class in Design?
124. What are the good practices to use while designing for reuse?
125. Can you think of some nice examples where *multiple* actors are associated with a use case ?
126. How to use CRC Cards for Class Design?
127. What is the difference between static and dynamic Classificaition.Give some examples.
128. Explian following terms: Constraint Rules, Design by contract.
129. What is Object Constraint Language (OCL)?
130. Difference Between Attribute and Association.
131. What are associative classes?
132. What is inheritance?
133. Difference between Composition and Aggregation.
134. Difference: Sequence Diagrams, Collaboration Diagrams.
135. Difference: 'uses', 'extends', 'includes'
136. What is Polymorphism?
137. Can method be overloaded based on different return type but same argument type?
138. Describe some techniques for expressing business rules/constraints either in UML or via other means.
139. Describe the use of UML stereotypes in one of your recent projects (you used stereotypes to express what?). Feel free to include small example.
140. Describe useful application of an “extends” use case (in what situations would you use an “extends” use case instead of any of the other kind of use case relationships?)
141. Differentiate Aggregation and containment?
142. Differentiate between template class and class template.
143. Differentiate between the message and method.
144. Differentiate persistent & non-persistent objects?
145. Differentiate the class representation of Booch, Rumbaugh and UML?
146. Do you feel UML (or other types of) models have any value once the implementation code has been generated? Why?
147. Explain the difference between composition and aggregation.
148. Explain the difference between design model and an implementation model.
149. Explain the different relationship notations in UML that you have used (e.g., generalization, association, and so on.)
150. If familiar with it, describe how you used any one of the “gang of four” design patterns in recent model you produced.
151. If familiar with it, describe the “design by contract” approach.
152. If familiar with it, describe the concept of UML profile.
153. In RUP business modeling, what is the difference between Business Actor and Business Worker?
154. In the past, have you ever traced design and/or implementation artifacts back to the user requirements? If yes, how?
155. Is object persistence expressed in the analysis model, the design model or both? Explain.
156. Is there anything in RUP that you would change in order to improve the efficiency of the development process. Fit in an analysis or design model?
157. List out some of the object-oriented methodologies
158. Object Oriented: Essentials and History
159. What do u meant by “SBI” of an object?
160. What is dangling pointer?
161. What is down casting?
162. What is meant by “method-wars”?
163. What is modifier?
164. What is the difference between business use case and system use case?
165. What is the difference between cohesion and coupling? Why are “strong cohesion” and “loose coupling” patterns generally recommended in OOAD?
166. What is the format in which model can be saved inventor/tool neutral way?
167. When does name clash occur?
168. Whether unified method and unified modeling language are same or different?
169. Which UML diagrams have you used? Explain when to use one or the other. Use Case Diagram, Class Diagram, Sequence Diagram, Activity Diagram
170. Who were the three famous amigos and what was their contribution to the object community?
171. Why generalization is very strong?
172. Would you use sequence diagram or an activity diagram to model process flow that has lot of conditional flows and concurrent processing?
173. What is UML?
174. How many types of diagrams are there in UML ?
175. Explain in short all types of diagrams in UML ?
176. What are advantages of using UML?
177. What is Modeling and why UML ?
178. What’s the sequence of UML diagrams in project?
179. How did you implement UML in your project?
180. Do I need all UML diagrams in a project?
181. Give a small brief explanation of all Elements in activity diagrams?
182. Explain Different elements of a collaboration diagram ?
183. Explain Component diagrams ?
184. Explain all parts of a deployment diagram?
185. Describe various components in sequence diagrams?
186. What are the element in State Chart diagrams ?
187. Describe different elements in Static Chart diagrams ?
188. Explain different elements of a Use Case ?
189. What’s difference between Activity and sequence diagrams?

UML FAQ

UML interview questions
What is UML? UML is Unified Modeling Language. It is a graphical language for visualizing specifying constructing and documenting the artifacts of the system. It allows you to create a blue print of all the aspects of the system, before actually physically implementing the system.
What is modeling? What are the advantages of creating a model? Modeling is a proven and well-accepted engineering technique which helps build a model. Model is a simplification of reality; it is a blueprint of the actual system that needs to be built. Model helps to visualize the system. Model helps to specify the structural and behavior of the system. Model helps make templates for constructing the system. Model helps document the system.
What are the different views that are considered when building an object-oriented software system? Normally there are 5 views. Use Case view - This view exposes the requirements of a system. Design View - Capturing the vocabulary. Process View - modeling the distribution of the systems processes and threads. Implementation view - addressing the physical implementation of the system. Deployment view - focus on the modeling the components required for deploying the system.
What are diagrams? Diagrams are graphical representation of a set of elements most often shown made of things and associations.
What are the major three types of modeling used? Major three types of modeling are structural, behavioral, and architectural.
Mention the different kinds of modeling diagrams used? Modeling diagrams that are commonly used are, there are 9 of them. Use case diagram, Class Diagram, Object Diagram, Sequence Diagram, statechart Diagram, Collaboration Diagram, Activity Diagram, Component diagram, Deployment Diagram.
What is Architecture? Architecture is not only taking care of the structural and behavioral aspect of a software system but also taking into account the software usage, functionality, performance, reuse, economic and technology constraints.
What is SDLC? SDLC is Software Development Life Cycle. SDLC of a system included processes that are Use case driven, Architecture centric and Iterative and Incremental. This Life cycle is divided into phases. Phase is a time span between two milestones. The milestones are Inception, Elaboration, Construction, and Transition. Process Workflows that evolve through these phase are Business Modeling, Requirement gathering, Analysis and Design, Implementation, Testing, Deployment. Supporting Workflows are Configuration and change management, Project management.
What are Relationships? There are different kinds of relationships: Dependencies, Generalization, and Association. Dependencies are relations ships between two entities that that a change in specification of one thing may affect another thing. Most commonly it is used to show that one class uses another class as an argument in the signature of the operation. Generalization is relationships specified in the class subclass scenario, it is shown when one entity inherits from other. Associations are structural relationships that are: a room has walls, Person works for a company. Aggregation is a type of association where there is a has a relation ship, That is a room has walls, �o if there are two classes room and walls then the relation ship is called a association and further defined as an aggregation.
How are the diagrams divided? The nine diagrams are divided into static diagrams and dynamic diagrams.
Static Diagrams (Also called Structural Diagram): Class diagram, Object diagram, Component Diagram, Deployment diagram.
Dynamic Diagrams (Also called Behavioral Diagrams): Use Case Diagram, Sequence Diagram, Collaboration Diagram, Activity diagram, Statechart diagram.
What are Messages? A message is the specification of a communication, when a message is passed that results in action that is in turn an executable statement.
What is an Use Case? A use case specifies the behavior of a system or a part of a system, �se cases are used to capture the behavior that need to be developed. It involves the interaction of actors and the system.

UML Questions 2

Title: UML Interview Questions Part 1
Author: Shivprasad Koirala
Email: shiv_koirala@yahoo.com
Language: ASP.NET
Level: Beginner
Description: .Net Interview Questions 4th Edition, etc) -->
UML Interview Questions Part 1 - UML
(B) Define UML?
(I) Can you explain use case diagrams?
(I) Can you explain primary and secondary actors?
(I) How does a simple use case look like?
(I) Can you explain ‘Extend’ and ‘Include’ in use cases?
(I) Can you explain class diagrams?
(B) How do we represent private, public and protected in class diagrams?
(I) what does associations in a class diagram mean?
(I) Can you explain aggregation and composition in class diagrams?
(A) What are composite structure diagram and reflexive association in class diagrams?
(I) Can you explain business entity and service class?
(I) Can you explain System entity and service class?
(B) Can you explain generalization and specialization?
(B) How do we represent an abstract class and interface UML?
(B) How do we achieve generalization and specialization?
(I) Can you explain object diagrams in UML?
(I) Can you explain sequence diagrams?
Introduction
Again i repeat do not think you get an architecture position by reading interview questions. But yes there should be some kind of reference which will help you quickly revise what are the definition. Just by reading these answers you get to a position where you are aware of the fundamentals. But if you have not really worked you will surely fail with scenario based questions. So use this as a quick revision rather than a shot cut. To give you a practical understanding i have put all the design patterns and UML in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com/ and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.
You can download the software architecture interview questions PDF
Download Software Architecture Interview Questions
In my previous section we had concentrated on design patterns which is one of the most important fundamentals for architecture interviews. In case you have missed it below are the link. One of the other areas other than design patterns which needs to be stronger for architects is putting appropriate UML diagrams in design document.
Previous parts of Architecture Interview questions
You can download the software architecture interview questions PDF
Download Software Architecture Interview Questions
Part 1 - http://www.dotnetfunda.com/articles/article130.aspx
Part 2 - http://www.dotnetfunda.com/articles/article135.aspx
Part 3 - http://www.dotnetfunda.com/articles/article137.aspx
Part 4 - http://www.dotnetfunda.com/articles/article139.aspx
Happy job hunting......
(B) Define UML?
Unified Modeling Language, a standard language for designing and documenting a system in an object-oriented manner. It has nine diagrams which can be used in design document to express design of software architecture.
(I) Can you explain use case diagrams?
Use case diagram answers what system does from the user point of view. Use case answer ‘What will the system do?’. Use cases are mainly used in requirement document to depict clarity regarding a system. There are three important parts in a use case scenario, actor and use case. Scenario: - A scenario is a sequence of events which happen when a user interacts with the system.Actor: - Actor is the who of the system, in other words the end user. Use Case: - Use case is task or the goal performed by the end user. Below figure ‘Use Case’ shows a simple scenario with ‘Actor’ and a ‘Use Case’. Scenario represents an accountant entering accounts data in the system. As use case’s represent action performed they are normally represented by strong verbs.Actor’s are represented by simple stick man and use case by oval shape as shown in figure ‘Use Case’ below.
Figure: - Use Case
(I) Can you explain primary and secondary actors?
Actors are further classified in to two types primary and secondary actors. Primary actors are the users who are the active participants and they initiate the user case, while secondary actors are those who only passively participate in the use case.
(I) How does a simple use case look like?
Use case’s have two views of representation in any requirement document. One is the use case diagrams and the other is a detail step table about how the use case works. So it’s like a pair first an over view is shown using a use case diagram and then a table explaining the same in detail. Below is a simple ‘login’ use case shown diagrammatically and then a detail table with steps about how the use case is executed.
Figure: - Login Use Case
Use Case
Rel001
Use Case Name
Login
Description
This uses depicts the flow of how user will log-in into the chat application.
Primary Actor
Simple chat user.
Trigger
User types chat application on URL of the browser.
Pre-condition
NA
Assumption
No password is currently present for the systemRooms will remain constant as explained in the assumption section of this document
Failed End conditions
Duplicate user name is not allowed in the chat application.
Action
User clicks on the log-in button.
Main Scenario
• User types chat application on URL of the browser which in turn opens the main page.• In the main page of application user is popped up with ‘Enter user name’ option and various ‘rooms’ option drop down menu.• User then types the name and selects one of the room from drop down menu and then clicks on the ‘Log-in’ button.• Application then checks whether the user name is unique in the system if not then user is popped up with error message that “user already exist”.• After entering the unique name the user is finally logged in the application.
Action
NA
Alternate Scenario
NA
Success Scenarios
1. Opens page of a selected room in that other user names and their messages can be seen.
Note and Open Issues
NA
Table: - Login use case table
Note: - You must be wondering why we have this pair why not just a use case table only. Use case diagrams are good to show relationship between use case and they also provide high over view. The table explanation of a use case talks details about the use case. So when a developer or a user is reading a requirement document, he can get an overview by looking at the diagram if he is interested he can read the use case tables for more details.
(I) Can you explain ‘Extend’ and ‘Include’ in use cases?
‘Extend’ and ‘Include’ define relationships between use cases. Below figure ‘Extend and Include’ shows how these two fundamentals are implemented in a project. The below use case represents a system which is used to maintain customer. When a customer is added successfully it should send an email to the admin saying that a new customer is added. Only admin have rights to modify the customer. First lets define extend and include and then see how the same fits in this use case scenario.Include: - Include relationship represents an invocation of one use case by the other. If you think from the coding perspective its like one function been called by the other function.Extend: - This relationship signifies that the extending use case will work exactly like the base use case only that some new steps will inserted in the extended use case.Below figure ‘Extend and Include’ shows that ‘add customer’ is same as the ‘add discounted customer’. The ‘Add discounted customer’ has an extra process, to define discount for the discounted customer which is not available for the simple customer. One of the requirements of the project was that when we add a customer, the system should send an email. So after the customer is added either through ‘Add simple customer’ use case or ‘Add discounted customer’ use case it should invoke ‘send a email’ use case. So we have defined the same with a simple dotted line with <> as the relationship.
Figure: - Extend and Include
Note: - One of the points to be noted in the diagram ‘Extend and Include’ is we have defined inheritance relationship between simple and admin user. This also helps us defining a technical road map regarding relationships between simple and admin user.
(I) Can you explain class diagrams?
Class diagramClass is basically a prototype which helps us create objects. Class defines the static structure of the project. A class represents family of an object. By using Class we can create uniform objects.In the below figure you can see how the class diagram looks. Basically there are three important sections which are numbered as shown in the below. Let’s try to understand according to the numbering:-• Class name:-This is the first section or top most section of the Class which represents the name of the Class (clsCustomer).• Attributes:-This is the second section or the middle section of the class which represents the properties of the system.• Methods: - This section carries operation or method to act on the attributes.
Figure: - Three sections of the class
Now in the next section we will have a look on Association relationship between these classes.
(B) How do we represent private, public and protected in class diagrams?
In order to represent visibility for properties and methods in class diagram we need to place symbols next to each property and method as shown in figure ‘Private, Public and Protected’. ‘+’ indicates that it’s public properties/methods. ‘-‘indicates private properties which means it can not be accessed outside the class. ‘#’ indicate protected/friend properties. Protected properties can only be seen within the component and not outside the component.
Figure: - Private, public and protected
(I) what does associations in a class diagram mean?
Associations in Class diagramsA single Class cannot represent the whole module in a project so we need one or more classes to represent a module. For instance, a module named ‘customer detail’ cannot be completed by the customer class alone , to complete the whole module we need customer class, address class, phone class in short there is relationship between the classes. So by grouping and relating between the classes we create module and these are termed as Association. In order to associate them we need to draw the arrowed lines between the classes as shown in the below figure. In the figure ‘Order is paid by payments class’, we can see Order class and the Payment class and arrowed line showing relationship that the order class is paid using payment class in other words order class is going to be used by payment class to pay the order. The left to right marked arrow basically shows the flow that order class uses the payment class.In case payment class using the order class then the marked arrow should be right to left showing the direction of the flow.

Figure:- Order is paid by Payments class
There are four signs showing the flow:-
Figure: - Direction signs in UML
Multiplicity
Multiplicity can be termed as classes having multiple associations or one class can be linked to instances of many other classes. If you look at the below figure the customer class is basically associated with the address class and also observes the notations (*, 0 and 1).If you look at the right hand side the (1….*) notation indicates that at least one or many instance of the address class can be present in the customer class. Now towards left hand side we have (0….*) notation indicating that address class can exist without or many customer class can link him.In order to represent multiplicity of classes we have to show notations like (1….*), (0….*) as shown in below figure.
Note: ‘*’ means “many” where as ‘(0, 1)’ means “(zero or at least one)” respectively.
Figure: - Multiplicity in Classes
(I) Can you explain aggregation and composition in class diagrams?
In this Association there are two types mainly Aggregation Association and Composition Association.Aggregation Association signifies that the whole object can exist without the Aggregated Object. For example in the below figure we have three classes university class, department class and the Professor Class. The university cannot exist without department which means that university will be closed as the department is closed. In other words lifetime of the university depend on the lifetime of department.In the same figure we have defined second Association between the department and the Professor. In this case, if the professor leaves the department still the department continues in other words department is not dependent on the professor this is called as Composition Association.
Note: - The filled diamond represents the aggregation and the empty diamond represents the composition. You can see the figure below for more details.

Figure: - Aggregation and composition in action
(A) What are composite structure diagram and reflexive association in class diagrams?
Composite structure diagramWhen we try to show Aggregation and Composition in a complete project the diagram becomes very complicated so in order to keep it simple we can use Composite structure diagram. In the below figure we have shown two diagrams one is normal diagram other is Composite structure diagram and the simplicity can easily be identified. In the composite diagram the aggregated classes are self contained in the main class which makes it simpler to read.
Figure: - Composite Structure diagram
Reflexive associationsIn many scenarios you need to show that two instances of the same class are associated with each other and this scenario is termed as Reflexive Association. For instance in the below figure shows Reflexive Association in the real project. Here you can see customer class has multiple address class and addresses can be a Head office, corporate office or Regional office. One of the address objects is Head office and we have linked the address object to show Reflexive Association relationship. This is the way we can read the diagram Regional address object is blocked by zero or one instance of Head office object.
Figure: - Reflexive association
(I) Can you explain business entity and service class?
Business entity objects represent persistent information like tables of a database. Just making my point clearer they just represent data and do not have business validations as such. For instance below figure ‘Business entity and service’ shows a simple customer table which with three fields ‘Customer Code’,’ Customer Address’ and ‘Phone Number’. All these fields are properties in ‘ClsCustomer’ class. So ‘ClsCustomer’ class becomes the business entity class. The business entity class by itself can not do anything it’s just a place holder for data. In the same figure we have one more class ‘ClsServiceCustomer’. This class aggregates the business entity class and performs operations like ‘Add’,’ Next’ (Move to next record), ‘Prev’ (Move to previous record) and ‘GetItem’ (get a customer entity depending on condition).With this approach we have separated the data from the behavior. The service represents the behavior while the business entity represents the persistent data.
Figure:-Business entity and service
(I) Can you explain System entity and service class?
System entity class represents persistent information which is related to the system. For instance in the below figure ‘System entity and service class’ we have a system entity class which represents information about ‘loggedindate’ and ‘loggedintime’ of the system registry. System service class come in two flavors one is it acts like a wrapper in the system entity class to represent behavior for the persistent system entity data. In the figure you can see how the ‘ClsAudit’ system entity is wrapped by the ‘ClsAuditSytem’ class which is the system service class. ‘ClsAuditSystem’ adds ‘Audit’ and ‘GetAudit’ behavior to the ‘ClsAudit’ system entity class.
Figure: - System entity and service class
The other flavor of the system service class is to operate on non-persistent information. The first flavor operated on persistent information. For instance the below figure ‘Non-persistent information’ shows how the class ‘ClsPaymentService’ class operates on the payment gateway to Check is the card exists , Is the card valid and how much is the amount in the card ?. All these information are non-persistent. By separating the logic of non-persistent data in to a system service class we bring high reusability in the project.
Figure: - Non-persistent information
Note: - The above question can be asked in interview from the perspective of how you have separated the behavior from the data. The question will normally come twisted like ‘How did you separate the behavior from the data?’.
(B) Can you explain generalization and specialization?
Generalization and specializationIn Generalization and Specialization we define the parent-child relationship between the classes. In many instance you will see some of the classes have same properties and operation these classes are called super class and later you can inherit from super class and make sub classes which have their own custom properties. In the below figure there are three classes to show Generalization and Specialization relationship. All phone types have phone number as a generalized property but depending upon landline or mobile you can have wired or simcard connectivity as specialized property. In this diagram the clsphone represent Generalization whereas clslandline and clsmobile represents specialization.
Figure: - Generalization and Specialization
(B) How do we represent an abstract class and interface UML?
Interface is represented by <> in the class diagram. Below figure ‘Interface in action’ shows we have defined an interface ‘IContext’. Note the ‘<>’ represents an interface. If we want to show that the interface is used in a class we show the same with a line and a simple circle as shown in figure ‘Interface in Action’ below.
Figure: - Interface in action
Abstract classes are represented by ‘{abstract}’ as shown in figure ‘Abstract classes in action’.
Figure: - Abstract classes in action.
(B) How do we achieve generalization and specialization?
By using inheritance.
(I) Can you explain object diagrams in UML?
Class represents shows the static nature of the system. From the previous question you can easily judge that class diagrams shows the types and how they are linked. Classes come to live only when objects are created from them. Object diagram gives a pictorial representation of class diagram at any point of time. Below figure ‘Object diagram’ shows how a class looks in when actual objects are created. We have shown a simple student and course relationship in the object diagram. So a student can take multiple courses. The class diagram shows the same with the multiplicity relationship. We have also shown how the class diagram then looks when the objects are created using the object diagram. We represent object with Object Name: Class Name. For instance in the below figure we have shown ‘Shiv : ClsStudent’ i.e ‘Shiv’ is the object and ‘ClsStudent’ the class. As the objects are created we also need to show data of the properties, the same is represented by ‘PropertyName=Value’ i.e. ‘StudentName=Shiv’.
Figure: - Object diagrams
The diagram also states that ‘ClsStudent’ can apply for many courses. The same is represented in object diagram by showing two objects one of the ‘Computer’ and the other of ‘English’.
Note: - Object diagrams should only be drawn to represent complicated relationship between objects. It’s possible that it can also complicate your technical document as lot. So use it sparingly.
(I) Can you explain sequence diagrams?
Sequence diagramsSequence diagram shows interaction between objects over a specific period time. Below figure 'Sequence diagram' shows how a sequence diagram looks like. In this sequence diagram we have four objects 'Customer','Product','Stock' and 'Payment'. The message flow is shown vertically in waterfall manner i.e. it starts from the top and flows to the bottom. Dashed lines represent the duration for which the object will be live. Horizontal rectangles on the dashed lines represent activation of the object. Messages sent from a object is represented by dark arrow and dark arrow head. Return message are represented by dotted arrow. So the figure shows the following sequence of interaction between the four objects:-• Customer object sends message to the product object to request if the product is available or not.• Product object sends message to the stock object to see if the product exists in the stock.• Stock object answers saying yes or No.• Product object sends the message to the customer object.• Customer object then sends a message to the payment object to pay money.• Payment object then answers with a receipt to the customer object.One of the points to be noted is product and stock object is not active when the payment activity occurs.
Figure: - Sequence diagram
Messages in sequence diagramsThere are five different kinds of messages which can be represented by sequence Synchronous and asynchronous messages:-Synchronous messages are represented by a dark arrow head while asynchronous messages are shown by a thin arrow head as shown in figure ‘Synchronous and Asynchronous’.
Figure: - Synchronous and Asynchronous
Recursive message:-We have scenarios where we need to represent function and subroutines which are called recursively. Recursive means the method calling himself. Recursive messages are represented by small rectangle inside a big rectangle with an arrow going from the big rectangle to the small rectangle as shown in figure ‘Recursive message’.
Figure: - Recursive message
Message iteration:-Message iteration represents loops during sequences of activity. Below figure ‘message iteration’ shows how ‘order’ calls the ‘orderitem’ objects in a loop to get cost. To represent loop we need to write ‘For each object’. In the below figure the object is the ‘orderitem’. Also note the for each is put in a box to emphasize that it’s a loop.
Figure: - Message iteration
Message constraint:-If we want to represent constraints it is put in a rectangle bracket as shown in figure ‘message constraint’. In the below figure ‘message constraint’ the ‘customer’ object can call ‘book tickets’ only if the age of the customer is greater than 10.
Figure: - Message constraint
Message branching:-Below figure ‘message branching’ shows how ‘customer’ object have two branches one is when the customer calls save data and one when he cancels the data.
Figure: - Message branching
Doing Sequence diagram practicallyLet’s take a small example to understand sequence diagram practically. Below is a simple voucher entry screen for accounts data entry. Following are the steps how the accountant will do data entry for the voucher:-
Accountant loads the voucher data entry screen. Voucher screen loads with debit account codes and credit account codes in the respective combo boxes.
Accountant will then fill in all details of the voucher like voucher description, date, debit account code, credit account code, description, and amount and then click ‘add voucher’ button.
Once ‘add voucher’ is clicked it will appear in the voucher screen below in a grid and the voucher entry screen will be cleared and waiting for new voucher to be added. During this step voucher is not added to database it’s only in the collection.
If there are more vouchers to be added the user again fills voucher and clicks ‘add voucher’.
Once all the vouchers are added he clicks ‘submit voucher’ which finally adds the group of vouchers to the database.
Below figure ‘Voucher data entry screen’ shows pictorially how the screen looks like.
Figure: - Voucher data entry screen
Figure ‘Voucher data entry sequence diagram’ shows how the sequence diagram looks like. Below diagram shows a full sequence diagram view of how the flow of the above screen will flow from the user interface to the data access layer. There are three main steps in the sequence diagram, let’s understand the same step by step.Step 1:- The accountant loads the voucher data entry screen. You can see from the voucher data entry screen image we have two combo boxes debit and credit account codes which are loaded by the UI. So the UI calls the ‘Account Master’ to load the account code which in turn calls the data access layer to load the accounting codes.Step 2:- In this step the accountant starts filling the voucher information. The important point to be noted in this step is that after a voucher is added there is a conditional statement which says do we want to add a new voucher. If the accountant wants to add new voucher he again repeats step 2 sequence in the sequence diagram. One point to be noted is the vouchers are not added to database they are added in to the voucher collection.Step 3:- If there are no more vouchers the accountant clicks submit and finally adds the entire voucher in the database. We have used the loop of the sequence diagram to show how the whole voucher collection is added to the database.
Figure: - Voucher data entry sequence diagram
 
hit counter
Download a hit counter here.