Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
3-Tier Architecture
3-Tier Architecture
1-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
2-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
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.
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
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).
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
Differences among 1-Tier,2-Tier,3-Tier Architecture


           1-Tier             2-Tier          Multi-Tier
Benefits      Very simple Good security     Exceptional
             Inexpensive   More scalable security Fastest
              No server   Faster execution execution
               needed                      “Thin” client
                                           Very scalable

 Issues     Poor security     More costly       Very costly
           Multi user issues More complex      Very complex
                             “Thick” client

 Users      Usually 1 (or a        2-100        50-2000 (+)
                few)
3-Tier Architecture
from transferobj import tobj                UI
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)
3-Tier Architecture
                      UI
def main():
 g=gui()
 g.userip()



main()
3-Tier Architecture
                            Logic
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)
3-Tier Architecture
                                    DataBase
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 databasen ->%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"
3-Tier Architecture
                                   DataBase
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()
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/
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
Contact Us

3 Tier Architecture

  • 2.
    Disclaimer: This presentationis prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3.
  • 4.
  • 5.
  • 6.
    1-Tier Architecture • In1-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
  • 7.
  • 8.
    2-Tier Architecture • Thisarchitecture 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
  • 9.
    2-Tier Architecture • Theclient-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.
  • 10.
    3-Tier Architecture • Thisinvolves 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
  • 11.
    3-Tier Architecture • Asmore 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).
  • 12.
    3-Tier Architecture • Securityis 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
  • 13.
    Differences among 1-Tier,2-Tier,3-TierArchitecture 1-Tier 2-Tier Multi-Tier Benefits Very simple Good security Exceptional Inexpensive More scalable security Fastest No server Faster execution execution needed “Thin” client Very scalable Issues Poor security More costly Very costly Multi user issues More complex Very complex “Thick” client Users Usually 1 (or a 2-100 50-2000 (+) few)
  • 14.
    3-Tier Architecture from transferobjimport tobj UI 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)
  • 15.
    3-Tier Architecture UI def main(): g=gui() g.userip() main()
  • 16.
    3-Tier Architecture Logic 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)
  • 17.
    3-Tier Architecture DataBase 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 databasen ->%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"
  • 18.
    3-Tier Architecture DataBase 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()
  • 21.
    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/
  • 22.
    If this presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 23.