You are on page 1of 259

Bi Ging

Cng Ngh Phn Mm


Software Engineering

Gio vin & Giao tip g ging g dy


ThS Nguyn Cao Tr caotri@hcmut.edu.vn http://www.cse.hcmut.edu.vn/~caotri Room 109 A5 Trung tm K thut in ton Tel: 8647256 5370 Mobile: 091 391 6290 Hobbies: Automation , Flying Model http://www.rc-easy.net

Ti liu download trn website file: file: TailieudientuCNPMTailieudientuCNPMPrintableVersion. PrintableVersion .ppt Hc th no? Hi ngay trn lp Bng m s dng l Unicode dng sn Cc bi tp np bng email, dng file *.ZIP Email phi ghi r ni dung file nh km l g bng ting Vit
Trng i Hc Bch Khoa - Khoa Cng Ngh Thng Tin
Copyright 2004 Th.S Nguyn Cao Tr caotri@hcmut.edu.vn

Gii thiu mn hc
Ni dung mn hc Gii thiu cc khi nim c bn v cng ngh phn mm Mc tiu ca sn xut phn mm v cng ngh phn mm Cc m hnh sn xut phn mm Quy trnh sn xut v qun l d n phn mm Ti liu tham kho Introduction to Software Engineering Ronald J. Leach CRC Press ess ( (Th v vin A2 MS: S: 907580 9075802004) 00 ) Software Engineering Ian Sommerville Fifth edition (Th vin A3
MS: 200032)

Hnh thc kim tra Gia k + Cui k + Bi tp Hnh thc kim tra: trc nghim khch quan open book nh gi kt qu: tng i - phi tuyn
Trng i Hc Bch Khoa - Khoa Cng Ngh Thng Tin
Copyright 2004 Th.S Nguyn Cao Tr caotri@hcmut.edu.vn

???????? & !!!!!!!!


Cng Cng Cng Cng Nghip & Cng Ngh Nghip Phn Mm (CNpPM) Ngh Phn Mm (CNPM) nghip phn mm & cc cng nghip khc

Ging Khc

C hay khng (nhng) cng ngh cho sn xut phn mm? C cn thit phi c cng ngh cho sn xut phn mm khng, khi sn xut phn mm l hot ng sn xut c bit v khng th ni lm mt phn mm nh sn xut mt lon coca. coca.
Trng i Hc Bch Khoa - Khoa Cng Ngh Thng Tin
Copyright 2004 Th.S Nguyn Cao Tr caotri@hcmut.edu.vn

c tnh ca sn p phm p phn mm


Software = Program Software product = Program + Document + Support Loi sn phm phn mm
Generic Product: l sn phNm ng gi v bn rng ri trn th trng. Bespoke B k P Product d t: l sn ph hNm c pht ht tri t in theo th yu cu c th ca tng khch hng.

Cc c tnh quan trng ca sn phm phn mm


M Maintainability i i bili : ph hn mm c th h thay h i thu h n ti in theo h yu cu ca ngi dng Dependability: tnh n nh, bo mt v an ton ca phn mm. Khng gy tn hi v vt cht hay kinh th cho h thng. ng Efficiency: S dng hiu qu ti nguyn ca h thng cho cng vic Usability: giao din v phng thc phi ph hp vi ngi dng ng thi p ng ng yu cu ca ngi dng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Software - hay y Thiu?


Phn mm c vit ngay t khi c nhng my tnh programable u tin. tin . c quan tm v pht trin t rt sm C rt nhiu phn mm c vit Khng thiu phn mm Thc t vic sn xut p phn mm khng g p p ng g kp y yu cu ca ngi s dng: ng:
Khng v s lng Thiu v cht lng Khng kp v thi gian

Phn mm khng p ng cho ngi dng


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Nguyn g y nhn khch quan q


S lng phn mm phi c hiu l s u/loi phn mm c s dng cho tng mc tiu ng dng ng. . Nhu cu s dng phn mm l rt ln
Nhiu ngnh ngh cn dng phn mm my tnh Mi ngnh ngh cn nhiu loi phn mm khc nhau Mi loi phn mm cn nhiu cp khc nhau theo trnh ngi dng

Cht lng phn mm cng cha p ng tt hon ton ngi s dng ng: :
Tnh customize rt cao ca sn phm phn mm. Trnh s dng khc nhau v iu kin h tng ng dng khc nhau

Nhu cu phn mm thng rt cp bch


Tm nhn v chin lc cha u ca ngi s dng Khng c k hoch lu di Phi thay i theo tng i tng ngi dng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Nguyn g y nhn ch quan q


Tnh chuyn nghip trong sn xut phn mm cha cao Cc d liu quan st c
C 6 n trin khai th c 2 b hu b Trung bnh thi gian thc hin thc t b ko di 50 % (c bit 200300%) Cc n ln d tht bi 3/4 cc h thng ln c li khi thc thi Qu trnh phn tch yu cu (5 % cng sc): li 55 % li, c 18 % pht hin c Qu trnh thit k (25 % cng sc): li 30 % li, c 10 % pht hin c Qu trnh m ho, kim tra v bo tr: li 15 % li, c 72 % pht hin c
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Nguyn g y nhn ch quan q ( (tt) )


L do ca nhng h qu trn
Pht trin phn mm ging nh mt ngh thut, cha c xem nh mt ngnh khoa hc Quy trnh pht trin phn mm cha c thng nht Phi vi it li s/w / mi khi c s thay th i v ngn ng, h/w h/ ho h c o/s / Cha t c 1 chun cho vic o lng hiu sut v sn phm phc tp ca phn mm qu cao i vi 1 kin trc s K thut c t li s nhp nhng trong cc yu cu phn mm Lm vic nhm khng ng k lut gy ra cc li CN PHI C MT/NHIU CHUN QUY TRNH TRONG SN XUT PHN MM NNG CAO TNH CHUYN NGHIP CA NN SN XUT C BIT NY CN CNG NGH CHO CNG NGHIP PHN MM
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

nh ngh g a Cng g ngh g p phn mm


Cng Ngh Phn Mm l s thit lp v s dng cc nguyn tc khoa hc nhm mc ch to ra cc phn mm mt cch kinh t m cc phn mm hot ng hiu q qu v tin cy trn cc my y tnh tnh. . Cng ngh phn mm l mt quy trnh c h thng c s dng trong qu trnh phn tch, thit k, hin thc, kim tra v bo tr bo m cc sn phm phn mm c sn xut v hot ng: ng: hiu qu, tin cy, hu dng, nng cp d dng (modificable), kh chuyn (portable), kh kim tra (testable), cng tc c vi cc h thng khc (interoperable) v vn hnh ng (correct) (correct). .
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

10

C th
Efficiency: Efficiency: Phn mm c sn xut trong thi gian v iu kin va phi. i. Phn
mm vn hnh ng mc yu cu v cng vic v thi gian. gian.

Reliablity: Reliablity: Phn mm vn hnh n nh v tng tc c vi cc h thng ng


dng

Usability Usability: : Phn mm c th dng c bi ngi s dng v vi mi trng m


ngi s dng ang c. c. Ch ti giao din, iu kin h thng, ng,

Modifiability: Modifiability: Phn mm c th c thay i d dng, nhanh chng khi yu cu


ca ngi s dng thay i. i.

Portability: Portability: Phn mm c th chuyn i d dng sang cc h thng khc m khng


cn phi iu chnh ln. n. Ch cn recompile nu cn thit l tt nht. t.

Testability Testability: : Phn mmc th d0c kim tra t d dng d dng. . Tt nh ht l c modul d l ha h . ha. Reusability: Reusability: Phn mm hay mt phn c th c ti s dng cho cc ng dng
khc. Cc modul c thit k tt, c lp v giao tin n gin, c v tnh tng thch khc. cng ngh pht trin
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

11

C th ( (tt) )
Maintainability: Maintainability: thit k ca phn mm c th c hiu d dng cng nh chuyn
giao i thu th n tin cho h ngi khc kh trong t qu trnh t h iu ch hnh, h nng cp hay h thay th i theo th yu cu. u.

Interoperability: Interoperability: Phn mm vn hnh n nh v ng nh mong i. i. Trn h


thng nhiu ngi dng (multi users) phn mm vn hot ng c vi cc vn hnh khc ca h thng. ng.

Correctness: Correctness: Phn mm phi tnh ton ng v to ra kt qu ng v ng vi


mc tiu ng dng ca ngi dng dng. .

Cc yu cu khc: khc:
ng tin S dng hp l ngun nhn lc pht trin Chi ph pht trin thp nht

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

12

Ni dung g cng g vic ca Software Engineering g g


Cng vic ca software engineering bao gm: Phn tch h thng/vn Xc nh cc yu cu Thit k phn mm Vit phn mm (coding) Kim tra v tch hp h thng Ci t v chuyn giao ph hn mm Lp ti liu Bo tr
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Qun l cht lng Hun luy yn D on ti nguyn Qun tr d n

13

Mt nh ngh g a khc ca CNPM


CNPM l cc quy trnh ng k lut v c nh lng c dng cho s pht p trin, thc thi v bo tr cc h thng thin v phn mm Tp trung vo quy trnh trnh, , s o lng, ng, sn phm, m, tnh ng thi gian v cht lng

Qui trnh

o lng Ti chu Tiu h n

Thi gian Qun l

Cht lng Dch v


14

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

M hnh p pht trin p phn mm


Cc cng on chnh tng qut bao gm 4 giai on Giai on c t: xc nh cc tnh nng v iu kin hot ng ca h thng. ng. (thu thp yu cu v phn tch) Giai on pht trin: n: Thit k phn mm (software design), g ), vit code ( (code g generation Giai on kim tra: tra: kim tra phn mm (software testing), kim tra tnh hp l ca phn mm. m. Giai on bo tr tr: : Sa li (correction), ( ) thay h i mi tr ng thc thi (adaptation), tng cng (enhancement)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

15

Cc m hnh sn xut p phn mm


Ty theo quy m v cng ngh pht trin, c cc m hnh sn xut khc nhau nhau. . M hnh tun t tuyn tnhtnh- waterfall M hnh Prototyping - Evolutionary Development M hnh xon c Boehms Spiral Model M hnh RAD Rapid Application Development M HNH NO TT HN Mi m hnh ph hp vi trnh pht trin, quy m sn phm v yu cu rng buc c th v thi gian v tnh cht ca h thng. ng.
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

16

M hnh WaterFall Sequency q y model


M hnh pht trin phn mm u tin Cc cng vic tip ni nhau mt cch tun t t nn mng cho cc phng php phn tch, thit k, kim tra tra
Phn tch yu cu Thit k h thng g & phn mm Hin thc v kim tra moduls Tch T h hp v kim tra tng th Chuyn giao v Bo tr

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

17

M hnh WaterFall Sequency q y model ( (tt) )


Bc l mt s khuyt im Bn cht ca pht trin phn mm l qu trnh lp i lp li ch khng phi tun t Cc bc thc cht khng g tch bit hon ton m c chng ln v tham kho li Bt buc khch hng c t tt c yu cu mt cch chnh xc v y ngay t ban u Khch hng thng phi ch i rt lu thy c phin bn u tin ca sn phm Tn ti delay d l tch h ly trong nhm h lm l vic -> d n thng b tr. ph hp cho d n nh, n g gin. n. Ch p
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

18

M Hnh Prototype yp
Hot ng sn xut Bn prototype

c t

M t s lc ca kh khch h h hng

Pht trin

Cc bn trung gian

Kim th

Bn cui cng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

19

M Hnh Prototype yp u & khuy yt


Prototype nh l mt c ch nhn din chnh xc yu cu ca khch hng
Bn thn khch hng cha hiu r yu cu ca mnh, cng nh cc quy trnh cha c xc lp r rng. Khch hng cha hiu r kh nng h tr ca h thng my tnh

Kch thch s thch th ca ngi dng vi d n Prototype c th b throw throw-away -> Lng ph Cc process khng c phn nh r rng H thng g thng g thng g c cu trc lng g lo Cn c nhng k nng c bit trong qun l v pht trin Khch hng hi thc nh pht trin hon thnh sn phm mt khi thy c cc prototype u tin
20

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

M Hnh Prototype yp ng g dng g

Dng cho cc h thng nh. Cc chi ph khi thay i h thng l khng qu ln khia cn phi thay i sau khi thc hi prototype Cn s cp bch v thi g gian trin khai ng gn. n. H thng g cn c a vo ng dng tng phn trong khong thi gian nht nh. nh. Trong trng hp nhng h thng m vic c t cc yu cu l rt kh v khng r rng ngay t u. u.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

21

M hnh Xon c - Boehms Spiral p Model


Xc nh cng vic nh gi ri ro

Hoch nh ti

Pht trin sn phm

c thc hin theo mt chui lp kiu xon c, mi ln lp ci thin sn phm C phng php nh gi ri ro C th p dng prototype Mi ln lp c ci thin cho thch nghi vi bn cht ca n
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

22

M hnh RAD
Business modeling Data modeling Process modeling Application generation Testing & Turnover

Rapid Application Development l m hnh tun t tuyn tnh c thi gian pht trin rt ngn S dng cc thnh phn c sn cng nhiu cng tt S dng g cng g c lp trnh dng g t ng g sinh m ch khng phi cc ngn ng truyn thng Ph thu h c vo cng ngh h pht h tri in c tnh h reusable bl cao cao. . Partten system development

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

23

Cc tiu chun dng g trong g CNpPM p


The capability Maturity Model (CMM) ca Software Engineering Institue (SEI) i hc Carnegie Mellon Mellon. .

Ch trng n tnh h thng v kh nng qun tr ca cc cng ty phn mm hn l mt quy trnh (process) c th.

The process Improvement Paradigm (PIP) ca Software Engineering


Laboratory (SEL) NASAs Goddard Space Flight Center

Tng t nh CMM, ch trng n tnh h thng v nhng hng dn tng cng tnh nng ca cc qu trnh qun l.

Cc chun khc ca Department of Defense


MIL STD 2167A ; MIL-STD 1574A ; MIL-STD 882C

The electronic Industries Association (EIA) chun SEB SEB-6 -A The European ESPRIT project International Standards Organisation - ISO 9001 United Kingdom MOD 0055
24

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Chun CMM
Continuous Improvement Cc h thng quality control v qualify c s dng hiu qu

Optimized (Level 5) Managed (Level 4)

Risk

C kh nng d on (Predictability) Cc quy trnh qun l v tiu chun c chi hi ti it ha h

Defined (Level 3) Repeatable (Level 2) Initial (Level 1)


Largely Ad-hoc Ph thuc vo c nhn

Xc lp cc tiu chun qun l Cc vn documentation xc lp

Competiti iveness

Bt u c kh nng qun l Qun l da vo kinh nghim tng t

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

25

Project Management

Chng 2

Sub-Team trong Software Projects Project P j t Estimation E ti ti Project Scheduling Project Management Tools

Ti sao cn Project management


Pht trin phn mm hin i lm theo teamworks Cn qun l v kim sot c ri ro (Risk) trong qu trnh sn xut Cc d n phn mm i hi nhiu ngun nhn lc vi chuyn mn khc kh nhau h Tnh tch hp cng ngh cao v s thay i nhanh chng ca cng ngh Phi bo m tnh t h chuyn h nghi hip trong t pht ht tri t in d n ph hn mm:
Bo m lch trnh ca d n iu phi v khai thc ti a ngun nhn lc hin c Bo m cht lng ca sn phNm Kh nng khc phc cc s c xy ra khch quan

Cc d n cng ln cng cn c s qun l cht ch v ng b


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

27

SUB-Team SUB Team trong software engineering


Teamwork l m hnh hin ti cho hu ht cc d n phn mm:
Kh nng chuyn nghip ha cao Hiu qu trong qun l, giao tip v iu hnh Cng ty phn mm Project 1
Team 6 Team 1 Team 4 Team 5 Team 2 Team 3

Mt software p project j team c to ra t nhiu subteams


Cc sub-team khng nht thit l mt nhm ngi m c th l 1 ngi Cc sub-team khng nht thit tn ti sut qu trnh ca mt d n ph hn mm

Project 2

Project 3

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

28

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

Vai tr nhim v ca cc SUB Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

29

Vai tr & nhim v cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Xc nh tnh kh thi ca d n Phn tch chi ph (Cost analysis) D on li nhn (Estimate revenues) Tin liu cc kh khn v k thu th t v cng ngh Sau khi nghin cu kh thi, nhm ny s lm vic vi Requirement Team nhn feedbacks Nu d n c pht trin theo m hnh tng tc cao nh Prototype/Spiral model th tnh tng tc v feedback l rt quan trng k c vi cc nhm khc.

System Analysis

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

30

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Planning Team

Nhm ny c nhim v xy dng tng th tt c cc k hoch qun tr d n v bo m cc tin trnh din ra ng tin nh Xy dng cc k hoch thc hin Lp cc time frame cho cc tin trnh K hoch s dng ti nguyn ca h thng bao gm c nhn lc Cc k hoch d phng v iu chnh khi c s c

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

31

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Tip xc khch hng v xc nh y , hon chnh v chnh xc cc yu cu cho d n Dng cc phng thc gp g chnh thc v bn l xc nh cc yu cu ca h thng Nu khng c khch hng, c th tip xc vi cc user tim nng Sau khi xc nh cc yu cu, nhm ny s lm vic vi System Design Team nhn cc feedback. Nu d n c pht trin theo m hnh tng tc cao nh Prototype/Spiral model th tnh tng tc v feedback l rt quan trng k c vi cc nhm khc

Requirement Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

32

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Xy dng thit k chi tit ca h thng sau khi cc yu cu c xc nh. Nu s dng m hnh Waterfall, Waterfall nhm ny phi feedback cho nhm Requirement nhng kh khn nu c. Sau khi hon chnh thit k, nhm ny phi cng tc vi Implementation Team nhn feedback. Nu d n c pht trin theo m hnh tng tc cao nh Prototype/Spiral model th tnh tng tc v feedback l rt quan trng k c vi cc nhm khc

System Design Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

33

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I Implementation l t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Pht trin h thng theo thit k c. Coding Kim tra cp Module d l Sau khi hon tt chng trnh, nhm ny s cng tc vi nhm Tesing & Integration kim tra cc module d l Nu d n c pht trin theo m hnh tng tc cao nh Prototype/Spiral model th tnh tng tc v feedback f db k l rt quan trng k c vi cc nhm khc

I Implementation l t ti Team T

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

34

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Xy dng thit k chi tit ca h thng sau khi cc yu cu c xc nh. Nu s dng m hnh Waterfall, nhm ny phi feedback cho nhm Requirement nh hng kh khn nu c. Sau khi hon chnh thit k, nhm ny phi cng tc vi Implementation Team nhn feedback. Nhm ny y c t th t tip nhn cc module odu e ri rc v kim tra sau tch hp thnh h thng hon chnh. Nu d n c pht trin theo m hnh tng tc cao nh Prototype/Spiral model th tnh tng tc v feedback l rt quan trng k c vi cc nhm khc Nhm ny cng c vai tr trong Interface Control Document c t cc giao din v giao tip gia cc thnh phn trong h thng

Testing & Integration Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

35

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

Trainning g Team Chun b cc cng c v ti liu cho vic trainning cho ngi dng K hoch trainning Cc ti liu ging dy

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

36

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

Nhim v l ci t h thng cho khch hng v cc h tr k thut trong ci t vn hnh h thng.

Delivery & Installation Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

37

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

Maintenance Team g sau khi chuyn Bo tr h thng giao v ci t Cp nht sa cha Nng cp m rng Cng tc cht ch vi nhm implementation thc hin vic maintenance

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

38

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Nhm ny c 2 nhim v 1. Thit lp cc tiu chun cho cc qu trnh sn xut cng nh tiu chun thc hin ca sn phm phn mm 2. Cung cp cc c ch kim tra, kim sot nhm nh gi kh nng tha mn cc tiu chun tng ng ca cc nhm lm vic. Cc tiu chun ny dng trong ni b v khng chia s vi khch hng. Cc tiu chun c th c cng b khi cn thit, v vy cn c lu tr v bo co cho project manager hot ng vi b phn Q&A

Quality Assurance Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

39

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering
Lu tr cc thng tin thng k v cc hot ng ca cc TEAm trong d n. S lng cc yu cu maintenance S lng thc hin dch v maintenance S dng code c vit Thi gian thc hin tng cng vic Nhm ny lm vic vi hu ht cc nhm cung cp bo co v cht lng, hiu qu, ng thi feedback cho cc nhm v hiu qu cng vic.

Metrics Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

40

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

Documentation Team Nhm ny thc hin cc hot ng thit lp cc ti liu cho h thng Ti liu v phn tch, thit k , hin thc, source code code,.. Ti liu h tr : userguide, manual, support document

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

41

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Team Reuse & Reengineering

System Administrationm Team Nhm ny c nhim v cung cp v bo m cc hot ng g ca cc h thng h tng k thut cn thit cho d n Nhm ny thng thng bao gm c Network Administration Team

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

42

Cc Sub-Team Sub Team


System analysis Planning Team Requirements Team System Design Team I l Implementation t ti Team T Tesing & Intergration Team Training Team Delivery & Installation Team Maintenance Team Quality Assurance Team Metrics Team Documentation Team System Administration Team g g Reuse & Reengineering Team

Reuse & Reengineering Team Ch hn la v quyt nh h vic reuse cc module c Vic reengineering cng cn thit khi m vic pht trin i hi phi dng n cc code c khi cng ngh thay i.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

43

Sub-Team Sub Team (tt)


C rt nhiu vic qun l trong tng nhm v tng cng on. C kh nhiu nhm -> nhiu manager, tuy nhin nu cc nhm h ny nh h th th ng l mt ng i trong t nhm h s l manager ca team. Vic scheduling gia cc team ph thuc vo m hnh pht trin c th l g. V d nu dng m hnh Waterfall th cc cng on c th h c tch h hp thnh h h cc b c ln hn, cc nhm h tham gia vo tng bc theo chc nng ca mnh.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

44

Cc nhm trong m hnh Waterfall


SPECIFICATION: Planning, System Analysis, QA, Metrics, Documentation, System Administration, Reuse & Reengineering DESIGN: QA QA, Metrics, Metrics Documentation, Documentation System Administration, Administration Reuse & Reengineering CODE:QA, :QA Metrics, Metrics Documentation, Documentation System Administration, Administration Reuse & Reengineering TESTING & INTEGRATION: QA, Metrics, Documentation, System Administration, Reuse & Reengineering MAINTENANCE: Trainning, Trainning Delivery & Instalation,QA, Instalation QA Metrics, Metrics Documentation, System Administration, Reuse & Reengineering
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

45

Cc nhn s khc trong d n


Bn cnh cn c mt s nhn s khc tham gia vo qu trnh pht trin d n nhng c th khng c nu tn mt cch chnh qui Human-Computer Interface Evaluation: nh gi kh nng

thch hp ca giao din c nh ngi dng cp thp v cp cao Tools T l Support S t Person P : Ng N i cung cp v bo o cc cng c cn thit nh tools, software, network vn hnh theo yu cu ca qu trnh pht trin Software Economist: S dng cc m hnh nh gi cn thit c lng chi ph phn mm, phn cng, resource v thi gian cn cho d n hon tt Project Librarian: C trch nhim lu tr v sp xp h thng tt c cc ti liu ca d n Chuyn gia h tr: Mt s d n cn c nhng chuyn gia trong lnh vc tng ng h tr, t vn v mt chuyn mn hay k thut NHN S CA CC TEAM C TH THAY I THNG XUYN TRONG QU TRNH HOT NG DO NHIU YU T
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

46

Cc yu t nh hng n cc team
Nhn s cn thay i theo tng cng on: cc cng on cn nhiu nhn s v cn thi gian di nh coding, testing & integration. Cc C nguyn nhn h khch kh h quan khc: kh
N hn s thay i cng vic: chuyn mn thay i, cng ngh mi cp nht N hn s ngh do thay i vic, bnh, v hu N hn s mi: mang li t duy mi v cng ngh mi tuy nhin phi cn thi g gian tip cp

Vic xy dng cc team l linh ng theo tng d n v cn c iu phi gia cc d n theo tng tin cng vic. c
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

47

Project management
D on quy m v phc tp ca d n Xc nh cc team cn thit cho hin thc d n Xc nh k hoch d on thi gian hon thnh d n Xc nh cc ti nguyn cn thit cho d n bao gm phn mm, h thng, . Tnh T h ton t chi hi ph h xy dng d n Xy dng l trnh thc hin d n (smiletone) Thc hin cc cng vic qun l trong thi gian thc hin d n bo m ng k hoch ra.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

48

Cc cng vic ca Project management t trong thi gian i thc hin d n


Qun tr nhn s: iu phi, qun l cng vic,.. Phn b cc ti nguyn ca h thng theo k hoch iu phi nhn s: trong cng ty v bn ngoi X l cc pht sinh v thi gian biu Qun l cc thay i yu cu ca d n Gii quyt cc s c ngoi k hoch: my mc h hng, nhn s thay i,.. Bo co cho lnh o v d n Giao tip vi khch hng g Staffs trainning
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

49

Software Project Estimation


D on iu g?
Quy m ca sn phNm s c pht trin Cc yu cu, resource cn thit c th pht trin sn phNm thnh cng

pht trin sn phm cn bit nhiu thng tin


9 9 9 9 9 9 9 My trin y tnh cn cho pht p Cc phn mm c bn nh compiler Phng thc giao tip gia cc b phn CASE Tools Cc gi phn mm m h thng cn lin kt, tng tc. My tnh cho tesing My tnh cho trainning 9 9 9 9 9 9 9 9 9 Cc cng g c cho Documentation Thit b copy, lu tr Cng ngh s dng Lp trnh vin Kim tra vin Qun l Nh thit k Cc nhn s khc .
50

Size of Project

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Project Size
Kch thc c o bng lines lines of code code Lm th no d on c kch thc ca mt n phn mm?
Knh thc o bng s dng code c vit hon thnh d n D n cha thc hin lm sao bit s dng code s c vit

Phng php Analogy v Reasoning Reasoning-by-Analogy by Analogy Phn b nhn lc cho d n phn mm trn c s lines of code d on.
nh gi nng xut ca mi ngi trong d n

Metric data cho vn estimated v phn b resource.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

51

Phng php Analogy


Analogy gy l g g ? Suy y lun theo analogy? gy iu kin s dng phng php analogy:
C bi ton bit c bn cht tng t c gii php ca bi ton bit

Cch p dng analogy


Xc nh c cc thng s tng ng gia 2 bi ton p dng gi ii php h ca bi b i ton bit cho h bi b i ton mi

Vi d n phn mm
Xc nh cc d liu ca nhng vn lm nh vo metric Phn tch d n cn d on thnh cc thnh phn Xc nh kch thc tng ng tng phn vi thng tin metric c loi tr cc kch thc cc phn c reuse Tng kch thc cc phn kch thc d n
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

52

D on nhn lc cho d n
Lines of new code Approximate N b of Number f Software Enginneers 1 1 2 5 10 0 20 50 100 200 500 1 000 1,000 10,000 53

5,000 10,000 20,000 50,000 100,000 00 000 200,000 500,000 1 000 000 1,000,000 2,000,000 5,000,000 10 000 000 10,000,000 100,000,000

Th Thc t khng th tng tuyn tnh mt cch n gin nh th Khng phi tt c nhn lc u ng u. Khi Khi d n cng ln th cc vn qun l giao tip v lin kt s phc tp hn lm gim nng xut. D n ln, , cc thay y i ngoi g d kin s nhiu hn nn nng xut b nh hng. Cn nhiu khu khc nh hng n d n ch khng phi ch c coding. coding Tnh da trn thng s no?

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

D on nhn lc theo Metric


Lines of new code Approximate N b of Number f Software Enginneers 7 14 27 77 144 288 790 1 480 1,480 3,220 8,000 15 960 15,960 160,027

5,000 10,000 20,000 50,000 100 000 100,000 200,000 500,000 1 000 000 1,000,000 2,000,000 5,000,000 10 000 000 10,000,000 100,000,000

Thit lp bng d liu theo s liu thng k m metric team thc hin t tr c. S liu ny cha ng cc yu t khc v qun l v cc cng on khc nhau ca mt n tng th. Xy dng mt hm d on nhn lc cho d n (personmonth )dng y = mx + b vi m, b c xc nh bng phng php bnh phng ti thiu ( (Xem cng th hc tnh h m, b trang 71) Da vo ta tnh c s nhn lc cn thit cho d n. Y th hi gian i th hc hin (person ( month) X kch thc d n
54

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

V d
Da vo bng trn ta tnh c y = 0.002 x + 1.84 . V d vi d n kch thc 15,000 lines of code ta s cn 32 person personmonth gii quyt Xy dng bng metric ca cc d n tng t ta tnh c l cn phn h b bao b nhiu hi ngi l lm t trong bao b lu. l V d bng tnh ton cho cc d n database
Projects Application 1 Application 2 Application 3 A li ti 4 Application Application 5 Application 6 Application 7 Domain Graphics Utility Graphics Utility Graphics Utility G hi Utility Graphics Utilit Graphics Utility Graphics Utility Graphics Utility Months 12 10 24 36 12 24 48 Effort (person-month) 30 40 30 100 30 30 90 Size 5000 8000 10000 20000 5000 10000 25000

HN CH CA PHNG PHP NY
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

55

COCOMO Model
Xc nh c 2 thng s l s nhn lc v thi gian pht trin Trnh t thc hin
Phn tch cc yu cu ca d n Xc nh line of code ca tng yu cu d vo metric data Tr cc p phn c xc nh l reuse code Tng cc phn cn li tnh c K line of code p dng cng thc tnh E = ab * K * exp(bb) D = cb * E * exp(db) E l s nhn lc tham gia vo d n D l thi gian thc hin d n
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

56

COCOMO Model (tt)


Cc h s ca cng g thc COCOMO
Software Project type Small project, requirement Hard real-time real time interoperability experienced team, and Ab flexible 2.4 strict 3.6 36 3.0 Bb 1.05 12 1.2 1.12 Cb 2.5 25 2.5 2.5

Db
0.38 0 32 0.32 0.35

rew\quirements

A mixture of the other two type of projects

Cc gi tr E v D tnh c ph thuc vo kh nng estimate gi (K) ) ca d n. tr line of code (


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

57

Project Scheduling
Scheduling g bao gm:
Xc dnh cc mc tin trnh thc hin d n Phn b resource cho cc tin trnh ca d n

Qun tr v thc hin cc iu chnh cn thit cho cc tin trnh khi c s thay i ngoi k hoch
Phn b li ngun resource (thm ngi) Phn b li milestone ca tng tin trnh Mc tiu l bo m deadline khng b thay i

Phng php qun tr v iu chnh: FUNCTION POINT Cc cng c dng trong scheduling : MS project, Cocomo2
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

58

Activity network model


T3 M1
14/7/99 15 ngy

T9
15 ngy

M4 M3
25/7/99

M6
25/8/99

T1
8 ngy

T6
5 ngy

04/8/99

T 11
7 ngy

S Start
04/07/99 T4
10 ngy

T2
15 ngy

T7
20 ngy

M8 M7 T5
10 ngy 11/8/99 5/9/99

M2
25/7/99

T 12 T 10
15 ngy 10 ngy

M5
18/7/99

T8
25 ngy

FINISH
19/09/99

Thit lp activity ti it network: t k gm cc Minestone Mi t (M) v Task T k (T) Xc nh critical path: c tng thi gian thc hin di nht iu chnh cc M-i bo m deadline iu chnh cc T-i bng cch thay i/b sung nhn s (Team)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

59

Activities Bar Chart PERL PERL chart


4/7 START T4 T1 T4 11/7 18/7 25/7 1/8 8/8 15/8 22/8 29/8 5/9 12/9 19/9

M1

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

60

Ch ng 3

Phn tch h thng


(system analysis)
Nhng vn trong phn tch h thng Thu thp yu cu t ngi s dng Phn tch yu cu Xc nh tnh nng h thng

Mc tiu ca p phn tch h thng g


Khch hng v nh pht trin gp nhau tho lun v yu cu ca h thng phn mm cn xy dng Nh pht trin tm hiu, phn tch v kim chng li (validate) yu cu v biu din n bng m hnh phn tch M hnh phn tch c t ton b ni dung : chc nng, d liu nhp/xut, cc hot ng ca h thng cn pht trin Xy dng cc t in d liu nh ngha cc khi nim c th ca h thng, ng ngha, a cu trc, trc trc, Thng nht vi khch hng v m hnh v tnh nng ca h thng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

62

Phn tch h thng g


Phn tch h thng l bc u tin rt quan trng cho d n pht trin phn mm Cng vic phn tch h thng bao gm
Thu thp yu cu v quy trnh nghip v hin ti Phn tch v xc lp cc quy trnh s c pht trin/thay th bng my tnh Xc thc cc yu cu/tnh nng ca h thng

Kt qu ca vic phn tch h thng l cc ti liu c t tnh nng h thng. ng. Cc ti liu ny thng th ng dng cc s , biu ,.. ,.. Kt qu ny dng cho vic xc thc cc tnh nng ca h thng vi khch hng Kt qu ny l u vo ca qu trnh tip theo l thit k h thng. ng. Ty thuc vo cng ngh pht trin m s dng cc phng php phn tch ph hp : cu trc hay OOP
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

63

Nhng g vn trong g phn p tch h thng g


Cch bit v chuyn mn ca lnh vc cn phn tch S hiu bit ca nhng ngi end user v quy trnh lm vic v kh nng ng dng phn mm cho cng vic ca h Nhng vn v iu kin h tng h tr hot ng ca h thng Tnh sn sng thng tin ca cc h thng ang c s tng tc vi h thng cn xy dng nh hng ng dng lu di cha c/ cha r rng Cng c/ngn ng s dng c t h thng / kt qu phn tch p
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

64

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng Tm hiu v xy dng li hin trng ca h thng Cc quy trnh hot ng/nghip v Phng thc v ngha ca cc qu trnh x l D D liu ca h thng iu kin h tng: thit b, con ngi

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

65

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng

Xc nh cc yu cu
Cc Cc yu cu v chc nng ca h thng Cc yu cu v mi trng vn hnh: thit b, con ng gi

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

66

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng Phn tch cc yu cu Phn tch cc yu cu theo quy trnh s l B sung g cc q quy y trnh cho ph hp vi my tnh Yu cu b sung cc thng tin

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

67

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng

X lp t Xc tnh h nng ca h thng Xc lp cc chc nng m h thng s bao gm Xc lp cc iu kin v mi trng hot ng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

68

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng Xc thc tnh nng h thng Xc thc vi ngi dng v tnh hp l v y ca cc tnh nng Xc thc cc quy trnh nghi g p v Xc thc cc rng buc

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

69

Quy Q y trnh phn p tch h thng g


Cc bc chnh
Thu thp thng tin h thng hin t i Thu thp yu cu Phn Ph tch t h yu c u Xc lp tnh nng h thng Xc thc tnh nng h thng

Phng php cu trc


Cc bc c thc hin ng thi v sen k nhau Thng g s dng g l c : DFD, ERD, STD
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Phng php OOP


S dng UML: lc Use case, Class

70

Ph Phn tch h h th hng theo h h ng pht h tri in k thut lp trnh cu trc

Tip cn ca phng php pht trin c in cho bc phn tch h thng Cc lc DFD, STD, ERD

CC YU T CN BN CA M HNH
Process Specification (PSPEC)

Lc DFD
Lc d ch dng hy d liu T in d liu

Lc quan h thc th

Lc dch chuyn trng thi

M hnh chc nng v dng thng tin: DFD, PSPEC M t dng thng tin di chuyn (flow) xuyn qua cc h thng thin v phn mm. Din t cc tng tc xut nhp d liu vi con ngi v cc h thng khc Lu dng chy d liu DFD (Data Flow Diagram) cung cp 4 k hiu c bn m hnh s di chuyn ca dng thng tin g ca Ward & Mellor; ; M rng Hatley & Pirbhai cho realtime
72

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

CC YU T CN BN CA M HNH
Process Specification (PSPEC)

Lc STD
Lc quan h thc th T in d liu Lc d ch dng hy d liu

Lc dch chuyn trng thi

Control Specification (CSPEC)

M hnh hnh vi ca h thng Lc dch chuyn trng thi (STD) th hin Cc trng thi khc nhau ca h thng S dch chuyn gia cc trng thi M t chi tit hn iu kin xy ra ca cc hnh vi Cung cp mt hnh nh ng v h thng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

73

CC YU T CN BN CA M HNH
c t t in d liu Process Specification (PSPEC)

Lc ERD
Lc d ch dng hy d liu T in d liu

Lc quan h thc th

c t cc thng tin v d liu ca h thng Cu trc d liu Cc quan h v rng buc d liu

Lc dch chuyn trng thi

Control Specification (CSPEC)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

74

CC YU T CN BN CA M HNH
c t t in d liu Process Specification (PSPEC)

T in d liu
Lc d ch dng hy d liu T in d liu

Lc quan h thc th

Lm r cc khi nim v thut ng trong h thng Nu ln ngha v phm vi s dng ca cc khi nim ny Xc nh cc cu trc thng tin cn thit

Lc dch chuyn trng thi

Control Specification (CSPEC)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

75

L C DNG CHY D LIU ( (DFD) )


c xy dng t 4 phn t chnh
Thc th: to ra hoc tiu th thng tin, nm bn ngoi bin gii ca phm vi thng tin h thng Chc nng x l: thc hin chc nng no , tiu th v to ra thng tin, nm bn trong phm vi thng tin h thng Thng tin hay d liu Kho d liu: lu tr d liu m c s dng g bi nhiu chc nng g x l
Thc th Chc nng x l Kho D Liu D liu

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

76

L C DNG CHY D LIU ( (t.t) )


DFD c xy dng qua nhiu mc khc nhau nhau: : mc 0, 1, 2 DFD mc sau chi tit hn mc trc Process Specification (PSPEC) b sung cho DFD Tnh lin tc ca dng d liu

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

77

K thut p phn tch h thng g


Tip xc, phng vn cc ngi dng trong h thng thu thp cc thng tin v nghip v ca ng i dng Thit lp on vn miu t chc nng (processing narrative) cho h thng cn xy dng Xy dng DFD cc mc khc nhau
Thit lp s ng cnh (DFD mc 0)

Phn hoch DFD vo cc mc cao hn S dng phng php duyt vn phm. Lun L lun l tun t theo th tnh t h lin li tc ca dng d d liu

Vit PSPEC cho cc chc nng ca DFD mc cao nht

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

78

Xy y dng g DFD V d
Phn mm SafeHome: SafeHome: Thit lp on vn miu t x l DFD mc ng cnh: nh: nhn din cc thc th v d liu input, output
Bng iu khin
Lnh v d liu Thng tin hin th

Mn hnh

SafeHome System
Trng thi cm ng

Kiu bo ng

Chung

Tn s ca s in thoi

B cm ng ng in tho th i
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

79

Xy y dng g DFD V d
Bng iu khin
Yu cu Lnh v d liu cu hnh

Cu hnh h thng

DFD mc 1: hnh thnh mt s chc nng chnh


Thng s cu hnh

Tng tc vi User
Start/Stop Mat ma

Cm/ Cho php


Xc nhn mt m

Mn hnh
Thng bo Thong tin hien th

X l mt m

Hin th

Thng tin cm ng Trang thai cam ng

Theo di cm ng

Kiu bo ng chung Tn s ca in thoi

Chung

B cm ng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

ng in thoi
80

M hnh hnh vi STD V d


y giy v sn sng Yu cu copy

c lnh
Copy xong Yu cu c lnh

Rnh Yu cu c lnh

M hnh hnh vi h thng my photocopy

y gi g y Yu cu c lnh

Thc hin copy py


Ht giy Yu cu np giy

Np giy

Kt giy Y cu x l li Yu

X l li

Ht kt giy Yu cu c lnh

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

81

T in d liu
Nhiu phn t c to ra trong m hnh phn tch: tch: d liu, ch hc nng, iu khin Phi c mt cch thc qun l cc phn t sao cho hiu qu T in d liu nh ngha: a: T in d liu l mt danh sch c t chc ca tt c cc phn t d liu cn thit cho h thng. ng. Cc phn t c nh ngh g a chnh xc v cht ch sao cho c p phn tch vin v khch hng cng chia s mt suy ngh v chng chng. . T in d liu thng c hin thc nh l mt phn ca cng c CASE CASE. . Mi phn t bao gm nhng thng tin: tin: tn, b danh, c dng u/nh th no, c t ni dung v thng tin ph tr
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

82

T in d liu V d
V d phn t d liu s in thoi
Tn: S in thoi B danh: Khng c dng u/nh th no:
output ca Thit lp iu kin bo ng

input ca Quay s c t ni dung: s in thoi = [ m rng a phng | s bn ngoi ] m rng a phng = [ 2001 | 2002 | 2009 ] s bn ngoi = 9 + [ s a phng | s ng di ] s a phng = tin t + <chui 4 k s> s ng di = (1) + m vng + s a phng tin t = [ 795 | 799 | 874 | 877 ]

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

83

Review Phn tch h thng g theo cu trc


Phn tch yu cu theo pp c in bao gm: m: M hnh chc nng v dng thng tin (DFD), M hnh d liu (ERD) v M hnh hnh vi i (STD) (S ) Lc DFD c bn c 4 k hiu v n c m rng biu din c cc h thng thi gian thc Xy dng DFD mc 0 ri n cc mc cao hn; n; ch bo ton tnh lin tc ca dng d liu T in d liu gip qun l v tra cu cc phn t d liu

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

84

Ph Phn tch h h th hng theo h h ng pht h tri in k thut lp trnh OOP

Tip cn ca phng php pht trin OOP cho bc phn tch h thng

AI / V tr nh th no / Lm G / Khi no
Cc lc

Lc Use-case: thu thp yu cu m hnh nghip v Lc lp: phn tch h yu cu m hnh phn tch

M hnh nghi g p v - Thu thp y yu cu


Quan im thu thp/phn tch yu cu ca m hnh nghip v: h thng gm c AI/Lm nhng g/Khi no Lc Use Use-case :
Actor & Use-case Cc mi quan h : Actor Actor ; Actor-Use-case, - Use-case-Usace

Actor xc nh mt b vai tr m ngi hoc vt s ng vai khi tng tc vi h thng phn mm


Actor nm ngoi phm vi ca h thng Ch quan tm cc thng ip m actor gi hay nhn Khng quan tm cu trc bn trong ca actor

Phn loi actor


Ch yu / Th yu Tch T h cc / Th ng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

86

Nhn din cc ACTOR


Tr li mt s cu hi nh Ai l ngi s dng chc nng chnh ca h thng ? Ai cn s h tr t h thng thc hin cng vic thng nht ca h ? Ai phi thc hin cng vic bo dng, qun tr v gi g hot ng g? cho h thng H thng s kim sot thit b phn cng no ? H thng ang xy dng cn tng tc vi nhng h thng khc hay khng ? Ai hoc vt th no quan tm n hay chu nh hng bi kt qu m h thng phn mm to ra ?
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

87

Biu din ACTOR trong g UML


Actor c biu din bng k hiu hnh ngi
Tn Actor

Actor A t c xem l mt lp (class) ( l ) c stereotype t t l <<actor>> Gia cc actor c th c quan h tng qu ho


V d: Sinh vin, ging vin v khch u l c gi ca h thng qun l th vin: c gi l actor tng qut ha ca 2 actor sinh vin v ging vin

V d: mt h thng ng k mn hc trong trng g i hc


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

88

Cc Actor trong g h thng g ng g k mn hc

Sinh vin S

Phng o to

H thng ng k mn hc

Ging vin

H thng qun l hc ph Phng ti v


89

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Khi nim UseUse-case


UseUse-case biu din mt chc nng ca h thng phn m m UseUse-case c biu din bng mt chui cc thng ip trao i bn trong h thng v mt hoc mt s thng ip trao i vi actor Mt s quy c Use-case lun lun c bt u bng thng ip n t actor Use-case phi hon tt: chui thng ip phi kt thc bng kt qu c th. Li thng gp: p: chia nh use use-case tr thnh nhng chc nng vn vt
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

90

Khi nim UseUse-case


UseUse-case c biu din bng hnh ellipse: ellipse:

Tn Use Use-case im m rng l mt v tr trong useuse-case m ti c th chn chui s kin ca mt use use-case khc UseUse-case c th cha iu kin r nhnh, x l li, ngoi l... Minh d ca useuse-case l kch bn (scenario): (scenario): miu t c th trnh t cc s kin xy ra khi UseUse-case c thc hin. n.
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

91

Tm kim UseUse-case
Tr li mt s cu hi nh
Actor yu cu chc nng g ca h thng ? Actor cn phi c, to, xo, sa i hoc lu tr thng tin no ca h thng khng ? Actor cn thit phi c cnh bo v nhng s kin trong h thng, hay actor cn phi bo hiu cho h thng v vn no khng ? H thng c th h tr mt s cng vic thng nht ca actor no hay khng ?

Mt s cu hi khc cn ch
H thng cn d liu input/ouput no ? D liu n t u ? Nhng kh khn no lin quan n hin thc ca h thng hin ti (chng hn h thng qu q n l bng giy t nn c thay tha th bng h thng qun l trn my tnh) ?
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

92

Cc q quan h ca UseUse-case
Sau khi xc nh cc Actor v Use Use-case th cc quan h s c thit lp hon chnh lc Use Use-case Gia useuse-case v actor thng c quan h lin kt
Use-case c Actor no kch hot

Gia cc use use-case cng c quan h lin kt hoc tng qut ho


Quan h lin kt: extent , incluse Quan h thng qut ha

V d: mt h thng ng k mn hc theo tn ch trong trng i hc

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

93

V d mt UseUse-case n g gin
<<communicate>>

Sinh Vin ng K Hc

Q n l Qu Mn Hc

Phng o To

ng k dy

<<extend>>

Qun l Sinh Vin Ging Vin Vi


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Thm Sinh Vin Mi

94

Quan h lin kt Q
Quan h lin kt ch ra mt quan h c ngha gia hai bn
Trong thc t: hnh khch vi li xe, xe sinh vin vi gio vin, vin ging vin vi mn hc

Mt s tnh cht lin quan


Tn ca lin kt Mt chiu hay 2 chiu Bc: s lng thc th tham gia vo lin kt ti mi bn

UML biu din lin kt nh l mt on thng g ( (hai chiu) ) hoc mi tn (mt chiu)
<<Stereotype>> <<Stereotype>>

C th p dng stereotype stereotype: :


<<include>> <<extend>> <<communicate>> ...
95

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Q Quan h lin kt g gia Actor v UseUse-case


Lin kt l quan h duy ht gia actor & UseUse-case Lin k c th l 2 chiu hay 1 chiu
actor kch hot use-case v nhn kt qu v: lin kt 2 chiu actor kch hot use-case, use-case khng quan tm kt qu v: lin kt 1 chiu

Quan h lin kt ph bin gia Actor & UseUse-case l giao tip: p: stereotype l <<communicate>> dng lin kt gia actor v
use case m n kch hot 1
Ngi bn hng

*
t hng

<<communicate>>

ng k dy

Ging vin
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

96

Q Quan h gp g gia 2 UseUse-case


Dng lin kt 2 UseUse-case: case: c stereotype l <<include>> Trong UseUse-case ngun c im m rng m ti bt buc phi chn Use Use-case ch vo. vo.
Ti im m rng, ng din tin ca use-case ngun tm thi ngng li chuyn sang din tin ca use-case ch Khi kt thc use-case ch, din tin ca use-case ngun li tip tc

<<include>>

Tm kim

ng nhp

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

97

Quan h m rng Q gg gia 2 UseUse-case


Dng lin kt 2 UseUse-case: case: c stereotype l <<extend>> Trong useuse-case ngun c mt im m rng m ti c th (hoc khng) chn use use-case ch vo ty thuc vo iu kin r nhnh hoc tng tc t actor
Ti im m rng, nu c m rng th din tin ca use-case ngun tm thi ngng li chuyn sang din tin ca use-case ch Khi kt thc th use-case ch, h din tin ca use-case ngun li tip tc
<<Extend>>

Tm kim

ng k t ch
(nu tm thy)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

98

Q Quan h tng gq qut ha


L mi quan h gia cc i tng cng nhm to nn mt i tng mang nhng tnh cht chung ch ng ca cc i tng kia Quan h thng qut ha gia cc Actor Actor: : nhiu actor c chung mt s vai tr -> hnh than2 than2h actor tng qut ha mang vai tr chung . .
V d: sinh vin, gio vin u c chung use-case login v u l user ca h thng -> to nn actor user l tng qut ha ca actor sinh vin v actor gio vin

Quan h thng qut ha gia cc Use Use-case: case: khi c nhiu useuse -case l tr ng hp c th mt use use-case tru tng
V d: Use-case login ca sinh vin , gio vin c th c thc hin theo c ch khc nhau nhng cng mang chung ngha l ng nhp l cc tr t ng hp c th ca Use-case U t u tr tr t ng LOGIN
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

99

Xy y dng g m hnh UseUse-case


Cc yu cu ca phn mm c m t trong m hnh useuse-case M hnh use use-case bao gm lc use use-case v (c th) mt s packet (gom mt s use use-case thnh mt b chc nng con ca h thng) Phng php thc hin: n:
Xc nh cc actor v use-case ca h thng Xc lp cc quan h gia cc i tng ny
Quan h lin kt gia actor v use-case: mt chiu hoc hai chiu, thng c stereotype l <<communicate>> Quan h m rng hay gp gia 2 use-case: quan h lin kt vi stereotype <<extend>> hay <<include>> Quan h tng qut ho (generalization) gia cc actor: nhiu actor c vai tr ca mt actor tru tng Quan h tng qut ho h gi ia cc use-case: nhi hiu use-case l l trng hp c th h ca mt use-case tru tng

Trnh by thnh lc use-case theo chun UML C th xc nh cc p packet

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

100

Xy y dng g m hnh UseUse-case V D


Prints timetable Student print request <<communicate>> <<communicate>> timetable command Registers courses People Removes students Finance Makes timetable fee summary

<<include>>

Manages course

Administration <<extend>> t d

<<include>> Lecturer Reads courses <<include>> Manages g lecturers <<include>> Adds students <<extend>> <<include>> Login Undertakes course Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

<<include>>

Manages students

101

Xy y dng g m hnh UseUse-case V D


<<communicate>>

Forwards
Subcriber <<extend>> <<extend>>

Removes mailbox <<communicate>>

Replies
<<communicate>> <<extend>>

Views mail <<include>>


<<include>>

Administrator

<<include>>

Login

Adds mailbox

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

102

Xy y dng g m hnh UseUse-case V D


<<extend>> imports <<communicate>> import command models <<communicate>> model command run command sets appearance <<communicate>> save command d Viewer initializes

i t <<communicate>> export command exports

toggles light

saves model <<communicate>> <<extend>> close command toggles mode

exits

sets eye 103

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

M hnh p phn tch Phn tch y yu cu


i tng/lp - quan h

M hnh nghip v biu din cc chc nng phn mm cn xy dng di dng cc use usecase M hnh phn tch s tm kim cc i tng s sng ng trong ng cnh ca phn mm Cc i tng s tng tc vi nhau to nn cc chc nng m t bi useuse-case Lc Class Cl phn h tch t h din t cu trc, t mi quan h gia cc i tng/lp trong h thng Cha quan tm n hnh vi c th v nhim v chi hi tit ca chng h t trong ng cnh h ca h thng Nguyn tc: c: m hnh phn tch phi c lp vi o/s, / ngn ng lp trnh, t h cng c pht ht tri t in
104

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Xy y dng g m hnh phn p tch


M hnh phn tch c din t trong UML bng lc lp phn tch (Class diagrame) Cc cng vic xy dng lc phn tch bao gm
Tm kim cc i tng / lp trong h thng i tng / lp thc th i tng / lp bin i tng / lp control Xc nh cc thuc tnh ca i t ng g / lp Xc nh cc tc v ca i tng / lp Nhn din cc lp tru tng qua mi quan h thng qut ha Xc lp cc mi quan h gia cc lp: Tng qut ho (generalization) Lin kt (association) Bao gp (aggregation)

Biu din thnh lc lp phn tch t h


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

105

Nhp din i t ng g / lp
Da vo c t ca tng useuse-case tm kim cc i tng Cc i tng thng xut hin trong cc danh t hay nhm danh t Mt s lu
Khng nn dng i tng biu din mt d liu n (nn xem l thuc tnh ca i tng khc) i tng/lp phi thc s cn thit cho s hot ng ca h thng i t ng/l g p >< bng g c s d liu i tng/lp >< actor

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

106

Nhn din v biu din i t ng g / lp


Phn loi i tng/lp
i tng thc th (entity): biu din cc thng tin thit yu ca h thng, c th c lu trong c s d liu i tng bin (boundary): thc hin chc nng giao tip vi actor i tng iu khin (control): ( t l) iu khin cc i tng khc kh

Trong UML, lp c biu din bng mt hnh ch nht gm 3 phn: n: tn, cc thuc tnh v cc tc v C th p dng stereotype cho lp: p: <<entity>>, <<boundary>>, <<control>>... <<control>>... i tng cng c biu din bng hnh ch nht, t thng thng gm 2 phn: n: tn i tng + tn lp (c gch chn), gi tr cc thuc tnh (trng thi ca i tng)
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

107

Biu din lp / i t ng g
HTMLObject j # alignment: int + GetAlignment( ): int + toHTML( ): String doc : HTMLDocument alignment = MIDDLE title = A document

HTMLDocument - title: String + GetTitle( ): String + toHTML( ): String

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

108

i t ng g / lp thc th
Biu din cho cc thc th xut hin mt cch t nhin trong h thng Thng tin v cc i tng thc th c th phi c lu tr lu di (database, file... file...) ) Trong T UML UML, c gn stereotype <<entity>> i D nhn din cc thuc tnh ca chng
V d: i vi h thng ng k mn hc h tn ch qua WEB, nhn din cc i tng thc th nh: thng tin SV, thng tin GV, nhm lp hc, c ng k nhm, nhm s tay sinh vin i vi h thng mail, nhn din cc i tng thc th nh: hp th, thng ip mail

Message g <<entity>>
# subject: String # sent: Date # content: String + GetSubject( ): String g( ) ): String g + toString(

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

109

i t ng g / lp bin
Thc hin chc nng giao tip vi actor Thng ch ha cc ph hn t ho h c iu khin giao i din ngi dng (nt nhn, hp danh sch, tu chn, menu... menu...) ) Trong UML, c gn stereotype <<boundary>> Kh nhn bit cc thuc tnh v tc v trong m hnh phn tch
V d: i vi h thng ng k mn hc h tn ch qua WEB, nhn din cc i tng bin nh: RegisterForm RegisterForm, StudentForm g mail, nhn din cc i vi h thng i tng bin nh: MailView, MailCompose...
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

MailView <<boundary>>

110

i t ng g / lp iu khin
C nhim v iu khin cc lp khc hoc Nhng lp khng phi l lp thc th v lp bin Trong UML, c gn stereotype <<control>> Lp bin thng c quan h lin kt hoc ph thuc vi cc lp khc
V d: i tng biu din mt s lnh thng thng nh ct, dn, thay i thng s nhn trong hin th ho
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Command <<control>> + Execute( ) + Reexecute( ) + Unexecute( ) # Do( )

PasteCommand <<control>> + Execute( () + Reexecute( ) + Unexecute( ) # Do( )

BgCommand <<control>> + Execute( () + Reexecute( ) + Unexecute( ) # Do( )

111

Nhn in cc thuc tnh


Da vo c t ca tng useuse-case, tm kim cc danh t hoc nhm h danh d h t lin li quan n i tng ang xt t Tr li cu hi: i: nhng thnh phn no cu thnh i tng ang g xt ?
Lu : cng mt i tng trong cc ng cnh khc nhau chng ta c th tm c cc thuc tnh khc nhau

Nn xc nh (tuy nhin khng bt buc) trong m hnh phn tch


Kiu ca thuc tnh: mt s kiu c bn Bc ca thuc tnh: s t hoc s nhiu Visibility ca thuc tnh: mc cho php truy xut thuc tnh t bn ngoi

UML: thuc tnh c miu t tng minh hoc thng qua UML: quan h vi cc lp khc
112

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Xc nh mc truy y cp ca thuc tnh


Mc truy cp v phm vi m thuc tnh c th c tham kho n trc tip UML nh ngha 3 mc truy xut thuc tnh (visibility)
public (+): c th truy xut thuc tnh t tt c cc v tr khc

nhau protected (#): bn thn lp ang xt v cc lp con ca n c th truy xut thuc tnh private (-): ch c lp ang xt c th truy xut thuc tnh

Thng thng nn t mc truy xut thuc tnh l private hoc protected (cho cc lp c s), khng nn l public. public. Thuc tnh nn c truy xut thng qua tc v get/set
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

113

V d v nhn din cc thuc tnh


H thng ng k mn hc h tn ch qua WEB Nhn din cc thuc tnh cho cc i tng: ng: StudentInfo LecturerInfo StudentInfo, Ch cc mc truy cp ca cc thuc tnh Cc tc v pht sinh trong khi nhn din cc thuc tnh nh Get/Set
StudentInfo <<entity>> - name: String - code: Long - dateOfBirth: Date - addr: String - acaYear: Y D Date - department - home: String - socialAid + GetN ame( ): String + GetCode( ): Long LecturerInfo <<entity>> - name: String - code: String - dateOfBirth: String - addr: String - degree - title: String - division - health - experience: Date + GetN ame( ): String + GetCode( ): String

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

114

V d v nhn din cc thuc tnh


H thng ng k mn hc h tn ch qua WEB Nhn din cc thuc tnh cho cc i tng: ng:

CourseOfferring <<entity>> - courseN ame: String - courseCode: String - offering: int - session i - credit: int - prerequisite

Catalog <<entity>> - acaYear: Date - semester

CourseOffering, Catalog

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

115

Nhn din cc tc v
Da vo c t ca tng useuse-case, tm kim cc ng t hoc nhm ng t lin quan n i tng ang xt Ch xem i tng c to ra v b hu b i nh th no ? Trong thi gian n gi/nhn thng ip ra sao ? Cc i tng bin c cc tc v nhn lnh t actor actor. . Xem xt mc truy y xut ca tc v tng g t nh i vi cc thuc tnh tnh; ; cc tc v thng c visibility l + hoc # Mt s tc v khng xut hin mt cch t nhin trong m hnh phn tch m hnh thit k s nghin cu k trch nhim v hnh vi ca tng i tng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

116

Nhn din lp c s
Lp c s (base class) c nhn din sau khi nhn din cc lp c th S xut hin ca lp c s lm cho m hnh phn tch c tnh dng li cao (reusability) v d m rng (scalability) UML h tr quan h tng qut ho (generalization) Lp c s tru t ng g ( (khng g th c th ho to ra i tng) c tn in nghing Lp c s c hnh thnh bng cch xc lp cc quan h tng qut ha ca cc lp c th c chung mt s thuc tnh v/hay mt s tc v

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

117

Nhn din lp c s (tt) ( )


i vi cc i tng/lp thc th, tm cc thuc tnh chung hnh thnh lp c s V d
Trong h thng qun l th vin qua WEB: cc i tng Book, Book Magazine c mt s thuc tnh chung hnh thnh lp LibraryItem i vi h thng ng k mn hc tn ch qua WEB: lp PeopleInfo l lp c s ca StudentInfo v LecturerInfo Chng trnh v b mt a hnh: lp MapCurve l lp c s ca ng ng mc Isoquant v t gy Fracture

Gia lp c s v cc lp c th c mi quan h thng qut ha c th biu din c trong UML

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

118

Biu din lp c s v quan q h tng g qut q ha


UML nh ngha quan h tng qut ho gia mt lp tng qu hn vi mt lp c th hn: n: lp c th hn c tt c thuc tnh, , tc v v q quan h ca lp kia + nhng thuc tnh/tc v ring ca n K hiu: u: mi tn t c u l mt tam t gic nh Lp tng qut hn nm v pha mi tn

MapCurve

Isoquant

Fracture

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

119

V d v nhn din lp c s
V d: Trong T ong h thng ng k mn hc tn ch qua WEB, lp PeopleInfo l tng qut ho ca StudentInfo v LecturerInfo
# name: String # code: String # dateOfBirth: Date # addr: String

StudentInfo <<entity>> - acaYear: Date - department - home: String - socialAid

LecturerInfo <<entity>> - degree - title: String - division - health - experience: Date

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

120

Nhn din cc mi q quan h


Sau khi xc nh cc lp/i tng k c cc i tng c s, cc quan h gia cc lp cn c xc lp Trong m hnh phn tch cc i tng/lp c quan h vi nhau Mt s quan h m UML h tr
Tng qut ho (generalization) Lin kt (association) Bao gp (aggregation)

Cc quan h khc c p dng cho m hnh thit k


Ph thuc (dependency) C th ho (realization)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

121

Quan h lin kt Q
Quan h lin kt l mi quan h gia 2 i tng/lp V ngha v k hiu ging nh quan h lin kt trong m hnh nghip v p dng cho 2 lp c mi tng quan mang ngha nht nh Ch g ghi r ( (nu c th c) )
Bc v tn vai tr ca mi lp trong quan h Tn ca chnh quan h lin kt

Da vo m hnh nhgip v xc nh cc mi quan h lin kt

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

122

V d - mi q quan h lin kt
StudentInfo St d tI f <<entity>> students d 40..80 h has Registration <<entity>> - acaYear: Date - semester 0..1 lecturer LecturerInfo <<entity>> 0..1 offering CourseOffering <<entity>> reg

V d:
Lp Registration lin kt vi lp StudentInfo LecturerInfo v CourseOffering

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

123

Quan h bao gp Q
UML nh ngha quan h bao gp l trng hp c bit ca quan h lin kt, khi m mt u ni lin kt tr thnh u ni bao gp (aggregation) Lp u ni bao gp s bao hm lp kia K hiu ca u ni bao gp l mt hnh thoi t hoc khng t en C hai dng bao gp
Chia x (shared): chia x gia cc bao gp khc nhau Hon ton (composite): s hu y

Xc lp cc mi quan h bao gm v biu din chng ln lc lp


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

124

Quan h bao gp v d Q
i vi h thng ng k mn hc tn ch qua WEB, lp Catalog bao gp lp CourseOffering Co seOffe ing
CourseOffering <<entity>> Catalog << tit >> <<entity>> - acaYear: Date - semester

Ca s giao din bao gp hon ton thanh cun v menu Menu Window * ScrollBar

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

125

Xy y dng g l c lp
Lc lp (class diagram) biu din cu trc ca mt s lp v quan h gia chng m t kha cnh tnh (static) ca h thng H thng phc tp c nhiu lp cn xy dng nhiu lc lp, mi lc m t mt phn ca h thng Lc lp c b sung v hon thin trong m hnh thit k (thm mt s lp, chi tit cc thuc tnh v tc v, lm r
cc quan h)

Lc lp c xy dng qua cc bc
Xc nh cc lp Xc nh thuc tnh v tc v ca cc lp Xc nh cc lp c s v quan h tng qut ho Xc nh cc quan h lin kt v bao gp
126

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

V d mt l c lp p phn tch
mt lc lp ca chng trnh hin th b mt a hnh
Isoquant entity <<entity>> - altitude: double isoquants * FieldMap <<entity>> - name: String + wrap( ): Region

P i 2D Point2D - x: double - y: double

points p *

* MapCurve - ID: int - open: boolean

fractures Fracture F <<entity>>

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

127

Thit lp PACKAGE
Package l mt c ch t chc cc phn t vo cc nhm c lin h v ng g ngh g a vi nhau Package c th import cc phn t t mt package khc C th ch ra quan h gia cc package
Ph thuc Tng qut ho

Mc truy xut ca package


Private: ch n v cc package import n c th truy xut ni dung Protected: ging nh private nhng cho php thm cc package dn xut Public: cc package khc c th truy xut ni dung Implementation: p khng g cho p php p import, p c th p p dng g cho cc p phn t bn trong package

UML cho php biu din cc PACKAGE v cc mi quan h PACKAGE


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

128

V d v mt PACKAGE
package UniPeople cha cc lp lin quan n thng tin con ngi UniPeople
PeopleInfo # name: String S i # code: String # dateOfBirth: Date # addr: add : String St g StudentInfo - acaYear: Y D Date - department - home: String - socialAid
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

LecturerInfo - degree - title: String - division di i i - health - experience: Date

129

Tng g kt
Phn tch h thng cho OOP theo UML chia lm 2 b c: c:
Thu thp yu cu bng m hnh nhgip v Phn tch v xc nh tnh nng g h thng g bng g m hnh phn tch

M hnh phn tch nhn din cc i tng/lp: p: thc th, bin, bin iu khin Nhn din cc thuc tnh v mt s tc v, tuy y nhin cha lm r hnh vi ca chng g ( m hnh thit k) UML h tr mt s phn t: lp, i tng, lc lp, p package
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

130

Thit k phn mm
(Software Design)

C S CA THIT K PHN MM GIAO DIN & TNG TC NG I DNG PHNG PHP THIT K C IN PHNG PHP THIT K OOP

Thit k phn mm
Thit k phn mm l cng vic u tin ca giai on pht trin Thit k to ra cc biu din v d kin ca h thng phn mm cn xy dng t kt qu phn tch yu cu c th d dng hin thc sau Thit k to ra phng thc v quy trnh tng tc gia ng i dng vi h thng phn mm cng nh tng tc gia cc h thng khc vi phn mm. m
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

132

Tru tng ha
Qu trnh thit k tri qua nhiu mc tru tng ho khc nhau Mc cao nht: vn cn thit k c m t mt cch h tng qut t s dng thu th t ng h ng vn Cc mc thp hn: hng n th tc x l chi tit; kt hp cc thut ng hng n hin thc Mc thp nht: vn c m t theo cch c th hin thc trc tip Phn loi tru tng ho: th tc v d liu

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

133

Tru tng ha
Tru tng ho th tc: l chui cc lnh lin tip thc hin chc nng no .
V d: m ca (bao gm i n ca, cm ly tay nm, xoay tay nm, ko k cnh h ca, i vo); ) thm th mt ph hn t vo danh d h sch h c th t (xc nh v tr, chn phn t mi)

Tru tng ho d liu: l t hp d liu m t mt i tng d liu (lin h ti i tng thc th trong UML). V d: hng, chng, cnh ca... Mt s ngn ng lp trnh h tr kiu ADT v template

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

134

Tinh ch
Tinh ch l qu trnh lm r vn Tinh ch v tru tng ho l hai khi nim b tr nhau: cng tinh ch th cng h thp mc tru tng ho Thit k phn mm: tru tng ha ri tinh ch ho. ho Ti sao?

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

135

Thit k giao din ngi dng


Phn mm cn c giao din thn thin vi ngi s dng Mt s tiu chun giao din Thi gian p ng ca h thng: gi tr trung bnh v lch Phng tin tr gip ngi s dng: tch hp + add-on add on Kim sot thng tin li: hin th c nguyn nhn li v cch khc phc t tn nhn: ngn gn v gi nh Thng dng cc cng c thit k giao din
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

136

Cng c thit k giao din


Cng g c thit k g giao din nn c nhng g tnh nng g sau Qun l thit b nhp (bn phm, chut) Hiu chnh thng tin input Kim sot li v hin th thng bo li Cung cp tr gip v hin th thng bo nhc nh Cung cp feedback (v d nh t ng hin th k t nh vo) Kim sot ca s v vng, kh nng cun Thit lp giao tip gia chng trnh vi giao din (vd: hm p ng) Cch ly chng trnh vi cc hm qun l giao din Cho php tu bin giao din: mu sc, kch thc,..

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

137

Mt s nh hng v thit k giao din


Mt s hng g dn chung g Nn ng nht (menu, lnh, hin th...) Nn cung cp feedback cho ngi dng Yu cu xc nhn nhng tc v mang tnh ph hoi (xo file, file account) Nn h tr UNDO, REDO Hn ch h lng thng th tin ti ph hi ghi hi nh h gi ia 2 tc t v lin li tip Ti u trong trnh by hp thoi v di chuyn mouse Chp nhn li t pha ngi s dng Cung cp tr gip trc tuyn Dng ng t n gin v ngn gn t tn cc lnh

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

138

Mt s nh hng v thit k giao din


i vi thng tin hin th Ch hin th nhng thng tin ph hp vi ng cnh hin ti Dng tn, t vit tt v mu gi nh Cho php tng tc trc quan To thng th bo b li c ngh ha Hin th d liu nhiu dng khc nhau trong ca s Thit lp biu din tng t S dng khng gian mn hnh mt cch ti u

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

139

Mt s nh hng v thit k giao din


i vi thng g tin input p Hn ch input trc tip (c th chn la t mt s d liu c sn) Nn ng nht gia thng tin input v hin th Nn cho php tu bin input g khng g thch hp trong g ng g cnh Cm cc chc nng hin ti Cho php input nhiu dng khc nhau cho ngi s dng kim sot dng s kin tng tc T ng tnh cc gi tr input cho ngi s dng nu c th
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

140

Phng php lp trnh cu trc

Thit k phn mm

Module ho chng trnh Ph chia Phn hi module d l Kin trc phn mm Thit k d liu

Thit k phn mm c in
Cc cng on trong thit k phn mm c i n
Phn chia module Thit k d liu Thit k kin trc Thit k th tc Thit k giao din

Ph hn mm pht h trin theo h m hnh h h c in:


quan tm n cu trc v gii thut ca cc module

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

142

PHN CHIA MODULE


Module l g? g Khi nim module xut hin khong 4 thp nin tr li y. Phn mm c xy dng bng cch phn chia thnh nhiu module, sau s c tch hp li Phn chia module lm cho vic qun l phn mm khoa hc hn Gi s C(x): phc tp ca x, E(x): cng sc thc hin x. R rng: nu C(p1) > C(p2) th E(p1) > E(p2). Nu phn chia p = p1 + p2 ta thy (mt cch trc quan): C(p1 + p2) > C(p1) + C(p2) E(p1 + p2) > E(p1) + E(p2)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

143

Phn chia module nh th no?


S l ng g module ph thuc vo Tng cng sc pht trin phc tp ca h thng phn mm Vng ti u cn xy dng Qu t hoc qu nhiu mod module le u khng tt Tng cng sc tng module
S lng module
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Cng sc b ra

Cng sc tch hp

144

Kin trc phn mm


Kin trc phn mm m t cc thnh phn (component) kin to nn h thng phn mm v s giao tip gia cc thnh phn Thnh phn c th l Cc module m ngun Cc file thc thi (*.dll, *.exe, *.class...) Cc t thnh p phn ca kin t trc c h t thng: g: ActiveX ct ve co control, to, bean... Cc trang HTML, *.asp, *.jsp...
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

145

Kin trc phn mmm S phn cp


M Fan-out a Depth d f g e h k n l o m p r Width
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

S phn cp c dng miu t s phn r cc module.

Fan-in

146

Phn chia module hiu qu


Phn chia module l bt buc trong giai on thit k Tuy nhin: phn chia kin trc phn mm thnh mt b cc module nh th no l tt nht ? t c vng ti u v tng chi ph qun l v pht trin tng module Tiu Ti ch h quan tr t ng nh ht: t tnh t h c lp ch hc nng ca cc module Tnh c lp chc nng c o bng 2 tiu chun: kt dnh (cohesion) S lin kt (coupling)
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

147

kt dnh
kt dnh dng o s ph thuc ln nhau gia nhng tc v (task) ca mt module Module c kt dnh cao nht khi n ch m nh hn ng mt tc t v kt dnh d h ch hc nng Thit k kin trc phn mm: c gng tng kt dnh
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

148

Cc mc kt dnh
C nhiu mc kt dnh (t thp n cao) Ngu nhin: cc tc v khng lin h vi nhau Lun l: cc tc v lin quan logic vi nhau Nht thi: cc tc v phi c thc thi trong mt khong thi gian Giao Gi tip: cc tc t v c s dng chung h mt d liu no Th tc: cc tc v phi c thc hin theo mt trt t nht nh Chc nng: ch c mt tc v
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

149

S lin kt
S lin kt dng o c qu trnh giao tip gia cc module: giao tip ca module cha nhiu tc v v nhi hiu thng th s gi th s lin li kt cng cao Thit k kin trc phn mm: c gng gim s lin kt

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

150

Cc mc lin kt
C nhiu mc lin kt (t cao n thp) Lin kt ni dung: s dng d liu v iu khin ca module khc Lin kt chung: c s dng chung d liu ton cc Lin kt ngoi vi: module ph thuc vo mt I/O no Lin kt iu khin: thng s truyn nh hng n iu khin Lin kt stamp: truyn cu trc d liu phc tp Lin kt d liu: truyn cc thng s n gin
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

151

Nguyn l che du thng tin


Che du thng tin l mt trong nhng nguyn l quan trng ca vic phn chia module Cc module giao tip vi nhau bng nhng thng tin tht s cn thit Nhng thng tin v th tc v d liu cc b ca mi module phi c che du khi cc module khc Li ch: kim sot c thay i v sa li d dng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

152

Cc Heuristic trong phn chia module


Sa li thit k ban u tng kt dnh v gim s lin kt Khi chiu su tng, hn ch fan-out trong khi s dng f i fan-in Gi cho tm nh hng ca mt module nm bn trong tm iu khin ca n Loi b d tha trong giao tip ca cc module u tin cc module tt nh, hn ch cc module nhiu rng buc ng gi cc module t c tnh kh chuyn (portability)
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

153

Thit k d liu
Tm kim biu din lun l cho cc phn t d liu c nhn din trong giai on phn tch yu cu Thit k cc cu trc d liu ca chng trnh v c s d liu Thc hin tinh ch tng bc Cc tiu ch thit k h c s d liu Khng d tha d liu Ti u ha a khng gg gian a lu t tr Chun ha c s d liu bng lc ERD v dng chun 3
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

154

Cu trc d liu
Cu trc d liu l thit k c s d liu ng tron h thng Cu trc d liu m t s t chc, phng thc truy xut, t mc lin li kt v cc x l khc kh ca thng th tin ti D liu n l dng cu trc d liu n gin nht ch bao gm mt phn t thng tin m c th c truy xut bng mt danh nh Mt s dng phc tp hn: vector, ma trn, mng nhi h u chi h u, danh d h sch h lin l kt, hng, h ch hng, cy nh h phn c biu din cc mc tru tng ho khc nhau
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

155

M s nguyn tc thit k d liu


Mt s nguyn tc Nhn din c cu trc d liu v tc v truy xut Ch s dng t in d liu Tr hon thit k d liu mc thp cho n cui giai on ny Che Ch du biu din bn b trong t ca cu trc t d liu Pht trin mt th vin cc cu trc d liu + tc v thng gp Nn p dung kiu ADT trong thit k cng nh trong lp trnh
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

156

Thit k kin trc


Mc tiu l xy dng s phn cp module t DFD t nn mng thit k chi hi tit th tc v d liu Phn bit dng transform v dng transaction trong DFD Thc hin nh h x cho h tng vng ca DFD tu t theo th n l dng transform hay transaction
Xc nh cc module v cc mi lin h theo DFD qu trnh s l

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

157

Dng Transform
Dng transform bao gm 3 phn: dng i vo, dng x l v dng i ra

Dong i vao Dong x ly

Dong i ra

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

158

Dng Transaction
D i vo Dng

T-center t

Dng transaction bao gm: dng i vo T-center vo, T center v cc ng x l u ra T-center: Ch c mt ng ra c kch hot ti mt thi im

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

159

Thit k th tc
Thit lp thut gii cho cc module kin to sao cho c th d dng m ho bng ngn ng lp trnh c cu trc t C th biu din thut gii bng Lu thut gii: Flowchart K hiu dng g bng g N gn ng PDL

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

160

Ngn ng PDL
Ngn ng PDL vay mn t vng ca ngn ng t nhin v c php ca ngn ng lp trnh c cu trc. N c cc tnh cht sau: C php h ch ht ch h ca cc t kho kh h tr t c t cu trc, khai bo d liu, phn chia module C php t do ca ngn ng t nhin gip miu t x l Phng tin m t d liu n cng nh d liu t hp C ch nh ngha chng trnh con v phng cch gi
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

161

Ngn ng PDL V d
procedure AnalyzeTriangle( a, b, c: in real; type: out string) begin sort a, b, c so that a >= b >= c; if ( c > 0 and a < b + c ) if ( a = c ) type := : Equilateral else if ( a = b or b = c ) type := Isosceles else if ( a*a = b*b + c*c ) type := Right else type := : Scalene else type := Error end

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

162

Thit k phn mm UML

Lc cng tc Lc tun t Lc trng thi cc lp/i tng Lc hnh ng Hon chnh lc lp

Gii thiu
Giai on thit k quan tm n HOW: HOW :
Th t cc thng ip trao i, thng s ca thng ip Thut gii ca tc v p ng Cu trc d liu cho cc thuc tnh Framework (console, document/view, 3-tier...)

Thit k cng chu nh hng t:


N gn ng lp trnh v th vin lp trnh (H tr Vector, List, Map... hay khng ? H tr template hay khng ?...) Kin trc h thng (COM, CORBA hay EJB)

Thit lp m hnh ng (dynamic modeling) v chi tit ho m hnh tnh


164

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Khi nim m hnh ng


Lc lp ch m t kha cnh tnh ca h thng Hnh vi ca h thng c m t bng m hnh ng bao gm

Tng tc gia cc i tng: cng tc hay trnh t Trng thi ca i tng/lp Qu trnh hot ng ca lp/i tng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

165

Tng tc gia cc i tng


i tng tng tc vi nhau (interaction) bng cch gi/nhn kch thch (stimulus) Actor cng c th gi kch thch n i tng Kch thch khin mt tc v thc thi, mt i tng c to ra hay hu i, hoc gy ra mt tn hiu Thng ip (message) l c t ca kch thch Cc loi thng ip
n gin ng b Bt ng b Tr v ca gi hm
166

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

S cng tc Lc cng tc
Cng tc (collaboration) nh ngha tp hp cc thnh phn tham gia v quan h gia chng g Cc thnh phn tham gia l vai tr m i tng/lp ng vai khi tng tc vi nhau Cc vai tr ca i tng thng ch c ngha i vi mt mc ch no Lc cng tc (collaboration diagram) c thit lp c th ho mt use-case hoc mt tc v
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

167

Lc cng tc
Lc cng tc l mt th lin kt cc vai tr ca cc i tng hnh thnh nn cc chc nng ca h thng (cc usecase) Mi cnh h lin li kt 2 vai i tr t c biu din bng mt on thng Tng tc c th hin bng gi/nhn thng ip Hai vai tr lin kt vi nhau khi c trao i thng ip Mi thng ip c th hin bng mi tn (nh miu t) cng vi phn c t

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

168

Lc cng tc (tt)
Cc thng ip c nh s theo kiu phn cp
3.4.2 xy ra sau 3.4.1 v c hai c lng g (nested) trong g 3.4
3.4.3a v 3.4.3b xy ra ng thi v c lng trong 3.4

C php tng qut ca thng ip precedessor guard-condition sequence-expression returnvalue := message-name argument-list V d: 2/ 1.3.1: 1 3 1 p := find(specs)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

169

Lc cng tc (tt)
Lc cng tc c th c thit lp mt trong 2 dng: Dng c th: mi vai tr c biu din bng mt k hiu

ca i tng c th, cc thng th ip c trao t i trn t cc ng lin kt vo cc thng ip

Dng g c t: m t cc lp; cc ng g lin kt c nh x Thit lp lc cng tc gip c th ho (realize) cc use case v nhn din thm mt s tc v ca cc i use-case tng/lp phn tch

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

170

Lc cng tc V d
z V d: lc cng tc mc c th cho use-case use case Login ca h thng ng k mn hc tn ch qua WEB
1: login(uname,pswd) 1.2 [succ = true]: welcome

: People

: LoginForm

: Database D t b

1.1: succ := Verify(uname,pswd)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

171

Lc cng tc v d 2
V d: lc cng tc mc c th cho use-case Registers course ca h thng ng k mn hc tn ch qua WEB
: Registration : Student 2: register 1: submit(uname submit(uname, psswd) 1.2 [succ = true]: welcome 3: submit(crsOffering) 2.1: create 1.1: succ := verify(uname, psswd) regForm : RegisterForm 3.1: reg := FetchReg(crsOffering) 3.3: SetReg(reg) 3.2: AddStudent(code) : Database : LoginForm

3.4: beSuccessful

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

172

Miu t trnh t
Lc cng tc miu t s tng tc theo kha cnh khng gian nhn mnh trnh t ca tng g tc dng g lc tun t (sequence diagram) Lc tun t miu t cc i tng tng tc vi nhau h theo th thi gian i sng ca n Cc thng ip c trao i theo trnh t thi gian Cc mi lin kt khng c th hin trong lc
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

173

Lc tun t
Lc tun t c 2 dng
Dng tng qut: th hin c vng lp v r nhnh Dng c th: miu t mt kch bn c th

Thi g gian sng g ca mi i t ng g c m t theo mt ng thng ng Thng thng thi gian tri theo chiu t trn xung di t khi quan tm n khong thi gian, gian thng ch quan tm n trnh t m thi Thanh hnh ch nht m t s thc thi ca mt tc v p ng li thng ip gi n. di ca thanh ch nht phn nh thi gian thc thi ca tc v v tnh cht lng nhau (nested) gia chng Cc dng text ph tr (m t tc v, rng buc thi gian...) c vit l tri
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

174

Lc tun t - V d
V d: lc tun t dng tng qut
ob2 : C2
: People eop e

ob3 : C3

ob4 : C4

new( ) ob1 : C1 [x<0] op2( ) [x>=0] op3( ) op4( y ) op5( ob3 ) display( )

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

175

Lc tun t - V d
L c tun t vi cc g ghi ch rng g buc thi g gian
:Computer
: Operator

:PrinterServer

:Printer

print(ps-file ) a {b - a < 5 seconds} b

print(ps-file) print(ps-file)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

176

Lc tun t - V d
V d: lc tun t dng c th cho use use-case case Login ca h thng ng k mn hc tn ch qua WEB

: People

: LoginForm 1 submit(uname, 1: b it( psswd) d) 1.2: welcome

: Database

1.1: verify(uname, psswd)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

177

Lc tun t - V d
Lc tun
: Student

regForm : RegisterForm 1: submit(uname, psswd) 1 2: welcome 1.2:

: LoginForm

: Registration

: Database

t dng c th cho use-

1.1: verify(uname, psswd)

2: register 2.1: create

case
3.1: reg := fetchReg(srcOffering)

3. submit(crsOffering)

Register courses cou ses

3.2: addStudent(code) 3.3: setReg(reg) 3.4: beSuccessful( )

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

178

Trng thi ca i tng


Chun UML a ra lc trng thi biu din hnh vi ca mt phn t bt k bng cch ch ra p p ng g ca n i vi cc s kin bn ngoi Thng thng lc trng thi c p dng cho i tng/lp biu din hnh vi ca lp Trng thi ca mi i tng (nh ngha gc ?) t nhiu s b thay i trong sut chu k sng ca i tng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

179

Trng thi ca i tng


Trong UML k hiu ca trng thi l mt hnh ch nht trn gc v c chia lm nhiu phn phn cch nhau bng cc on thng nm ngang: Ph hn tn Phn miu t cc hnh ng bn trong
Typing Password entry / set echo visible exit / set echo normal character / handle character help / display help

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

180

Trng thi ca i tng


Tn trng g thi l duy y nht trong g l c ; c th khng g c tn (trng thi v danh) Cc hnh ng bn trong: cc hnh ng hoc tc v c thc hin khi i tng nm trng thi ang xt; c c php nh sau action-label / action-expression Mt s nhn h hnh h h ng (action-label) ( i l b l) c quy c trc:
entry: thc hin hnh ng ti thi im bt u trng thi exit: thc hin hnh ng ti thi im kt thc trng thi do: thc hin hnh ng sut trng thi hoc cho n khi kt thc n include: triu gi mt my trng thi con khc

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

181

Trng thi ca i tng


Cc nhn hnh ng khc ch ra s kin kch hot hnh ng tng ng trong biu thc hnh ng (action-expression) C php ca biu thc hnh ng event-name ( ( parameter-list ) ) [guard-condition] [ guard-condition ] / / action-expression

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

182

Lc trng thi
Trng thi bt u: khi i tng c to ra hoc trng thi tng hp c xc nh; k hiu

Trng thi kt thc: khi i tng b hu b hoc trng thi tng hp tr nn khng xc nh; k hiu

Trng thi tng hp (composite) c phn r thnh nhiu trng thi con ng thi hoc cc trng thi con l i tr lo t nhau h
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

183

Lc trng thi trng thi tng hp


Phn r trng thi tng hp Running
R nning Running Forward Backward

Slow

Fast

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

184

Lc trng thi
S kin (event) kch hot dch chuyn trng thi, c th l
Mt iu kin tr nn ng (ch khc vi guard-condition) Mt i tng nhn tn hiu t i tng khc Mt php gi tc v Mt khong thi gian tri qua k t mt s kin no

C php ca s kin: event-name ( parameter-list ) S kin c tm vc thuc v package cha lp ang m t lc trng thi, ch khng ch thuc v ring lp

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

185

Lc trng thi Dch chuyn


Dch chuyn trng thi l quan h gia hai trng thi theo i tng ang trng thi th nht s chuyn sang trng thi th hai ng thi s thc hin mt s hnh ng khi s kin tng ng xy ra v tho mn mt s iu kin nht nh c k hiu nh mt mi tn hng g t trng g thi ngun n trng thi ch v c gn nhn Nhn c c php: event-signature [ guard-condition ] / action-expression action expression

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

186

Lc trng thi V d
lc trng thi ca lp Message
hightlight Composed compose command focus Read
entry/ convert to rich text

entry/ assign ID exit/ fill date re-fwd cmd / quote / append subject on char/ handle character

save command send command[ recipents != null ] / parse

read command / recover( id ) unhightlight Stored

Sending
do/ send( repc )

sending done

logout

entry/ save into folder

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

187

Lc trng thi v d 2
import failed

No map run do/ load map do/ load image image loaded exit command Saved entry/ render do/ store

map loaded[ image invalid ]

Modeling do/ model(map, param)

import / map := create( file )

modeling done import / map := create(file)

exit command

import command[ file valid ] model command viewing command save command exit command / save Dirty entry/ render Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

188

Lc hot ng
L c hot ng g( (activity y diagram) g ) l mt bin th ca l c trng thi trong trng thi l s thc thi mt hnh ng v s dch chuyn c kch hot khi hnh ng hon tt c dng g m t mt th tc hay y thut g gii tp trung g vo cc hnh ng Mi hnh ng c k hiu bng hnh v nh sau

work
Q Quyt nh r nhnh: nhnh hnh thoi c mt ng vo o v nhiu nhnh ra, mi nhnh c gn mt guard-condition Cc nhnh ra c nhp li bng mt hnh thoi khc Mi ng bi (swimlane) i din mt lp hoc mt actor
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

189

Lc hot ng v d
LoginForm Database

Show input for username and password Verify

[ psswd d invalid i lid ]

[ psswd valid ]

Reject

Welcome

lc hot ng cho tc v submit ca LoginF orm

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

190

Lc hot ng v d 2
RegForm
submit Read course offerings Look for registration

Database

Registration

[ reg found ] [ reg not found ] Create registration Fetch registration

Lc hot ng cho tc v submit ca RegisterForm

Show success

Update registration

Add student

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

191

Nhn din mt s lp thit k


M hnh thit k phn no chu nh hng t ngn ng lp trnh, th vin h tr, framework, h iu hnh v loi my tnh Mt s lp s xut hin khi p dng nh hng yu t trn t N gn ng lp trnh: template, CObject... Th vin h tr: lp Date, Date Time, Time List, List Map, Map vector, vector iostream Framework: Applet, Panel, CDocument, CView, HttpServlet H iu hnh: cc lp thao tc file, m cu ni network, cc phn t giao din. n
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

192

Nhn din mt s lp thit k


Mt s lp khc xut hin lm chc nng duyt (iterate) mt lp khc hay thc hin cc tnh ton phc tp... S dng tr t c tip cc lp do d th vi in hay h ngn ng cung cp, hoc To ra lp mi bng cch tha k hay tch hp cc lp c sn, v d CArray<Isoquant, Isoquant&> B sung cc lp mi vo lc lp ng thi cp nht cc mi quan h mi (bao gp, ph thuc)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

193

c t chi tit cc thuc tnh


Trong g m hnh p phn tch cn phi ch r kiu (hoc cu trc d liu) v mc truy xut ca cc thuc tnh C th chn mt lp cung cp bi th vin lp trnh c th ho kiu hay cu trc d liu b sung lp ca th vi in v quan q an h bao gp vo lc lp Message <<entity>> # subject: String # content: String + GetSubject( ): String + toString( ): String

sent
CDate

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

194

Nhn din chnh xc cc tc v


Cc lc m t hnh vi (cng tc, tun t, trng thi, hnh ng) gip nhn din chnh xc cc tc v ca cc lp Da vo cc thng th ip hay h hnh h h ng xc nh h signature ca cc tc v V d: nhn din mt tc v ca lp Database fetchStudent( code: Long ): StudentInfo; setReg( reg: Registration );

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

195

Nhn din chnh xc cc tc v (tt)


V d: nhn din mt tc v ca lp ChildView render( ); store( ); load( ); model( map: FieldMap, param ); V d: nhn din mt tc v ca lp LoginForm submit( b it( uname: String; St i psswd: d String St i ); ) makeWelcome( );

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

196

Hon chnh lc lp
Cp nht cc lp mi, thuc tnh, tc v v cc mi quan h mi UML nh ngha quan h ph thuc (dependency) gi ia 2 lp ho h c package: k th i mt lp, package thay k ko theo thay i lp, package kia K hiu ca quan h ph thuc l mi tn t nt: lp, package pha ui mi tn ph thuc vo lp, package pha u mi tn Mt s stereotype quy c tr c: <<call>>, ll <<instantiate>>, <<import>>, <<refine>>, , <<derive>>, , <<trace>> <<realize>>,
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

197

Hon chnh lc lp V d
thm lc lp cho h thng ng k mn hc
LoginForm <<boundary>> + submit(uname: String, psswd: String) + makeWelcome( ) <<call> > RegisterForm <<boundary>> + submit(offering: CourseOffering) + beSuccessful( ) Database + fetchStudent(code: Long): StudentInfo + setReg(reg: Registration)
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

<<call> >

198

Hon chnh lc lp v d 2
# map FieldMap <<entity>> i

FractureIterator + current( ): F Fracture* * MapIterator # setBound(b: int) + current( ): Item + operator++() + operator--() () + Last( ) + First( )

Item

<<friend>> fi d MapIterator<Isoquant* >

MapIterator<Fracture*>

IsoquantIterator + current( ): Isoquant*

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

199

Hon chnh lc lp - package


Ch s dng package t chc cc phn t lin quan vi nhau: cc lp v bn a hnh, v thng tin sinh vin/ging vin, v ca s giao din, v cc servlet servlet Cc package th hin kin trc phn mm, thng g chu nh hng g t framework thng (Document/View, 3-tiers...) Mi package cha mt hoc mt vi lc lp, trong c th tham chiu n mt s lp thuc cc package khc

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

200

M hnh thit k bao trm c kha cnh tnh v ng ca h thng phn mm cn xy dng UML h tr mt s lc gip m ) Cc thnh phn t kha cnh ng: cng tc, tun t, ) Cc thit b trng thi, hnh ng Miu Mi t chnh h h xc thu th c tnh t h v tc t v, b sung mt s lp thit k hon thin kha cnh tnh Thit lp cc package to thnh kin trc phn mm

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

201

HIN THC V TRIN KHAI


) Cc thnh phn ) Cc thit b

Gii thiu
Cn phi xy dng chng t nh chy c t kt qa ca trnh giai on thit k Cc lp s c c th ho vo cc thnh phn phn mm nh th no v bng ngn ng lp trnh g ? Chng trnh s c ci t ra sao trn ti nguyn g tnh ton ?

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

203

Thnh p phn (Component) ( p )


Thnh phn (component) biu din mt phn hin thc no ca h thng Mt s stereotype quy c trc: c:
<<file>>: m ngun hay d liu <<executable>>: chng trnh chy c <<library>>: th vin lin kt tnh hay ng <<document>>: ti liu c thit lp trong qu trnh pht trin <<table>>: bng c s d liu

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

204

Thnh p phn (Component) ( p )


Thnh phn phn mm (software

bao gm

component)

M ngun: *.cpp, *.c, *.pas, *.java, *.bas M i tng: *.obj M nh phn: *.class Ch ng trnh t h thc thi: thi *.dll, * dll *.exe *

Thnh phn phn mm c th tn ti trong thi gian bin dch, ch thi gian lin kt chng trnh hoc thi gian thc thi

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

205

L c thnh ph p n
Lc thnh phn l mt th gm cc thnh phn kt ni vi nhau bi quan h ph thuc K hiu ca thnh phn c th bao gm mt s hnh trn biu din cc giao tip v cha cc lp m n c th ho

Component-name Class-name

Interface-name

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

206

L c thnh ph p n V d
z V d: lc thnh phn th hin mt s module m ngun ca chng trnh hin th b mt a hnh
GeoMap <<file>> FieldMap <<file>> FieldMap Isoquant q MapCurve <<file>> MapCurve
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Fracture

207

L c thnh ph p n V d
z V d: lc thnh phn th hin thi gian thc thi ca chng trnh hin th b mt a hnh
op12_dp.dll <<library>> cbsLoader12_dp.dll <<library>>

FieldVis.exe <<executable>> Cosmo3D12.dll <<library>> IFL0.dll <<library>> lib MFC42.dll <<library>>

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

208

L c thnh ph p n V d
z V d: lc thnh phn ca h thng ng k mn hc
People <<file>> Register <<file>> PeopleInfo RegisterForm StudentInfo LectureInfo Database

Login <<file>> LoginForm


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Index.shtml <<page>>
209

Gn cc lp vo cc thnh p phn
Khi thit lp cc thnh phn m ngun, ch gn (bind) cc lp thit k v chn ngn ng lp trnh
Gn lp FieldMap vo thnh phn FieldMap (C++) Gn lp MapCurve, Isoquant v Fracture vo thnh phn MapCurve Gn lp PeopleInfo, PeopleInfo StudentInfo, StudentInfo LectureInfo v Database vo thnh phn People (Java) Gn lp v LoginForm vo thnh phn Login (Java)

K hiu ca thnh phn cha k hiu ca lp c gn Ch : component package


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

210

Sinh m ngu g n Sourse code g generation


Da vo c t lp vit m cho tng thnh phn m ngun theo ngn ng lp trnh chn Vit m sn l cng vic hi nhm chn c th c t ng ho bi cc cng c CASE

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

211

Node trin khai


Node l mt thit b vt l c kh nng tnh ton, bao gm: m: my tnh, my in, thit b qut card, router router Node c m t c 2 dng: ng: dng lp v dng instance Node c k hiu nh hnh hp ba chiu Cc minh d ca thnh phn c th sng trong mt minh d node
Dell Pentium III 600 Server of 600: Dell Pentium III 600

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

212

Kt ni g gia cc node
z C th ch ra quan h lin kt gia cc node m t cu hnh kt ni (connection)

:Pentium II 450

<<TCP/IP>> :Silicon Graphics <<TCP/IP>> :Sun Ultra1

:Pentium III 600

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

213

L c trin khai
Lc trin khai cho php miu t cch ci t cc thnh phn thc thi trn cc node V d: h thng ng k mn hc qua WEB
Java WEB Server: Pentium III 600 <<TCP/IP>> Client: Pentium MMX 200

Index.shtml << <<page>> >>

CheckApplet <<applet>>

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

214

L c trin khai
V d: chng trnh hin th b mt a hnh
WindowsNT workstation: Pentium II 450
cbsLoader12_dp.dll <<library>>

op12_dp.dll <<library>> FieldVis.exe <<executable>> executable IFL0.dll <<library>> MFC42.dll <<library>>

Cosmo3D12.dll <<library>>

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

215

Tng g kt
Hin thc v trin khai tp trung g vo xy dng cc thnh phn chy c hoc cc th vin, module m ngun, n trang HTML, HTML dng nh phn phn... ... Cc thnh phn m ngun c th ho mt s lp thit k v c th c vit bng cc ngn ng lp trnh khc nhau Cui cng trin khai cc thnh phn chy c trn cc thit b tnh ton

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

216

Kim nghim phn mm

K thut kim tra phn mm Kim tra t cc ng thc thi c lp Chin thut kim tra phn mm Alpha, Beta testing

Ti sao phi kim tra phn mm


Mc d c t ng g ho mt phn bi cc cng c CASE, rt nhiu cng on trong qu trnh sn xut phn mm vn c thc hin bi con ngi vn c kh nng xy ra li. g tt c cc Li c th xy ra trong giai on: phn tch yu cu, thit k, m ho Do p phi kim nghi g m chng g trnh trc khi chnh thc s dng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

218

Mt s quan im khi nim


Kim nghi g m p phn mm l hot ng g thc thi chng trnh vi mc ch tm ra li ph phn, khng phi mang tnh xy dng Phn loi: Kim nghim black-box: kim tra cc chc nng c th ca phn mm, khng quan tm cu trc bn trong, thng p dng cho nhng module mod le ln. n Kim nghim white-box: kim tra cu trc iu khin bn trong chng trnh, thng dng cho nhng nhng module nh. Mi loi kim nghim c kh nng tm ra nhng nhm li khc nhau nn kt hp c hai
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

219

Mc tiu ca kim nghim phn mm


Mc tiu ca kim nghim phn mm l tm ra li (nu c) vi chi ph thp nht. Kim nghim phn mm gip Pht hin c li trong chng trnh (nu c). Chng minh c phn mm hot ng ng nh thit k. Chng minh phn mm c vit ng C Chng g minh c p phn mm p ng g yu cu ca use user Gp phn chng minh cht lng ca phn mm.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

220

Mc tiu ca kim nghim phn mm


Qu trnh kim nghim phn mm l tt khi C kh nng tm ra li cao. Khng d tha. Bit chn lc: ch kim nghim nhng phn no c kh nng tm ra li c trng. Khng Kh qu ph hc tp cng khng kh qu n gi in. Ch : Kim nghim phn mm khng khng nh c phn mm khng cn khim khuyt, ch khng nh c phn mm c li v gip gim thiu li

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

221

Cc nguyn l kim nghim phn mm


Vic kim nghim nn hng v yu cu ca khch hng Nn c hoch nh trc mt thi gian di. p dng nguyn l Pareto (nguyn tc 80-20): 80% li c nguyn nhn t 20% cc module c lp v kim tra nhng module kh nghi nht. t Nn tin hnh t nh n ln: bt u t nhng module ring bit ri sau tch hp cc module li. Khng th kim nghim trit mt phn mm. Nn c thc hin bi nhng i tng KHNG tham gia i vo qu trnh t h pht ht tri t in ph hn mm.
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

222

Phng php kim nghim Test case


Thit lp cc test case vn hnh th - so snh kt qu Khi nim test-case D liu input Thao tc kim nghim D liu output t t hay h p ng mong i ca ch hng trnh t h Test-case cho kim nghim black-box: ch yu da vo cc yu cu c th ca chc nng phn mm. Test-case cho kim nghim white-box: ch yu da vo cu trc iu khin ca phn mm vn t ra: s lng test-case t t cn thit l qu ln
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

223

Kim nghim cc ng c lp c bn
Kim nghim white white-box box da vo cu trc iu khin ca thit k th tc sinh cc test-case vi tiu ch Kim nghim cc ng c lp c bn l mt trong nh hng ph hng cch h kim nghi him white-box hi b Bo m s php th l t nht pht hin cc li Tt c cc ng thc thi c lp c th qua t nht mt ln Th cc iu kin r nhnh c 2 nhnh true v false Th qua vng lp ti bin cng nh bn trong Th qua cu trc d liu m bo tnh ton vn ca n
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

224

th dng chy
Mi node hnh trn biu din mt hoc mt vi tc v (hi khc so vi lu thut gii) Cnh c hng miu t ng thc thi th dng chy c xy dng t lu thut gii
sequence if until while case

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

225

Xy dng th dng chy V d


1 1
2,3

2 3 6 7 9 8 10 11
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

6 7 8 9 10

4,5

4 5

11

226

Xy dng th dng chy V d


p procedure: DoSomething g 1: do while x=0 2: if y=0 then 3: z=0; 4: elseif k=0 then 5: z=1; 6: else x=1; 7: endif; endif; ; 8: enddo 9: end
1 2 4 6 7 8 5

9
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

227

Xy dng th dng chy


Phi phn r tt c cc iu kin phc tr thnh cc iu kin n Mi node m t mt iu kin n c gi l predicate di t
a b x y b x a

if a and b then y else x


Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

while a or b do x
228

Xy dng th dng chy v d


procedure AnalyzeTriangle
5 a=c a<b+c 2 c>0 1 3 a=b 4 6 8 b=c a2=b2+c2 9 10 12 7

11

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

229

Cc ng c lp c bn
ng thc thi? ng thc thi c bn Cc ng thc thi c lp c bn T node bt u n node kt thc, cc ng thc thi c bn c lit k theo mt th t no m bo rng: ng ang lit k t nht i qua mt cnh cha c duyt qua bi cc ng lit k trc Tng s ng thc thi c bn c lp nhau c tnh bng V = P + 1; trong P l s node phn nhnh (predicate)
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

230

Cc ng c lp c bn v d
i vi chng g trnh con DoSomething Tng s ng : V=3+1=4 ng 1: 1-9 ng 2: 1-2-3-8-1 ng 3: 3 1-2-4-5-7-8-1 1245781 ng 4: 1-2-4-6-7-8-1 Ch : du 3 chm () mang ngha khng quan tm, t c th i theo bt k cnh no bi v cc cnh sau c duyt qua ri
1 2 4 6 7 8 5

9
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

231

Cc ng c lp c bn v d
i vi chng g trnh con 5 AnalyzeTriangle a=c Tng s ng : 4 a<b+ 7 c V=6+1=7 2 6 ng 1: 1-3-12 c > a=b 0 g 2: 1-2-3-12 1 ng 8 b=c ng 3: 1-2-4-5-12 ng 4: 1-2-4-6-7-12 3 ng 5: 5 1-2-4-6-8-7-12 1 2 4 6 8 7 12 ng 6: 1-2-4-6-8-9-10-12 ng 7: 1 1-2-4-6-8-9-11-12 2 4 6 8 9 11 12
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

a2=b2 +c2 9

10

12

11

232

Thit lp cc test case


Thit lp mt test-case cho mi ng g thc thi c bn Da vo thut gii tm ra mt d liu input, sau tnh ra d liu output hay p ng mong i ca thut gii Ch : c th khng to ra c test test-case case cho mt ng thc thi no

V d Sinh test-case cho chng trnh con AnalyzeTriangle


Test-case cho ng 1: Input: Output mong i: Test-case cho ng 2: Input: Output mong i: Test-case cho ng 3: Input: O t t mong i: Output i a = 3, b = 2, c = 0 type = Error a = 17, b = 5, c = 4 type = Error a = 6, b = 6, c = 6 t type = Equilateral E il t l

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

233

Tng kt
Mc tiu ca kim nghim phn mm l tm ra li Hai loi kim nghim: white-box v black-box. Kim nghim cc ng c lp c bn dng trong kim nghim white-box, bao gm cc bc Thit lp th dng chy Lit k cc ng thc thi c lp c bn Sinh cc test-case cho cc ng thc thi Thc hin cc test case v kim tra kt qu Kim nghim Black-box thng dng trong bc kim nghim tnh nng ca phn mm
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

234

Chin thut kim nghim phn mm

Verification & Validation Unit U it test t t & Integration I t ti test t t Kim nghim hng i tng Ngh thut g ri

Khi nim
Chin thut kim tra phn mm tch hp cc phng php to ra test-case tr thnh mt chui cc bc c th t c th kim nghim phn mm thnh cng vi chi ph thp. Bao gm cc cng vic Lp k hoch kim nghim
Sinh test-case Th hc hin kim nghi him, thu h th hp kt qa v nh h gi i

Verification: cc hnh ng m bo cho phn mm c hin thc ng theo mt chc nng c th no Are we building the product right ? Validation: cc hnh ng m bo cho phn mm c xy dng theo ng yu cu ca khch hng Are Are we building the right product ?
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

236

Mt chin thut kim nghim ph bin


Phn tch ton b h thng Kim nghim ton b h thng

Phn tch yu cu

Kim nghim tnh nng

Thit k

Kim nghim tch hp

M ha

Kim nghim n v (module)

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

237

Mt chin thut kim nghim ph bin


Bt u ti tng module ri tch hp ln dn n ton b h thng. Cc k thut khc nhau c s dng thch hp ti cc giai i i on khc kh nhau. h Kim nghim c th c tin hnh bi ngi pht trin phn mm, nhng i vi cc d n ln th vic kim nghim phi c tin hnh bi mt nhm c lp. Kim nghi h m v sa li l cc ho h t ng c lp nhng vic sa li phi ph hp vi cc chin thut g m. kim nghi
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

238

Kim nghim tng module


Tin hnh kim nghim trn tng n v nh nht ca phn mm, l module m ngun, sau khi thit k, m ho v bin dch thnh cng Th ng dng d k thu th t kim nghi him white-box hit b C th tin hnh kim nghim cng lc nhiu module. Mt s vn trong vic xy dng cc test case Test case no? D liu u vo v u ra a c t u? Tnh c lp/ph thuc hot ng ca cc module

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

239

Kim nghim module


interface local data structures Module . ~~~~~~ ~~~~~~ ~~~~~~ stub stub testcases
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

driver

boundary conditions independent paths error handling paths

240

Kim nghim module


Mi module m ngu g n khng gp phi l mt chng g trnh hon chnh v i khi phi gi cc module cha c kim nghim khc c th phi thit lp driver v/ho / c stub: p ph tn kh ln ( (70%) ) Driver l mt chng trnh chnh c nhim v nhn d liu kim nghim, chuyn d liu xung cho module kim tra v in ra cc kt qu kim tra tng ng. Stub thay th cc module c gi bi module ang kim tra. tra gim cc chi p ph to driver hay y stub Lm th no g
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

241

Kim nghim tch hp


Tng module m ngun hot ng ng. Liu khi kt hp chng li thnh mt nhm ln chng c hot ng ng khng ? Phi tin hnh h h kim nghi him tch t h hp pht ht hin li lin quan n giao tip gia cc module. Trnh tch hp kiu big-bang: tt c cc module c kt hp li, v ton b chng trnh s c kim nghi h m mt lc l Nn tch hp tng dn: t trn xung hoc t di ln

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

242

Tch hp t trn xung


Module chnh c dng nh l driver, v stub c thay th bi cc module con trc tip ca ca module chnh ny. Tu T thu th c vo cch h tch t h hp theo th chi hiu su (depth(d th first) hoc chiu ngang(breath-first), mi stub con c thay y th mt ln bi module tng g ng g kim nghim. Tin hnh kim nghim khi c s thay th mi Tin hnh h h ki k m nghi h m hi quy pht h hi h n cc li khc trong tng module

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

243

Tch hp t trn xung


M1

M2

M3

M4

M5

M6

M7
Tch hp kiu t trn xung theo hnh thc depth-first Tit kim c chi ph to cc driver
244

M8

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

Tch hp t di ln
Cc module mc thp nht c kt hp thnh cc nhm th hin mt chc nng con c bit ca phn mm. Mt driver di c to ra thao th tc t cc test-case t t Cc module c kim nghim theo tng nhm (Cluster): l nhm cc module m module pha trn cn n khi kim nghim Driver c b i v cc nhm module c kt hp dn ln l pha h trn trong s phn h cp ca ch hng trnh. Tit kim c chi ph to cc stub
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

245

Tch hp t di ln
Mo Ma D1 D2 Mb D3

cluster r3

cluster 1

cluster 2

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

246

Kim nghim hi quy


Vic kt hp cc module li vi nhau c th nh hng n vng lp iu khin, cu trc d liu hay I/O chia s trong mt s module iu lm l l ra mt s li khng kh th pht ht hin c khi tin hnh kim nghim theo n v Phi kim nghim hi quy khi tch hp Kim nghim hi quy c th c tin hnh th cng bng cch thc hin li cc test-case to ra. Hoc c th h dng d mt cng c capture-playback l b k th hc hin t ng

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

247

Kim nghim tnh nng


Kim nghi g m tnh nng g hiu theo cch n g gin nht l: kim tra cc chc nng ca phn mm p ng c nhu cu ca khch hng c xc nh trong g vn bn c t y yu cu ca p phn mm p dng k thut black-box Kim nghim tnh nng bao gm Xem xt li cu hnh phn mm theo lc trin khai Kim nghim alpha Kim nghim beta
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

248

Kim nghim tnh nng


Kim nghim alpha
c tin hnh ngay ti ni sn xut phn mm. p trin p phn mm s q quan st ng gi s dng g N h pht dng sn phNm v ghi nhn li nhng li pht sinh sa cha.

Kim nghi him beta b t


Phn mm c kim tra bn ngoi phm vi ca n v sn xut. t Khch hnh trc tip s dng v ghi nhn li bo li cho nh pht trin sa cha.
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

249

Kim nghim hng i tng


V c bn chin thut kim nghim hng i tng cng theo th t ging nh kim nghim c in: Kim nghim n v Kim nghim tch hp Kim nghim chc nng Kim nghim ton b h thng
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

250

Kim nghim hng i tng


Khng th tch ri tng tc v ca i tng/lp kim nghim Tc v c ng bao trong lp Cc lp con c th override mt tc v no Kim nghi him n v hng i tng tp trung t vo cc lp kim nghim hnh vi ca lp

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

251

Kim nghim tch hp hng i tng


Khi nim s phn cp khng cn nhiu ngha trong chng trnh hng i tng kim nghim tch hp theo cch khc Hai hnh thc kim nghim tch hp hng i tng Kim nghim trn c s thread: tch hp cc lp to thnh mt thread phc v cho mt input no ca chng trnh Kim nghim trn c s s dng: cc lp client s c tch hp s dng dch v no cung cp bi cc lp server
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

252

Kim nghim theo kch bn


Da vo cc use use-case case son ra cc kch bn V d: mt kch bn cho h thng ng k mn hc qua WEB 1. Login vi username = e59306547, password = 6547 2. Chn chc nng ng k mn hc 3 Chn 5 nhm 3. h mn hc ca 5 mn: CNPM, CNPM AI, AI XLTHS, XLTHS PTTK, XLSS trong c 2 nhm trng thi kho biu 4. Nhn nt Submit Chng trnh phi bo li v lit k 2 nhm b trng thi kho biu
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

253

Ngh thut g ri - DEBUG


G ri l mt qu trnh nhm loi b cc li c pht hin trong qu trnh kim tra. G ri c thc hin nh l mt kt qu ca vic kim tra: li pht hin c tm kim nguyn nhn sa li C 3 hnh thc g ri: brute force, loi tr nguyn nhn v theo vt. Nn dng kt hp c 3 hnh thc ny.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

254

Ngh thut g ri
G ri l cng vic kh khn v d gy tm l chn nn bi nguyn g nhn gy ra li nhiu khi li m h: do timeout, do chnh xc, , do ch quan lp trnh... Kh nng g ri gn nh l bm sinh ca mi ngi

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

255

Brute Force
L p phng g p php p p ph bin nht nhng g li t hiu q qu nht cho vic pht hin nguyn nhn gy li phn mm. Trit l ca phng php ny l: Hy Hy my tnh tm ra li. C 3 cch thc hin: Ly d liu trong b nh h xem xt. Dng run-time trace tm li. Dng lnh WRITE xut d liu cn kim tra ra mn hnh. p dng phng php ny khi tt c cc phng php khc u tht bi. i
Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin
Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

256

Loi tr nguyn nhn


Phng php ny da trn nguyn tc phn chia nh phn. Cch thc hin: Khi mt li c pht hin, c gng a ra mt danh sch cc nguyn nhn c th gy ra li. Danh sch ny c nghim li loi b dn cc nguyn nhn khng ng cho n khi tm thy mt nguyn nhn kh nghi nht. Khi d liu kim nghim s c tinh ch li tip tc tm li.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

257

Theo vt
L mt phng php g li kh ph bin c th dng thnh cng trong cc chng trnh nh nhng kh p dng cho h i vi cc ch hng trnh t h rt ln. Cch thc hin: bt u ti dng m ngun c triu chng li thc hin ln ngc tr li tng dng m ngun cho n khi tm thy dng gy ra li.

Trng i Hc Bch Khoa - Khoa Cng N gh Thng Tin


Copyright 2004 Th.S N guyn Cao Tr caotri@hcmut.edu.vn

258

Kt thc mn hc
Thi cui k ?
Gii thiu-Phn tch Thit k - Hin thc/trin khai Kim nghim - UML Tt c ni dung

Chc mng bn hon tt mn hc Cng Ngh Phn Mm !