You are on page 1of 7

BIU (DIAGRAM)

Biu l cc hnh v bao gm cc k hiu phn t m hnh ha c sp xp minh ha mt thnh phn c th hay mt kha cnh c th ca h thng. Mt m hnh h thng thng c nhiu loi biu , mi loi c nhiu biu khc nhau. Mt biu l mt thnh phn ca mt hng nhn c th; v khi c v ra, n thng thng cng c xp vo mt hng nhn. Mt khc, mt s loi biu c th l thnh phn ca nhiu hng nhn khc nhau, ty thuc vo ni dung ca biu . Phn sau miu t cc khi nim cn bn nm ng sau mi loi biu . Tt c cc chi tit v biu , ng cnh ca chng, ngha chnh xc ca chng v s tng tc gia chng vi nhau c miu t chi tit trong cc chng sau (m hnh i tng m hnh ng). Cc biu ly lm v d y c ly ra t nhiu loi h thng khc nhau ch ra nt phong ph v kh nng p dng rng khp ca ULM. 4.1- Biu Use case (Use Case Diagram): Mt biu Use case ch ra mt s lng cc tc nhn ngoi cnh v mi lin kt ca chng i vi Use case m h thng cung cp (nhn hnh 3.2). Mt Use case l mt li miu t ca mt chc nng m h thng cung cp. Li miu t Use case thng l mt vn bn ti liu, nhng km theo cng c th l mt biu hot ng. Cc Use case c miu t duy nht theo hng nhn t ngoi vo ca cc tc nhn (hnh vi ca h thng theo nh s mong i ca ngi s dng), khng miu t chc nng c cung cp s hot ng ni b bn trong h thng ra sao. Cc Use case nh ngha cc yu cu v mt chc nng i vi h thng. Cc biu Use case s c miu t chi tit hn trong chng 4 (Use case).

Hnh 3.2- Biu use case ca mt cng ty bo him 4.2- Biu lp (Class Diagram):

Mt biu lp ch ra cu trc tnh ca cc lp trong h thng (nhn hnh 3.3). Cc lp l i din cho cc vt c x l trong h thng. Cc lp c th quan h vi nhau trong nhiu dng thc: lin kt (associated - c ni kt vi nhau), ph thuc (dependent mt lp ny ph thuc vo lp khc), chuyn bit ha (specialized - mt lp ny l mt kt qu chuyn bit ha ca lp khc), hay ng gi ( packaged - hp vi nhau thnh mt n v). Tt c cc mi quan h u c th hin trong biu lp, i km vi cu trc bn trong ca cc lp theo khi nim thuc tnh (attribute) v th tc (operation). Biu c coi l biu tnh theo phng din cu trc c miu t y c hiu lc ti bt k thi im no trong ton b vng i h thng. Mt h thng thng s c mt lot cc biu lp chng phi bao gi tt c cc biu lp ny cng c nhp vo mt biu lp tng th duy nht v mt lp c th tham gia vo nhiu biu lp. Biu lp c miu t chi tit trong chng sau.

Hnh 3.3 - Biu lp cho mt giao dch Ti chnh 4.3- Biu i tng (Object Diagram): Mt biu i tng l mt phin bn ca biu lp v thng cng s dng cc k hiu nh biu lp. S khc bit gia hai loi biu ny nm ch biu i tng ch ra mt lot cc i tng thc th ca lp, thay v cc lp. Mt biu i tng v vy l mt v d ca biu lp, ch ra mt bc tranh thc t c th xy ra khi h thng thc thi: bc tranh m h thng c th c ti mt thi im no . Biu i tng s dng chung cc k hiu ca biu lp, ch tr hai ngoi l: i tng c vit vi tn c gch di v tt c cc thc th trong mt mi quan h u c ch ra (nhn hnh 3.4). Biu i tng khng quan trng bng biu lp, chng c th c s dng v d ha mt biu lp phc tp, ch ra vi nhng thc th c th v nhng mi quan h nh th th bc tranh ton cnh s ra sao. Mt biu i tng thng thng c s dng lm mt thnh phn ca mt biu cng tc (collaboration), ch ra li ng x ng gia mt lot cc i tng.

Hnh 3.4 - Biu lp v biu i tng th hin ca lp 4.4- Biu trng thi (State Diagram): Mt biu trng thi thng l mt s b sung cho li miu t mt lp. N ch ra tt c cc trng thi m i tng ca lp ny c th c, v nhng s kin (event) no s gy ra s thay i trng thi (hnh 3.5). Mt s kin c th xy ra khi mt i tng t gi thng ip n cho n - v d nh thng bo rng mt khong thi gian c xc nh qua i hay l mt s iu kin no c tha mn. Mt s thay i trng thi c gi l mt s chuyn i trng thi (State Transition). Mt chuyn i trng thi cng c th c mt hnh ng lin quan, xc nh iu g phi c thc hin khi s chuyn i trng thi ny din ra. Biu trng thi khng c v cho tt c cc lp, m ch ring cho nhng lp c mt s lng cc trng thi c nh ngha r rng v hnh vi ca lp b nh hng v thay i qua cc trng thi khc nhau. Biu trng thi cng c th c v cho h thng tng th. Biu trng thi c miu t chi tit hn trong chng sau (M hnh ng).

Hnh 3.5- Mt v d v biu trng thi 4.5- Biu trnh t (Sequence Diagram):

Mt biu trnh t ch ra mt cng tc ng gia mt lot cc i tng (xem hnh 3.6). Kha cnh quan trng ca biu ny l ch ra trnh t cc thng ip (message) c gi gia cc i tng. N cng ch ra trnh t tng tc gia cc i tng, iu s xy ra ti mt thi im c th no trong trnh t thc thi ca h thng. Cc biu trnh t cha mt lot cc i tng c biu din bng cc ng thng ng. Trc thi gian c hng t trn xung di trong biu , v biu ch ra s trao i thng ip gia cc i tng khi thi gian tri qua. Cc thng ip c biu din bng cc ng gch ngang gn lin vi mi tn (biu th thng ip) ni lin gia nhng ng thng ng th hin i tng. Trc thi gian cng nhng li nhn xt khc thng s c a vo phn l ca biu .

Hnh 3.6 - Mt biu trnh t cho Print Server 4.6- Biu cng tc (Collaboration Diagram): Mt biu cng tc ch ra mt s cng tc ng, cng ging nh mt biu trnh t. Thng ngi ta s chn hoc dng biu trnh t hoc dng biu cng tc. Bn cnh vic th hin s trao i thng ip (c gi l tng tc), biu cng tc ch ra cc i tng v quan h ca chng (nhiu khi c gi l ng cnh). Vic nn s dng biu trnh t hay biu cng tc thng s c quyt nh theo nguyn tc chung sau: Nu thi gian hay trnh t l yu t quan trng nht cn phi nhn mnh th hy chn biu trnh t; nu ng cnh l yu t quan trng hn, hy chn biu cng tc. Trnh t tng tc gia cc i tng c th hin trong c hai loi biu ny. Biu cng tc c v theo dng mt biu i tng, ni mt lot cc i tng c ch ra cng vi mi quan h gia chng vi nhau (s dng nhng k hiu nh trong biu lp/ biu i tng). Cc mi tn c v gia cc i tng ch ra dng chy thng ip gia cc i tng. Cc thng ip thng c nh km theo cc nhn (label), mt trong nhng chc nng ca nhn l ch ra th t m cc thng ip c gi i. N cng c th ch ra cc iu kin, ch ra nhng gi tr c tr v, v.v... Khi lm quen vi cch vit nhn, mt nh pht trin c th c biu cng tc v tun th theo dng thc thi cng nh s trao i thng ip. Mt biu cng tc cng c th cha c cc i tng tch cc (active objects), hot ng song song vi cc i tng tch cc khc (hnh 3.7). Biu cng tc c miu t chi tit trong chng sau.

Hnh 3.7 - Mt biu cng tc ca mt printer server 4.7- Biu hot ng (Activity Diagram): Mt biu hot ng ch ra mt trnh t ln lt ca cc hot ng (activity) (hnh 3.8). Biu hot ng thng c s dng miu t cc hot ng c thc hin trong mt th tc, mc d n cng c th c s dng miu t cc dng chy hot ng khc, v d nh trong mt Use case hay trong mt trnh t tng tc. Biu hot ng bao gm cc trng thi hnh ng, cha c t ca mt hot ng cn phi c thc hin (mt hnh ng - action). Mt trng thi hnh ng s qua i khi hnh ng c thc hin xong (khc vi biu trng thi: mt trng thi ch chuyn sang trng thi khc sau khi xy ra mt s kin r rng !). Dng iu khin y chy gia cc trng thi hnh ng lin kt vi nhau. Biu cn c th ch ra cc quyt nh, cc iu kin, cng nh phn thc thi song song ca cc trng thi hnh ng. Biu ngoi ra cn c th cha cc loi c t cho cc thng ip c gi i hoc c nhn v, trong t cch l thnh phn ca hnh ng c thc hin.

Hnh 3.8 - Mt biu hot ng cho mt printer server

4.8- Biu thnh phn (Component Diagram): Mt biu thnh phn ch ra cu trc vt l ca cc dng lnh (code) theo khi nim thnh phn code. Mt thnh phn code c th l mt tp tin source code, mt thnh phn nh phn (binary) hay mt thnh phn thc thi c (executable). Mt thnh phn cha cc thng tin v cc lp logic hoc cc lp m n thi hnh, nh th c ngha l n to ra mt nh x t hng nhn logic vo hng nhn thnh phn. Biu thnh phn cng ch ra nhng s ph thuc gia cc thnh phn vi nhau, tr gip cho cng vic phn tch hiu ng m mt thnh phn c thay i s gy ra i vi cc thnh phn khc. Thnh phn cng c th c miu t vi bt k loi giao din no m chng bc l, v d nh giao din OLE/COM; v chng c th c nhm gp li vi nhau thnh tng gi (package). Biu thnh phn c s dng trong cng vic lp trnh c th (xem hnh 3.9).

Hnh 3.9 - Mt biu thnh phn ch ra s ph thuc gia cc thnh phn m 4.9- Biu trin khai (Deployment Diagram): Biu trin khai ch ra kin trc vt l ca phn cng cng nh phn mm trong h thng. Bn c th ch ra tng my tnh c th v tng trang thit b c th (node) i km s ni kt gia chng vi nhau, bn cng c th ch ra loi ca cc mi ni kt . Bn trong cc nt mng (node), cc thnh phn thc thi c cng nh cc i tng s c xc nh v tr ch ra nhng phn mm no s c thc thi ti nhng nt mng no. Bn cng c th ch ra s ph thuc gia cc thnh phn. Biu trin khai ch ra hng nhn trin khai, miu t kin trc vt l tht s ca h thng. y l mt hng nhn rt xa li miu t duy chc nng ca hng nhn Use case. Mc d vy, trong mt m hnh tt, ngi ta c th ch tt c nhng con ng dn t mt nt mng trong mt kin trc vt l cho ti nhng thnh phn ca n, cho ti lp m n thc thi, cho ti nhng tng tc m cc i tng ca lp ny tham gia ri cui cng, tin ti mt Use case. Rt nhiu hng nhn khc nhau ca h thng c s dng ng thi to ra mt li miu t thu o i vi h thng trong s tng th ca n.

Hnh 3.10 - Mt biu trin khai ch ra kin trc vt l ca h thng