Search This Blog

Saturday, September 6, 2008

Three-tier architecture

The 3-Tier architecture has the following three tiers:
Presentation Tier
This is the topmost level of the application. The presentation tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents. It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network.
Application Tier (Business Logic/Logic Tier)
The logic tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing.
Data Tier
This tier consists of Database Servers. Here information is stored and retrieved. This tier keeps data neutral and independent from application servers or business logic. Giving data its own tier also improves scalability and performance.
Comparison with the MVC architecture
At first glance, the three tiers may seem similar to the Model-view-controller (MVC) concept; however, topologically they are different. A fundamental rule in a three-tier architecture is the client tier never communicates directly with the data tier; in a three-tier model all communication must pass through the middleware tier. Conceptually the three-tier architecture is linear. However, the MVC architecture is triangular: the View sends updates to the Controller, the Controller updates the Model, and the View gets updated directly from the Model.

Monday, August 25, 2008

File Read

using System;
using System.IO;

class FileRead

{

string filereadbuf; // buffer to store the content of file

public void ReadFile(string FileName, int FileSize)

{

char[] buf = new char[FileSize];

// lets define an array of type char field (i.e. variable) buf // for more help please see .net sdk StreamReader sr = new StreamReader(new FileStream(FileName, FileMode.Open, FileAccess.Read));

int retval = sr.ReadBlock(buf, 0, FileSize);

// no. of bytes read

Console.Write ("Total Bytes Read = " + retval + "\n");

filereadbuf = new string(buf);

// store it in our field

Console.WriteLine (filereadbuf);

// lets print on screen

sr.Close();

}

}