Вы находитесь на странице: 1из 29

Department of Information Technology

Design Patterns Lab Lab Manual [Subject Code] I M Tech II Semester [Branch: IT]

Department of Information Technology


Lab Manual for the Academic Year 2008-09 In accordance !ith "#T$ %yllabu%&

'$(")*T '$(")*T *-D) ')M)'T). 'T.)AM I#'T.$*T-. ,.-/.AMM).'

+ + + + + +

D, LA(

Department of Information Technology

0ead IT

Department of Information Technology


Lab Manual for the Academic Year 2008-09 In accordance !ith "#T$ %yllabu%&
'ugge%tion% from ,rincipal+

)nhancement if any+

*omment%+

INDEX

'1 #o 1 2 3

*ontent% Lab Objective Introduction About Lab Guidelines to Students List of Lab Exercises 4.1 Syllabus ro!ra"s #$%&'( 4.2 Additional and Advanced ro!ra"s 1.*escri+tion about ',L

) . /

2. *escri+tion about * Solutions for ro!ra"s Solutions for Additional ro!ra"s 0eferences

LAB OBJECTIVE

Overview Object ModelUML Basic Model Advanced Models Class & Object Collaboration Sequence Use Cases Advanced Modeling Component Diagram Deplo ment Diagrams

INTRODUCTION ABOUT LAB


There are 66 systems (Compaq Presario) installed in this Lab. Their con i!"rations are as ollo#s$ Processor -%& +ard 'is0 &o"se 3et#or0 Inter ace card 'oft!are %ll systems are con i!"red in D$AL (--T mode i.e.4 5t"dents can boot rom 6indo#s 7P or Lin"8 as per their lab req"irement. This is 9ery "se "l or st"dents beca"se they are amiliar #ith di erent 2peratin! 5ystems so that they can e8ec"te their pro!rams in di erent pro!rammin! en9ironments. :ach st"dent has a separate lo!in or database access -racle 9i client 9ersion is installed in all systems. 2n the ser9er4 acco"nt or each st"dent has been created. $ $ $ $ $ %&' %thelon ( 1.6) *+, 2.6 &/ 41 */ 2ptical &o"se Present

This is 9ery "se "l beca"se st"dents can sa9e their #or0 ( scenarios;4 pl<sql pro!rams4 data related pro=ects 4etc) in their o#n acco"nts. :ach st"dent #or0 is sa e and sec"re rom other st"dents. Latest Technolo!ies li0e D-T #)T and "2)) are installed in some systems. /e ore s"bmittin! their inal pro=ect4 they can start doin! mini pro=ect rom 2nd year on#ards. MA'M Macro A%%embler & is installed in all the systems 5t"dents can e8ec"te their assembly lan!"a!e pro!rams "sin! &%5&. &%5& is 9ery "se "l st"dents beca"se #hen they e8ec"te their pro!rams they can see contents o Processor .egi%ter% and ho# each in%truction is bein! e8ec"ted in the *,$. -ational -ose 5o t#are is installed in some systems >sin! this so t#are4 st"dents can depict >&L dia!rams o their pro=ects. 5o t#ares installed$ C4 C??4 @'A1..4 &%5&4 2BBIC:C7P4 @2:: and '2T 3:T4 -ational -ose. 'y%tem% are pro2ided for %tudent% in the 3+3 ratio1 'y%tem% are a%%igned number% and %ame %y%tem i% allotted for %tudent% !hen they do the lab1

*escri+tion about *
:ach pattern describes a problem #hich occ"rs o9er and o9er a!ain in o"r en9ironment4 and then describes the core o the sol"tion to that problem4 in s"ch a #ay that yo" can "se this sol"tion a million times o9er4 #itho"t e9er doin! it the same #ay t#iceD E A design pattern F Is a common sol"tion to a rec"rrin! problem in desi!n F F %bstracts a rec"rrin! desi!n str"ct"re Comprises class and<or ob=ect E 'ependencies

E E E F E

5tr"ct"res Interactions Con9entions

3ames G speci ies the desi!n str"ct"re e8plicitly

A design pattern has 4 basic parts: F F F F 1. 3ame 2. Problem 3. 5ol"tion 4. Conseq"ences and tradeCo s o application

E E E E

Lan!"a!eC and implementationCindependent % DmicroCarchitect"reH %d="nct to e8istin! methodolo!ies (>ni ied4 2&T4 etc.) 3o mechanical application F !a"s The sol"tion needs to be translated into concrete terms in the application conte8t by the de9eloper

Codi y !ood desi!n F 'istil and disseminate e8perience F F %id to no9ices and e8perts ali0e %bstract ho# to thin0 abo"t desi!n

*i9e desi!n str"ct"res e8plicit names F F F Common 9ocab"lary -ed"ced comple8ity *reater e8pressi9eness

Capt"re and preser9e desi!n in ormation

F F E

%rtic"late desi!n decisions s"ccinctly Impro9e doc"mentation

Bacilitate restr"ct"rin!<re actorin! F F Patterns are interrelated %dditional le8ibility

*escri+tion about ',L


I T!"D#CTI"

The >ni ied &odelin! Lan!"a!e (>&L) is a !raphical lan!"a!e or 9is"ali,in!4 speci! ing" constructing" and documenting t#e arti!acts o! a so!tware$intensive s stem% The >&L o ers a standard #ay to #rite a systemIs bl"eprints4 incl"din! concept"al t#ings suc# as business processes and s stem !unctions as well as concrete t#ings suc# as programming language statements" database sc#emas" and reusable so!tware components%& The important point to note here is that >&L is a Ilan!"a!eI or speci yin! and not a method or proced"re. The >&L is "sed to de ine a so t#are systemJ to detail the arti acts in the system4 to doc"ment and constr"ct C it is the lan!"a!e that the bl"eprint is #ritten in. The >&L may be "sed in a 9ariety o #ays to s"pport a so t#are de9elopment methodolo!y. % modelin! lan!"a!e or speci yin!4 9is"ali,in!4 constr"ctin!4 and doc"mentin! >sed to deri9e or e9ol9e a system &eans to capt"re and comm"nicate a 0no#led!e abo"t a system Boc"ses on "nderstandin! a s"b=ect 9ia creatin! a model It "ni ies the lan!"a!e o comm"nication abo"t a system >ses 9is"ali,ation Can be "sed as a Ibl"eprintI o a system Can be "sed thro"!h o"t the li ecycle o the system $ML i% NOT

% 9is"al pro!rammin! lan!"a!e4 b"t a 9is"al modelin! lan!"a!e % tool or repository speci ication4 b"t a modelin! lan!"a!e speci ication % process4 b"t enables processes >&L is a !eneral p"rpose4 broadly applicable4 toolCs"pported4 (ind"stry standardi,ed) modelin! lan!"a!e
$here does #ML fit%

>&L at its #idest ormali,es the notion o concepts and de ines a lan!"a!e o speci yin! modes

>&L ormali,es "ses the abo9e le9el to ormali,e the paradi!m concepts (22) >&L ormali,es the modelin! o classes or types >&L ormali,es the modelin! o ob=ects or instances

&rchitectural 'ie(s of #ML


The user model view - Use Case Diagram - The unctionalit! o a s!stem The structural model view - Class Diagram - The static structure o a s!stem - "#$ect Diagram - The static structure o a s!stem at a %articular time The #ehavioral model view - Se&uence Diagram - Interaction among elements o a s!stem in a time se&uence - Colla#oration diagram - Interaction among elements and their relations organi'ed in time and s%ace - State Diagram - The status condition and res%onses o the elements o a s!stem - (ctivit! Diagram - The activities o the s!stem The im%lementation model view - Com%onent Diagram - The organi'ation o the elements reali'ing the s!stem The )nvironment model view - De%lo!ment diagram - Con iguration o environment elements and the ma%%ing o elements reali'ing the s!stem into them Modeling Mechanisms

*ers%ectives de ine a %articular %oint o view Dichotomies de ine how something can #e viewed rom di erent %ers%ectives and discover inconsistencies within models +a!ers o a#straction de ine a %articular level o a#straction and esta#lish the level o detail, ena#les ocused communication, used or organi'ation o models )-tension mechanisms de ine the means o customi'ing and e-tending the UM+

11

(nne-ure - .

Inde) Page
S* o* Date Program + ,)periment Page o* Sign + !emar-s

11

Inde) Page
S* o* Date Program + ,)periment Page o* Sign + !emar-s

(nne-ure - .

12

13

$ML 'yllabu% ,rogram% "#T$&

'1 #o
1. 2. 3. 4. .. 6. ). K. L. 11. 11. 12. 13. 14. 1.. 16. 1). 1K. 1L. 21. 21. 22. 23. 24. 2.. 26. 2). 2K. 2L. 31. 31. 33. 34. 3.. 36. 3). 3K.

,rogram%
>se case 'ia!ram or Librarian 5cenario >sin! >&L desi!n %bstract actory desi!n pattern >sin! >&L desi!n %dapterCclass 'esi!n pattern >sin! >&L desi!n %dapterCob=ect 'esi!n pattern >sin! >&L desi!n 5trate!y 'esi!n pattern >sin! >&L desi!n /"ilder 'esi!n pattern >sin! >&L desi!n /rid!e 'esi!n pattern >sin! >&L desi!n 'ecorator 'esi!n pattern >ser !i9es a print command rom a #ord doc"ment. 'esi!n to represent this chain o responsibility 'esi!n pattern 'esi!n a Bly#ei!ht 'esi!n pattern >sin! >&L desi!n Bacade 'esi!n pattern >sin! >&L desi!n Iterator 'esi!n pattern >sin! >&L desi!n &ediator 'esi!n pattern >sin! >&L desi!n Pro8y 'esi!n pattern >sin! >&L desi!n Misitor 'esi!n pattern

14

31 $%e ca%e Diagram for Librarian 'cenario1

1.

#$ $%ing $ML de%ign Ab%tract factory de%ign pattern1

16

% $Using U&L design Adapter'c"ass Design pattern$

1)

4$ Using U&L design Adapter'!b(ect Design pattern$

1K

)$ Using U&L design *trateg+ Design pattern$

1L

,$ Using U&L design B-i"der Design pattern$

21

.$ Using U&L design Bridge Design pattern$

21

/$ Using U&L design Dec!rat!r Design pattern$

22

0$ Design t! represent this chain !1 resp!nsibi"it+ Design pattern$

23

23$ Design a 4"+5eight Design pattern$

24

331 $%ing $ML de%ign 4acade De%ign pattern1

2.

321 $%ing $ML de%ign Iterator De%ign pattern1

26

351 $%ing $ML de%ign Mediator De%ign pattern1

2)

361 $%ing $ML de%ign ,ro7y De%ign pattern1

2K

381 $%ing $ML de%ign 9i%itor De%ign pattern1

2L

Вам также может понравиться