Sunday, December 23, 2012

3 Layer vs 3 Tier Architecture | Difference Between 3 Layer and 3 Tier Architecture

Before moving to understand what is difference between 3 Tier Architecture and 3 Layer architecture lets have an overview about what is Tier and What is Layer ???
The layers reside on the same machine where the tiers can reside on different machines.
Layer communicates with each other either by Value or by Reference. However the Tiers could be on different machines, so they communicate by Value only – as serialized objects.
Layer is logical separation of code and Tier is physical separation of code, In other words we can say Tiers are the physical deployment of layers. Or a Tier becomes a  Layer if it could be physically separated from the Layers it consumes.
N-Tier Architecture is a physical structuring, while a N-Layer Architecture is a logical structuring.
Now coming to 3 Layer Architecture and 3 Tier Architecture after getting an idea about Layer and Tier.
In 3 layer architecture, the Database Access Layer (DAL)Business Logic Layer (BLL) and User Interface Layer (UIL) resides as 3 different project and the output of these 3 projects (.dll file) must be together in the same server or on same machinein order for the system to run.However in 3 tier architecture, the Database Access Layer (DAL)Business Logic Layer (BLL) and User Interface Layer (UIL) reside as 3 different projects. But each of the projects can be deployed at the different server or at the different machines and distributed functionality is explored.
In 3 layer architecture DAL, BLL and UIL can work on same machine where as in a 3 Tier architecture a client in on one machine, the application Server is hosted in another machine and the database server resides in another machine i.e. Three-tieris a client–server architecture in which the User InterfaceBusiness Logic , Data Storage and Data Access are developed and maintained as independent modules on separate platforms.
In 3 Layer we have distinct namespaces and classes for the various layes i.e. we’re only talking about logical organization of code and passing objects between layers is easy as all assemblies will run under same application in single machine.But 3 tier applications are not straight as 3 layers, because each layer will be deployed in different machines. So here, we need a mechanism to send the objects between different machines over the network hence we use technologies called Web ServicesRemoting or WCF, etc. in order to implement 3 tier applications
3 Layer Architecture will improve readability and reusability, Minimizes the application changes due to impact of the changes in other layers. While 3 Tier Architecture has all advantages of 3 layer + scalability as application will be deployed in different machines so load will be shared among the tiers and scalability will increase

Thursday, February 9, 2012

Real time Examples of oops fundamental

Oops! What an excellent concept. Nowadays in software filed any latest language has implemented, it should be partially are fully supported this oops concept. OOPs, let c with real time examples.Six important factors are using this concept are,

  1. Class, 2.Objects, 3.Abstractions, 4.Encapsulation, 5.Polymorphism, and 6.Inheritance.

1. Car Vs Class

Car: Collection of several properties like staring, break, clutch, etc each things are used for particular purpose, all these properties are differ from each car like some car have power staring ,however we have called it’s a car.

Class: it’s a collection of functions and variables. The functions and variables are differing from each class. Each function is used for particular purpose however we have called it’s a class

2. Car Key Vs Object

Car Key: key is used for run the car. So many dummy keys can use for run a car.

Object: Object is used for run the class or invokes the class. So many objects can create for a single class.

3. Birds Vs Abstractions

Birds: we invented flight based on the mechanism of Birds. So flight is derived form the base of birds.

Abstraction: Abstraction is a way to remove the association of the behavior of an object with the actual details behind the scenes which implement that object's behavior. This 'abstraction' is usually accomplished through the use of base classes with virtual functions; each derived function provides the details that implement the behavior behind that abstraction.

4. Pen Vs Encapsulation

Pen: Ink is the important component in pen but it is hiding by some other material

Encapsulation: is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.

5. Crocodile Vs Polymorphism

Crocodile: live indifferently on land or in the water. In water it’s Moment very fast compare to land. An animal lives in different character in different place.

Polymorphism: a single function or single operator has different character in different place.

6. Human heredity Vs Inheritance

Human heredity:The genetic transmission of characteristics from parent to offspring. The sum of characteristics and associated potentialities transmitted genetically to an individual organism

Inheritance: The new classes, known as derived classes, take over (or inherit) attribute and behavior of the pre-existing classes, which are referred to as base classes(or Parent classes). It is intended to help reuse existing code with little or no modification.

Saturday, February 13, 2010


The Global.asx file is an optional file that contains code for responding to application level events raised by ASP.NET. This file is also called as ASP.NET application file. This file resides in the root directory of anapplication. If we are not defining this file in application, the ASP.NET page framework assumes that you have not defined any applicationa/Session events in the application.

Followign are the list of events handled in the global.asax file.

Event: Application_Start

When an application starts. This event occurs only one time in an application’s life cycle. It occurs again when you restart the application. It’s the best place to count number of visitors.

Event: Application_End

This event occurs when application ends.

Event: Session_Start

This event occurs whenever a new session starts. This is the best place to count user sessions for anapplication

Practical Usage: Setting user specific values, caching items based upon user context.

Event: Session_End

This event Opposite of the previous event.

Event: Application_Error

This event occurs when an unhandled error or exception occurs in an application.

Event: Application_BeginRequest

This event occurs every time when server makes a request. This event may occur multiple times in an applications life cycle.

Event: Application_End

This event occurs when an application closes

Friday, November 20, 2009

Change the Background Row Color of the GridView control using MouseEvents

By using this Article you can learn how to change BackGround Color of a Row in Gridview when user moves mouse on a particular selecting Row.

First Drag and Drop one Gridview Control on a webpage.After Retriving the data in a gridvew select your gridview and choose Events.In Events DoubleClik on RowDataBound.

after DoubleCliking on RowDataBound Event you will get a code in .aspx.cs as Below:

protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)


if (e.Row.RowType == DataControlRowType.DataRow)


e.Row.Attributes.Add("onmouseover", "'Silver'");

e.Row.Attributes.Add("onmouseout", "'green'");



How To change the address bar icon of your website

This is Basically use to change the address bar icon of your website. steps for this.
Steps to Change Address Bar Icon:
(1) Create fevicon.ico file.
(2) Add these lines in the head tag of the page. if you have master page then add these lines in master page.
< rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
< rel="icon" type="image/x-icon" href="/favicon.ico">
(3) we are adding second line:
because for some browsers with the first line only it does not display your customize icon.

How to logoff,reboot,shutdown machine using javascrpt code

function Shutdown()
var ws = new ActiveXObject("WScript.Shell");
ws.Exec("shutdown.exe -s -t 30 ");

just call above function whenever required.

-s: used for shut down
-t:time limitIn above code time limit is 30 second.It will show alert for 30 second that your machine is shutting down .use -l instead of -s for log off and use -r for reboot

Note :The “Initialize and Script ActiveX controls not marked as safe” option should be selected as “Enable”.Goto Tool Menu in browser ->Internet Option ->Security -> select Local intranet -> Click Custom Level ->go to "Initialize and Script ActiveX controls not marked as safe" and mark as enable. Do this otherwise it will show error automation server canot create object.