3 Tier Architecture

23

description

3 Tier Architecture

Transcript of 3 Tier Architecture

Page 1: 3 Tier Architecture
Page 2: 3 Tier Architecture

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd

Page 3: 3 Tier Architecture

3-Tier Architecture

Page 4: 3 Tier Architecture

3-Tier Architecture

Page 5: 3 Tier Architecture

1-Tier Architecture

Page 6: 3 Tier Architecture

1-Tier Architecture

• In 1-Tier Architecture the file you want to work with must be accessible from a local or shared drive

• This is the simplest of all the architectures, but also the least secure

• Since users have direct access to the files, they could accidentally modify, delete the file by accident or on purpose

• So 1-tier architecture is simple and cheap, but usually unsecured and data can easily be lost if you are not careful

Page 7: 3 Tier Architecture

2-Tier Architecture

Page 8: 3 Tier Architecture

2-Tier Architecture

• This architecture is also called Client-Server architecture because of the two components

• The client that runs the application and the server that handles the database back-end

• The client computer usually can’t see the database directly and can only access the data by starting the client

• This means that the data on the server is much more secure

• Now users are unable to change or delete data unless they have specific user rights to do so

Page 9: 3 Tier Architecture

2-Tier Architecture

• The client-server solution also allows multiple users to access the database at the same time

• One other huge benefit is that the server is processing data that allows the client to work on the presentation and business logic only

• This mean that the client and the server is sharing the workload and by scaling the server to be more powerful than the client

• you are usually able to load many clients to the server allowing more users to work on the system at the same time.

Page 10: 3 Tier Architecture

3-Tier Architecture

• This involves one more layer called the business logic tier, service tier or middle tier (layer)

• In the client-server solution the client was handling the business logic and that makes the client “thick”

• A thick client means that it requires heavy traffic with the server, thus making it difficult to use over slower network connections like Internet and Wireless

• This means that only little communication is needed between the client and the middle tier making the client “thin” or “thinner”

• An example of a thin client is an Internet browser that allows you to see and provide information fast and almost with no delay

Page 11: 3 Tier Architecture

3-Tier Architecture

• As more users access the system a three-tier solution is more scalable than the other solutions because you can add as many middle tiers (running on each own server) as needed to ensure good performance (N-tier or multiple-tier).

Page 12: 3 Tier Architecture

3-Tier Architecture

• Security is also the best in the three-tier architecture because the middle layer protects the database tier

• There is one major drawback to the N-tier architecture and that is that the additional tiers increase the complexity and cost of the installation

Page 13: 3 Tier Architecture

Differences among 1-Tier,2-Tier,3-Tier Architecture

1-Tier 2-Tier Multi-Tier

Benefits Very simpleInexpensiveNo server needed

Good securityMore scalable

Faster execution

Exceptional security Fastest

execution“Thin” clientVery scalable

Issues Poor securityMulti user issues

More costlyMore complex“Thick” client

Very costlyVery complex

Users Usually 1 (or a few)

2-100 50-2000 (+)

Page 14: 3 Tier Architecture

3-Tier ArchitectureUIfrom transferobj import tobj

from Blogic import Blogic

class gui:

def userip(self):

print 'enter the Airline code'

self.int_Airline_Code=raw_input()

print 'enter the Airline Name'

self.vchr_Airline_Name=raw_input()

print 'enter the Airline Numeric Code'

self.int_Airline_Numeric_Code=raw_input()

tob=tobj()

tob._init_(self.int_Airline_Code,self.vchr_Airline_Name,self.int_Airline_Numeric_Code)

b=Blogic()

b.getdata(tob)

Page 15: 3 Tier Architecture

3-Tier ArchitectureUI

def main():

g=gui()

g.userip()

main()

Page 16: 3 Tier Architecture

3-Tier ArchitectureLogic

from transferobj import tobj

from Database2 import Data

class Blogic:

def getdata(self,tob):

self.int_Airline_Code=tob.int_Airline_Code

self.vchr_Airline_Name=tob.vchr_Airline_Name

self.int_Airline_Numeric_Code=tob.int_Airline_Numeric_Code

obj3=Data()

obj3.getdetails(tob)

Page 17: 3 Tier Architecture

3-Tier ArchitectureDataBase

from transferobj import tobj

import psycopg2

import sys

#Define our connection string

conn_string = " dbname='firstdb'"

# print the connection string we will use to connect

print "Connecting to database\n ->%s" % (conn_string)

# get a connection, if a connect cannot be made an exception will be raised here

conn = psycopg2.connect(conn_string)

# conn.cursor will return a cursor object, you can use this cursor to perform queries

cursor = conn.cursor()

print "Connected!\n"

Page 18: 3 Tier Architecture

3-Tier ArchitectureDataBase

class Data:

def getdetails(self,tob):

self.int_Airline_Code=tob.int_Airline_Code

self.vchr_Airline_Name=tob.vchr_Airline_Name

self.int_Airline_Numeric_Code=tob.int_Airline_Numeric_Code

cursor.execute("insert into tbl_Airlines values(%s,%s,%s)",(self.int_Airline_Code,self.vchr_Airline_Name,self.int_Airline_Numeric_Code))

cursor.execute("select * from tbl_Airlines");

result=cursor.fetchall()

print result

conn.commit()

Page 19: 3 Tier Architecture
Page 20: 3 Tier Architecture
Page 21: 3 Tier Architecture

Reference http://blog.simcrest.com/what-is-3-tier-architecture-and-why-do-you-need-it

http://www.c-sharpcorner.com/uploadfile/gowth/two-tier-and-three-tier-architecture-with-example/

Page 22: 3 Tier Architecture

If this presentation helped you, please visit our page facebook.com/baabtra and like it.

Thanks in advance.

www.baabtra.com | www.massbaab.com |www.baabte.com

Page 23: 3 Tier Architecture

Contact Us