Saturday, March 29, 2008

Difference Between .NET Remoting and Web Services

1. Web services can only be accessed over HTTP whereas .NET Remoting can be accessed over various protocols like TCP, HTTP etc.

2. Web services operate in a stateless environment since its HTTP, a stateless protocol whereas .NET remoting support state management (as in through Singleton and SingleCall objects)

3. Web services are more reliable than .NET Remoting.

4. Web services are easy to create and use while .NET Remoting are complex  to be created.

5. Web services support heterogeneous environments i.e. support interoperability across platforms, on the other hand .NET remoting requires client to be built using .NET, thus it does'nt support heterogeneous environment.

6. Web Services support datatypes defined in the XSD type system while .NET remoting provides support for rich type system using binary communication.


 

This question was asked me in an interview.

.Net Remoting a simple example


What Is .NET Remoting?


As you may already know that application domains and processes are two mechanisms for isolation between applications. Processes are the main insulator between two different applications. Application domains is another extra isolation layer between different applications, but its main purpose is to isolate parts of code inside the same application. These parts will have the same isolation and restrictions as if they are different applications.


Now, what if for one reason or another we need to use a part of code located at different application domain running within the same application, located in different process running on the same machine, or located inside another process running on a different machine?. For uses like this, .Net remoting does exists.


Microsoft .Net Remoting is created to solve these problems. It provides a solution for communication between application domains and processes in a seamlessly and transparent way. This is due to the power of .Net remoting programming model and run time support.


When Microsoft developers designed .Net remoting framework, they have taken into consideration flexibility and customizability. This is done by separating the remotable object - in other words the object that you need to call remotely (located at another application domain or process) - from the client or server application domain and from any specific mechanism of communication. You can replace one communication protocol with a different one without the need to recompile the client or the server. Another flexibility related feature is that .Net remoting is a language independent framework, you can choose any application mode to communicate from. You can communicate using a web application, a console application, or a Windows Service. Any application can host a remoting object and provides its services to any client whether or not it is located within the same process boundaries, or in separate processes located on one machine or a set if disparate machines.


It is worth mentioning that objects in different application domains communicate using one of two techniques or methods. The first one is by transporting copies of objects across application domain boundaries. The second one is by using a proxy to exchange messages between them. .Net remoting framework uses the second technique.


.Net Remoting components


To allow an application located in different application domain or process to communicate with another one using .Net remoting technique, you have to just build the following:



  • A remotable object. Which is an object that contain some properties and methods located in one application domain and you need to call its methods or properties from another application domain or process.

  • A host application. This is the host of the remotable object. It is also called the server application. The main task of this host is to listen to requests for the hosted remotable object.

  • A client application. This is the application which makes requests for the remotable object.

Types of Remotable Objects


There are 3 types of remotable objects that you can configure and choose from depending on the requirements of your application.



  • Single Call: The remotable object is intended to be called from one client / one instance at a time.

  • Singleton Call: Several clients / several instances of the remotable object can be utilized

  • Activation: Richer than Singleton in the regard of other aspects.

How Does .NET Remoting Works?


As we mentioned previously you need to build a remotable type or object, a host or server application, and a client application to be able to communicate. In the client application you need only to create a new instance of the remotable object by using "New" or the instance creation function. When you do this the remoting system creates a proxy object that looks like the remote type to the client. When the client calls a method of the remotable type it actually call the method on the created proxy. The remoting system receives that call and routes it to the server process, it then processes the request, and returns the result to the client proxy, which in turn returns it to the client application. The client application will get the feeling of the remotable object as it is running inside the same process not inside another one. The proxy object is the system component that creates the impression that the server object is in the client's process not in a separate process or computer.


To get the above scenario to work perfectly, you actually need to know about two things: the first is channels, and the second is configuration.


Channels


If you try to build the remoting system yourself, you will need to learn network programming and a wide array of protocols and serialization formats. For purposes like that .NET remoting provides the concept of transport channel that represents the combination of the underlying technologies required to open a network connection and to use a particular protocol to send the bytes to the receiving application.


Channels are the transport media used to send / receive messages between applications across remoting boundaries (these boundaries can be between application domains, processes, or computers). A channel is an object that takes a stream of data, packages it according to a specific network protocol, and then sends the package to the other side. Channels can be categorized as channels which can send messages, channels which can receive messages, or channels which can perform both sending and receiving like the two .NET channels "HTTPChannel" and "TCPChannel".


By using the channel concept or technique you can plug in a wide range of protocols even if the common language runtime is not at the other end of the channel. You can also create your own channel object using whatever network protocol you prefer if it is not supported by the .NET framework.


You have to register at least one channel to use with the remoting infrastructure before being able to call the remotable type from the client application. You can register a channel in one of two ways: by calling "ChannelServices.RegisterChannel ", or by using a configuration file. You have to choose a specific port for your channel to listen on. If you are not sure whether a port is available or not, use 0 (zero) when you configuring your channel's port and the remoting system will choose an available port for you.


Configuration


The .NET remoting infrastructure needs specific information to work successfully and smoothly. That information is what we call configurations. You can choose one of the available two ways to configure your remotable types depending on your own preferences. The first way is by calling configuration methods directly from your server and client code, and this is what we call programmatic configuration. The second way is by creating an XML configuration file (.config file). To configure your remotable type properly whether by programmatic configuration or through a configuration file you have to provide the following information:



  • The activation type of your remotable object.

  • The name or address of the metadata that describes the remotable type.

  • The kind of the registered channel and the port number.

  • The URL that uniquely identifies the remotable type.



You should now recall that a .Net remoting application consists of three components. These are the remotable type, the host or server, and the client. In this part of our tutorial we will build a .NET remoting application using a technique nearly suitable for any scenario you may need to use .NET remoting with.


Building a .Net Remoting Application


.NET remoting has a very straightforward technique. If you want to build an application that uses .Net remoting to communicate across application domain boundaries all what you have to do is to implement the three components mentioned above. You also need to configure the remoting system to use remote activation for the remotable type. This requirements applies whatever the complexity of your remoting scenario.


Building a Remotable Type


The remotable object is a very typical / standard object, the difference is just it is being called from outside its application domain. To give any object the ability to be called from outside its application domain boundaries, the class that declare that object must inherit from "MarshalByRefObject" class. The "MarshalByRefObject" class is the base class for objects being communicated across application domains boundaries by exchanging messages using a proxy. So, when our class inherits this class, it automatically gets the same ability of communication as the "MarshalByRefObject" class. Also, the remotable class must be compiled into a .DLL library to be able to call its services. The following lines of code shows you an example of how to code a remotable type. First, open up your MS Visual Studio .NET, create new project, then add a new class to the created project. As shown in our example below the class name is "TheRemotableObject".


Public Class TheRemotableObject


Inherits MarshalByRefObject




Private List As String() = {"String1", "String2", "String3"}


Public Function ViewItem(ByVal ItemNum As Integer) As String




If ItemNum > List.GetUpperBound(0) _


Or ItemNum < List.GetLowerBound(0) Then Return "Error"


Return List(ItemNum)




End Function


End Class


The class shown in the above piece of code is a remotable class because it inherits the "MarshalByRefObject". It has a private list of strings and one public method or service. The method's mission is to take an integer list index as an input parameter, checks that the input is within the list boundaries and if so returns the specified or selected string to the caller.


Save the file containing the above created class - in our case it will be saved as "TheRemotableObject.vb". To compile this class into a library, use your command line tools shipped with the .NET framework SDK as shown in the following command line.


Note that: you should first run the [ Start / Programs / Microsoft Visual Studio 2005 / Visual Studio Tools / Visual Studio 2005 Command Prompt ] to be able to use the "vbc" compiler. You also have to run the following command from inside the directory inside which you saved the class file.


> vbc /t:library TheRemotableObject.vb


As a result of running the above command a new file "TheRemotableObject.dll" is now created at the same location as the "TheRemotableObject.vb" file.


Building a Host Application


Building such a remotable object as shown in the pervious section is not enough to make the required communication across application domains boundaries. Indeed, you need to build another kind of application to perform the communication process. You can think of building such a remotable type or object as just remarking this object as "could be shared or called remotely" but no more. You stilll need some kind of application being able of receiving calls to this newly created remotable object, identifying these calls, creating an instance from the called object, running the required service or method, and finally returning results to the caller. This is the host / server / listener application. A host application does its job by the mean of using channels. Channels are objects responsible of handling the network protocols and serialization formats on your behalf. In addition, the host application registers your remotable type with the .NET remoting system so that it can use your channel to listen for requests for your object. Host applications can be of any type. It can be a Windows forms application, an ASP.NET application, a Windows service application, a console application, or any type of a managed application.


Now, to an example:


Close all open projects or solutions, and create a new console application in a new directory (in our example we will name it example2). As a console application you will find module that is created by default (Module). Rename "Module1" as "Listener". Double click the "Listener" icon and change the module name shown in the code window. Add the imports statement and the lines of code inside the "Main" sub as shown in the following code snippet:


Imports System.Runtime.Remoting


Module Listener




Sub Main()


RemotingConfiguration.Configure("Listener.exe.config")


System.Console.WriteLine("Listener: Press <Enter> to exit ...")


System.Console.ReadLine()


End Sub




End Module


In the above code we firstly configure the remoting infrastructure by using a configuration file named "Listener.exe.config". Then we send a message to the user, and waiting till the user hits the <enter> key to exit. The last line main and only purpose is to keep the application running till the <enter> key is pressed.


The configuration file is an XML file specifying some configurations like the name and the URI of the remotable type, the kind of the used channel (whether it is an http or tcp channel), the port number to listen on, and the server activation mode. The remoting system uses the information in this file to listen for remote requests and route them to an instance of the remotable object or type. Below is a copy of the listener configuration file.


<configuration>


<system.runtime.remoting>


<application>


<service>


<wellknown


mode="Singleton"


type="TheRemotableObject, RemotableType"


objectUri="TheRemotableObject.rem"


/>


</service>


<channels>


<channel ref="http" port="8989"/>


</channels>


</application>


</system.runtime.remoting>


</configuration>


To compile the above "Listener.vb" module we will use the command line tools like in compiling the remotable object class above. Before compilation you have to save a copy of the "The remotableObject.dll" created in the previous example in the same directory with the "Listener.vb". Then save the above configuration file under the name specified in the listener module code file (which is "Listener.exe.config") in the same directory as the "Listener.vb" file. Position your command line prompt at the directory that contains the three files mentioned above then run the following command line.


> vbc /r:TheRemotableObject.dll Listener.vb


As a result you will get "Listener.exe" file in the same directory with the "Listener.vb".


Building a Client Application


To build a client application that utilizes the remotable type "TheRemotableObject" and hosted by the "Listener" application created above, you have to register this client application as a client for the specified remotable type. When you do this, the client application will call the remotable type as if it does exist in the same application domain with the client. The following code example shows you how to build a client application.


Close all open projects and solution in your Visual Studio .NET 2005 then create a new console application giving it a name and a directory to be created in (in our example the project name will be "Example3"). Rename the default created module "Module1" to "Client" then double click its icon to open the code file. Rename the module to "Client". Add the imports statement and the lines of code inside the "Main" sub as shown in the following code snippet.


Imports System.Runtime.Remoting


Module Client




Sub Main()


RemotingConfiguration.Configure("Client.exe.config")


Dim RM As New TheRemotableObject()


System.Console.WriteLine("Result = " + RM.ViewItem(1))


End Sub




End Module


As shown in the code above you have to configure the remoting infrastructure with the "Client.exe.config" XML configuration file. Then you define and create a new instance of the remotable type "TheRemotableObject". Call the remotable method "ViewItem" then write the result to the console. Although the "TheRemotableObject" type is not in the same application domain with the "Client" but you will be able to call its services "ViewItem" remotly and will be able to receive the results. Of course the last two lines of code in the "Main" subroutine will be marked as error but this is not a matter, just ignore it.


Write the following configuration file and save it under the name "Client.exe.config" at the same directory of the "Client.vb" code file.


<configuration>


<system.runtime.remoting>


<application>


<client>


<wellknown


type="TheRemotableObject, RemotableType"


Url="http://localhost:8989/TheRemotableObject.rem"


/>


</client>


</application>


</system.runtime.remoting>


</configuration>


The configuration file tells the remoting system that the type information of the remotable type can be found in the "TheRemotableType" assembly. This remotable object located at "http://localhost:8989/TheRemotableObject.rem". If you want to run this application over a network, you have to write the remote computer name instead of "localhost" in the url above. You must pay attention when you write a configuration file. Although it is simple but most errors comes from incorrect settings or mismatching between settings in the two configuration files used by client and host applications.


Now put a copy of the "TheRemotableObject.dll" created in example1 and compile the above "Client.vb" using command line tools as follows.


> vbc /r:TheRemotableObject.dll Client.vb


As a result you will get "Client.exe" file at the same directory with the "Client.vb".


Running The Complete .NET Remoting application


Now The situation is : We have one directory called "Example2" (which is the listener directory) that contains "Listener.exe", "Listener.exe.config", and "TheRemotableObject.dll" files. We have another directory called "Example3" (which is the client directory) that contains "Client.exe", "Client.exe.config", and "TheRemotableObject.dll" files. Note: "Example2", and "Example3" are depicted as "L" and "cl" in the figure below.









Figure 1 - The host listing to the client and fulfill its requests


To run and test the remoting process between these two different applications where each one of them has its own application domain and process boundaries do the following: Run the command line prompt at the listener directory and type: Listener, then press <enter>. A message will be displayed as shown in figure1 in the above window. Now open a new command prompt in the client directory and type: Client, then press <enter>. When you do so the client application will call the remotable type, while the server at the other side of the channel listening for any requests. It receives the client request, process it then returns the results back to the client. The client gets the result and displays it to you at the client command prompt as shown in figure1 in the second window.

Thursday, March 20, 2008

Using Application Configuration file

This article covers using application configuration files in Microsoft .NET. It briefly outlines the concept of application configuration files In particular, it discusses using the System.Configuration namespace

Application Configuration Background

Building configurable applications is not a new concept. The idea of applications relying on configuration parameters to dictate behavior at run time has been around for many years. For those of us who were around Microsoft-based programming prior to .NET, the most common example is the use of INI files. INI files are simple text-based files with key and value pairs; the key is used to fetch the value, and the value is then used in some way to influence the application settings and/or resulting behavior. This way, you can modify the configuration file to drive program behavior without having to recompile the application.

INI files generally worked great, except for the following drawbacks:

Microsoft moved away from INI files and towards storing everything in the Registry, which made application deployment much more difficult. As a result, Microsoft moved back to the concept of an "xcopy deployment," by which programmers deployed applications by simply copying files. Redmond used XML and some objects built into the Microsoft .NET Framework to bring new life to our old friend the application configuration file.

System.Configuration Basics

The System.Configuration namespace provides the functionality for reading configuration files. Microsoft released an XML schema dictating the format for configuration files that can be read using the System.Configuration API, enabling the accessing object to automatically consume the configuration files. This way, you can allow configuration files to be read without having to develop

The name and storage location of an application configuration file depends on the application type with which it is being used. A configuration file for an executable (.exe) is located in the same directory as the application. The file is the name of the application with a .config extension. For example, notepad.exe would have a configuration file of notepad.exe.config. A configuration file for an ASP.NET application is called web.config and is located in the root of the application's virtual directory.

appSettings Section

An application configuration file follows a specific XML schema. The appSettings section is a predefined section of the configuration file designed to make it very easy to retrieve a value based on a given name. This is the easiest way to add application-specific settings into an application configuration file. The appSettings section of the configuration file consists of a series of "add" elements with "key" and "value" attributes. While the appSettings section is predefined, it is not included in a configuration file by default and must be manually added. A simple example of a configuration file would be the following:

<?xml version="1.0"
encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="ApplicationTitle"
value="Sample Console Application" />

<add key="ConnectionString"


value="Server=localhost;Database=Northwind;Integrated

Security=false;User Id=sa;Password=;" />

</appSettings>

</configuration>

The AppSettings property of the ConfigurationSettings object in the System.Configuration namespace is used to get the settings. For example, to read either of the settings above, the following sample code would do the trick:

// Read appSettings

string title = ConfigurationSettings.AppSettings["ApplicationTitle"];

string connectString =

ConfigurationSettings.AppSettings["ConnectionString"];

Now, you could easily set a dynamic title value or read database connection string information from the application configuration file. This gives you the freedom to adjust settings without having to recompile any code.

Customized Configuration Sections

If you have distinct groupings of configurations to be included in the application configuration file, consider creating a custom configuration section in lieu of the appSettings section. This will allow you more organizational structuring around the storage of various settings. You include a custom section by including the configSections element in the configuration file and a sub-element called section that defines the custom section and the handler for reading it. The .NET Framework contains an IConfigurationSectionHandler interface that dictates the required functionality handlers provide by allowing you to use custom handlers with the Configuration if you so choose. This example just uses handlers the .NET Framework already provides. Continuing the example from the previous section, the following configuration file contains a custom section and specifies which handler to use for reading:

<?xml version="1.0"
encoding="utf-8" ?>

<configuration>

<configSections>

<section name="sampleSection"

type="System.Configuration.SingleTagSectionHandler" />

</configSections>


 

<sampleSection ApplicationTitle="Sample Console Application"


ConnectionString="Server=localhost;Database=Northwind;

Integrated Security=false;User Id=sa;

Password=;" />


 

<appSettings>

<add key="ApplicationTitle"


value="Sample Console Application" />

<add key="ConnectionString"


value="Server=localhost;Database=Northwind;

Integrated Security=false;User Id=sa;Password=;" />

</appSettings>

</configuration>

The following code reads the configuration settings into a dictionary, where you can easily access the values:

// Read customSection

System.Collections.IDictionary sampleTable = (IDictionary)

ConfigurationSettings.GetConfig("sampleSection");

string title = (string)sampleTable["ApplicationTitle"];

string connectString = (string)sampleTable["ConnectionString"];

Customized Configuration Sections and Groups

The issue with custom configuration sections alone is that they rely on attributes to store all of the settings as a part of a single element. This can become cumbersome when a large number of configurations are contained within a section or additional related sections. You can further organize similar custom sections into a section group, which makes it easier to work with numerous configurations and helps eliminate naming conflicts with custom configuration sections. This is especially useful where your application contains reference to several other DLLs that read configuration information from the host applications configuration file. A sectionGroup element is simply placed around one or more section elements to create a group. Expanding the example configuration file, the following configuration file contains a custom group, section, and the pre-defined appSettings:

<?xml version="1.0"
encoding="utf-8" ?>

<configuration>

<configSections>

<section name="sampleSection"


type="System.Configuration.SingleTagSectionHandler" />

<sectionGroup name="CodeGuru">

<section name="utilitySection"


type="System.Configuration.NameValueSectionHandler,

System,Version=1.0.5000.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" />

</sectionGroup>

</configSections>


 

<sampleSection ApplicationTitle="Sample Console Application"

ConnectionString="Server=localhost;Database=Northwind;

Integrated Security=false;User Id=sa;

Password=;" />


 

<CodeGuru>

<utilitySection>

<add key="ApplicationTitle"


value="Sample Console Application" />

<add key="ConnectionString"


value="Server=localhost;Database=Northwind;

Integrated Security=false;User Id=sa;

Password=;" />

</utilitySection>

</CodeGuru>


 

<appSettings>

<add key="ApplicationTitle"


value="Sample Console Application" />

<add key="ConnectionString"


value="Server=localhost;Database=Northwind;

Integrated Security=false;User Id=sa;Password=;" />

</appSettings>

</configuration>

Note the extra "Version," "Culture," and "PublicKeyToken" specified in defining a section group. These all come from what the machine.config configures on the local machine. Occasionally, it has worked for me without them, but other times an exception is thrown that it can't create the appropriate handler. I've found that if I include those items, it consistently works.

The following code can access the items in the custom group by loading the group into a NameValueCollection for easy access to the key and value pairs:

// Read custom sectionGroup

NameValueCollection collection = (NameValueCollection)

ConfigurationSettings.GetConfig("CodeGuru/utilitySection");

string title = collection["ApplicationTitle"];

string connectString = collection["ConnectionString"];

Note the path-like statement required to find the appropriate section to read when accessing the custom section.

Possible Enhancements

This article has touched on some of the basics of using application configuration files, including the ability to define your own sections and groups of sections. Here are a couple of additional items for you to ponder about application configuration settings:

Friday, March 14, 2008

System Development Life Cycle

SDLC


SDLC is the process of developing information systems through investigation, analysis, design, implementation and maintenance. SDLC is also known as information systems development or application development. It is also known as Waterfall Model

 

The software development life cycle (SDLC) is the entire process of formal, logical steps taken to develop a software product. The phases of SDLC can vary somewhat but generally include the following:

Requirements Analysis


Extracting the requirements of a desired software product is the first task in creating it. While customers probably believe they know what the software is to do, it may require skill and experience in software engineering to recognize incomplete, ambiguous or contradictory requirements.

Specification


Specification is the task of precisely describing the software to be written, in a mathematically rigorous way. In practice, most successful specifications are written to understand and fine-tune applications that were already well-developed, although safety-critical software systems are often carefully specified prior to application development. Specifications are most important for external interfaces that must remain stable.

Software architecture


The architecture of a software system refers to an abstract representation of that system. Architecture is concerned with making sure the software system will meet the requirements of the product, as well as ensuring that future requirements can be addressed. The architecture step also addresses interfaces between the software system and other software products, as well as the underlying hardware or the host operating system.

Coding


Reducing a design to code may be the most obvious part of the software engineering job, but it is not necessarily the largest portion.

Testing


Testing of parts of software, especially where code by two different engineers must work together, falls to the software engineer.

Documentation


An important task is documenting the internal design of software for the purpose of future maintenance and enhancement. Documentation is most important for external interfaces.

Software Training and Support


A large percentage of software projects fail because the developers fail to realize that it doesn't matter how much time and planning a development team puts into creating software if nobody in an organization ends up using it. People are occasionally resistant to change and avoid venturing into an unfamiliar area, so as a part of the deployment phase, its very important to have training classes for the most enthusiastic software users (build excitement and confidence), shifting the training towards the neutral users intermixed with the avid supporters, and finally incorporate the rest of the organization into adopting the new software. Users will have lots of questions and software problems which leads to the next phase of Software.

Maintenance


Maintaining and enhancing software to cope with newly discovered problems or new requirements can take far more time than the initial development of the software. Not only may it be necessary to add code that does not fit the original design but just determining how software works at some point after it is completed may require significant effort by a software engineer. About 2/3 of all software engineering work is maintenance, but this statistic can be misleading. A small part of that is fixing bugs.

Process Models


There are several methodologies or models that can be used to guide the software development lifecycle. Some of these include:
--Linear or Waterfall Model
--Rapid Application Development (RAD)
--Joint Application Development (JAD)
--Prototyping Model
--Fountain Model
--Spiral Model
--Build and Fix
--Synchronize-and-Stabilize

Rapid Application Development


"Rapid Application Development (RAD) is an incremental software development process model that emphasizes a very short development cycle typically 60-90 days". The RAD approach encompasses the following phases:
1.Business Modeling
2.Data Modeling
3.Process Modeling
4.Application Generation
5.Testing and Turnover

Business Modeling


The information flow among business functions is modeled in am way that answers the following questions:
1.What information drives the business process?
2.What information is generated?
3.Who generates it?
4.Where does the information go?
5.Who processes it?

Data Modelling


The information flow defined as part of the business modeling phase is refined into a set of data objects that are needed to support the business. The characteristic of each object is identified and the relationship between these objects are defined.

Process Modelling


The data objects defined in the data-modeling phase are transformed to achieve the information flow necessary to implement a business function. Processing the descriptions are created for adding, modifying, deleting or retrieving data object.

Application Generation


RAD assumes the use of the RAD tools like VB,VC++,Delphi etc rather than creating
software using conventional third generation programming languages. The RAD works to reuse
existing program components or create reusable components. In all cases, automated tools are used to facilitate construction of the software.

Testing and Turnover


Since the RAD process emphasizes reuse, many of the program components have already been tested. This minimize the testing and development time.

Data Flow Diagrams Notations

DFD

Data Flow Diagrams

A data flow diagram is a graphical technique that depicts information flow and the transforms that are applied as data move from input to output. The data flow diagram is also known as 'data flow graph'. Various symbols are used to depict the data from one level to another level.
The data flow diagram must be used to represent the system or software at any level of abstraction. In fact data flow diagram may partitioned into the levels that represent increasing information flow for functional modeling as information on flow modeling. In doing so it satisfies the second operational analysis principle i.e., creating a functional model.

 


 

Notation
Logical data flow diagrams can be completed using only four simple notations, i.e. special symbols or icons and the annotation that associates them with a specific system the Yourdon approach is used.

1.DataFlow

Data move in a specific direction from an origin to a destination in the form of a document. The data flow is a "packet of data".


2.Process


People procedure or devices that use or produce data. The physical component is not identified.


3.Source or Destination

External sources or destinations of data interact with the system but are outside its boundary.


4.Data Store

Here data are stored or referenced by process in the system.


Structure of Software Requirements Specification Document

1. Introduction


 

1.1 Purpose of this document
Describes the purpose of the document, and the intended audience.

1.2 Scope of this document
Describes the scope of this requirements definition effort. Introduces the requirements elicitation team, including users, customers, system engineers, and developers.
This section also details any constraints that were placed upon the requirements elicitation process, such as schedules, costs, or the software engineering environment used to develop requirements.

 

1.3 Overview
Provides a brief overview of the product defined as a result of the requirements elicitation process.

1.4 Business Context
Provides an overview of the business organization sponsoring the development of this product. This overview should include the business's mission statement and its organizational objectives or goals.

2. General Description


 

2.1 Product Functions
Describes the general functionality of the product, which will be discussed in more detail below.

2.2 Similar System Information
Describes the relationship of this product with any other products. Specifies if this product is intended to be stand-alone, or else used as a component of a larger product. If the latter, this section discusses the relationship of this product to the larger product.

2.3 User Characteristics
Describes the features of the user community, including their expected expertise with software systems and the application domain.

2.4 User Problem Statement
This section describes the essential problem(s) currently confronted by the user community.

2.5 User Objectives
This section describes the set of objectives and requirements for the system from the user's perspective. It may include a "wish list" of desirable characteristics, along with more feasible solutions that are in line with the business objectives.

2.6 General Constraints
Lists general constraints placed upon the design team, including speed requirements, industry protocols, hardware platforms, and so forth.

3. Functional Requirements


This section lists the functional requirements in ranked order. Functional requirements describes the possible effects of a software system, in other words, what the system must accomplish. Other kinds of requirements (such as interface requirements, performance requirements, or reliability requirements) describe how the system accomplishes its functional requirements. Each functional requirement should be specified in a format similar to the following:

  1. Short, imperative sentence stating highest ranked functional requirement.

Description
A full description of the requirement.

Criticality
Describes how essential this requirement is to the overall system.

Technical issues
Describes any design or implementation issues involved in satisfying this requirement.

Cost and schedule
Describes the relative or absolute costs associated with this issue.

Risks
Describes the circumstances under which this requirement might not able to be satisfied, and what actions can be taken to reduce the probability of this occurrence.

Dependencies with other requirements
Describes interactions with other requirements.

... others as appropriate

b) <Name of second highest ranked requirement>
And so forth...

4. Interface Requirements


This section describes how the software interfaces with other software products or users for input or output. Examples of such interfaces include library routines, token streams, shared memory, data streams, and so forth.

4.1 User Interfaces
Describes how this product interfaces with the user.

4.1.1 GUI
Describes the graphical user interface if present. This section should include a set of screen dumps or mockups to illustrate user interface features.
If the system is menu-driven, a description of all menus and their components should be provided.

4.1.2 CLI
Describes the command-line interface if present. For each command, a description of all arguments and example values and invocations should be provided.

4.1.3 API
Describes the application programming interface, if present. For each public interface function, the name, arguments, return values, examples of invocation, and interactions with other functions should be provided.

4.1.4 Diagnostics or ROM
Describes how to obtain debugging information or other diagnostic data.

4.2 Hardware Interfaces
Describes interfaces to hardware devices.

4.3 Communications Interfaces
Describes network interfaces.

4.4 Software Interfaces
Describes any remaining software interfaces not included above.

5. Performance Requirements

Specifies speed and memory requirements.

6. Design Constraints


Specifies any constraints for the design team using this document.

6.1 Standards Compliance

6.2 Hardware Limitations
... others as appropriate

7. Other non-functional attributes


Specifies any other particular non-functional attributes required by the system. Examples are provided below.

7.1 Security
7.2 Binary Compatibility
7.3 Reliability
7.4 Maintainability
7.5 Portability
7.6 Extensibility
7.7 Reusability
7.8 Application Affinity/Compatibility
7.9 Resource Utilization
7.10 Serviceability
... others as appropriate

8. Preliminary Object-Oriented Domain Analysis


This section presents a list of the fundamental objects that must be modelled within the system to satisfy its requirements. The purpose is to provide an alternative, "structural" view on the requirements stated above and how they might be satisfied in the system.

8.1 Inheritance Relationships
This section should contain a set of graphs that illustrate the primary inheritance hierarchy (is-kind-of) for the system.

8.2 Class descriptions
This section presents a more detailed description of each class identified during the OO Domain Analysis.

Each class description should conform to the following structure:

8.2.1 <Class name>

8.2.1.1 Abstract or Concrete:
Indicates whether this class is abstract or concrete.

8.2.1.2 List of Superclasses:
Names all immediate superclasses.

8.2.1.3 List of Subclasses:
Names all immediate subclasses.

8.2.1.4 Purpose:
States the basic purpose of the class.

8.2.1.5 Collaborations:
Names each class with which this class must interact in order to accomplish its purpose, and how.

8.2.1.6 Attributes:
Lists each attribute (state variable) associated with each instance of this class, and indicates examples of possible values (or a range).

8.2.1.7 Operations:
Lists each operation that can be invoked upon instances of this class. For each operation, the arguments (and their type), the return value (and its type), and any side effects of the operation should be specified.

8.2.1.8 Constraints:
Lists any restrictions upon the general state or behavior of instances of this class.

9. Operational Scenarios


This section should describe a set of scenarios that illustrate, from the user's perspective, what will be experienced when utilizing the system under various situations.
In the article Inquiry-Based Requirements Analysis (IEEE Software, March 1994), scenarios are defined as follows:

In the broad sense, a scenario is simply a proposed specific use of the system. More specifically, a scenario is a description of one or more end-to-end transactions involving the required system and its environment. Scenarios can be documented in different ways, depending up on the level of detail needed. The simplest form is a use case, which consists merely of a short description with a number attached. More detailed forms are called scripts. These are usually represented as tables or diagrams and involved identifying an action and the agent (doer) of the action. FOr this reason, a script can also be called an action table.
Although scenarios are useful in acquiring and validating requirements, they are not themselves requirements, because the describe the system's behavior only in specific situations; a specification, on the other hand, describes what the system should do in general.

10. Preliminary Schedule


This section provides an initial version of the project plan, including the major tasks to be accomplished, their interdependencies, and their tentative start/stop dates. The plan also includes information on hardware, software, and wetware resource requirements.
The project plan should be accompanied by one or more PERT or GANTT charts.

11. Preliminary Budget


This section provides an initial budget for the project, itemized by cost factor.

12. Appendices


Specifies other useful information for understanding the requirements. All SRS documents should include at least the following two appendices:

12.1 Definitions, Acronyms, Abbreviations
Provides definitions of unfamiliar definitions, terms, and acronyms.

12.2 References
Provides complete citations to all documents and meetings referenced or used in the preparation of this document.

Thursday, March 13, 2008

Ajax An Overview

AJAX is a cross-platform technique that can be use on different operating system and web application based on JavaScript and DOM. It is a powerful approach of web application technique using client-side scripting to exchange data with the web server. This means that with AJAX, web pages increases interactivity and faster responsiveness of user interface by having an independent communication with the server. Gone are the traditional ways of web browsing whereby a new page communicates with each user's request. This creates dynamic web application user interface that renders effective usability of every desktop applications. AJAX primary purpose is to increase the web page's interactivity, speed, functionality, and usability.

Ajax, by definition, is not technology. In fact, it is an application of several technologies. Ajax incorporates several existing web application like XHTML and CSS for standard-based presentation; the Document Object Model for dynamic display and interaction; XML and XSLT for data interchange between the server and the client; the XMLHttpRequest to exchange asynchronous data with the web server; and the use of JavaScript as the core code for running AJAX application.

To understand AJAX, first we must know how the traditional web application works. The classic web interface trigger an HTTP request back to web server. The server then process and retrieve data before returning an HTML page to the users. This process as a model for hypertext medium makes technical sense. But as web application evolves this process does not make the user interface more interactive and practical.

AJAX, on the other hand, eliminates this problem. AJAX speed up the loading of any web application with the use of intermediary between the user and the server called AJAX engine. This adding of another layer application of eliminates the start-stop-start-stop nature on the web. The browser loads an AJAX engine at the start of session.

The AJAX engine allows the user interface and the application to interchange data asynchronously-independent of the communication to the server. So the interaction between the user and the web never slows down, no point of waiting for the server to do something.

AJAX is a powerful technique that grows exceedingly as web application. That is, AJAX is now part of the guiding principle as web 2.0 flourishes and become a practical reality. With the power of AJAX, many of the business and marketing web site are integrated with AJAX application server platform now. Most of the major products of Google such as Gmail, Google Maps, and Google Suggest are employing AJAX application. Other web services like the photo-sharing application Flickr, Amazon's A9.com, and the new Yahoo! maps depends on AJAX. The application of AJAX comes from simple function to the most complex program like Google Maps.

Thursday, March 6, 2008

How to use transaction in LINQ using C#

I looked in to the LINQ and found very interesting. LINQ generates DataContext class which provides classes and methods which is used in OR-Mapping. You can also use your own stored procedures and views with LINQ. You may require using transaction with your own Stored Procedures for Insert, Delete or updating operations.

System.Data.Common.DbTransaction class provides the Transaction object.

Lets start with new project, you can select new project from Start -> All Programs -> Microsoft Visual Studio 2008and click on Microsoft Visual Studio 2008. Create new Asp.net website. Right click on website from solution explorer and select LINQ to SQL classes from Add New Item.

This will generate dbml file in App_Code folder. Select the tables, views, stored procedures and function from server explorer and drag it on dbml file. DataContext class generates methods for each SPs, functions and views.


 

System.Data.Common.DbTransaction trans = null;

DataClassesDataContext objDataClass = new
DataClassesDataContext();

try
{


// Open the connection
objDataClass.Connection.Open();

// Begin the transaction
trans = objDataClass.Connection.BeginTransaction();

// Assign transaction to context class
// All the database operation perform by this object
//will now use transaction

objDataClass.Transaction = trans;

//Perform the Operations

///Insert

//Update

//Delete

}

catch (Exception ex)
{

// Rollback transaction
if (trans != null)
trans.Rollback();

}
finally
{

// Close the connection

if (objDataClass.Connection.State == ConnectionState.Open)

objDataClass.Connection.Close();

}


 

Fig - Code for Transaction in LINQ using C#