You are on page 1of 16

Trng i hc Cng nghip Tp HCM Khoa Khoa hc v K thut My tnh B mn Cng Ngh Phn Mm

Gii thiu m hnh 3-layer - DataBinding

Mc tiu
Phn bit 3-tier, 3-layer Phn bit c vai tr & trch nhim ca mi layer Qun l ngoi l trong m hnh 3-layer DataBinding

1-tier, 3-layer

Physical view

Logical view
GUI

Application + Data

Business logic Data Access

Data

2-tier, 3-layer

Physical view
Client tier

Logical view
GUI Business logic Data Access

Data Data tier


4

3-tier, 3-layer

Presentation tier
Local clients

Browsers

GUI

Physical view

Logical view

Web Server Application Web

Web Server

Business logic Data Access

Business tier

Data tier

Data
5

Vai tr ca cc layer
GUI (Presentation) Layer: Nhp liu v trnh by d liu, c th bao gm cc bc kim tra d liu trc khi gi Business Logic Layer. Business Logic Layer: Kim tra cc yu cu nghip v trc khi cp nht d liu, qun l cc Transaction, qun l cc concurrent access. Data Access Layer: Kt ni CSDL, tm kim, thm, xa, sa,trn CSDL

Cc lu quan trng
Phn bit vai tr Business Layer v khi nim x l Mi Layer vn c x l ring, c trng ca Layer i khi vic quyt nh 1 x l nm layer no ch mang tnh cht tng i

Vic trao i lin lc gia cc layer

GUI

Business logic

Data Access

Data Transfer Object (DTO) Data Cc gi tr, dng, bng

S ph thuc gia cc layer

GUI

Business logic

Data Transfer Object (DTO)

Data Access

Data

Tnh cht ca m hnh 3-layer


Gim s kt dnh gia cc thc th phn mm (decoupling) Ti s dng Chia s trch nhim

10

Qun l ngoi l

GUI Error messages


Errors while treating data input

GUI layer Error Handling

Business
Errors while treating in business layer

Thrown business exceptions Business Error Handling

Log

Database error codes Database


Database errors while executing

Database Error Handling (controlled by DBMS)

11

Qun l ngoi l
Ngoi l c th xy ra bt k layer no Khi ngoi l xy ra mt layer th: X l ni b trong layer Qung ngoi l ln layer cao hn Khng x l Khi mt layer nhn ngoi l t mt layer thp hn X l ni b Qung ngoi l ln layer cao hn Khng x l

12

DataBinding

DataSource l Object; hoc Object implement IList VD: DataSource c th l DataSet, DataView, User-Define Class
13

DataBinding DataFlow

14

Controlling DataBinding

15

Controlling DataBinding

16

You might also like