msit 41 contents
TRANSCRIPT
INFORMATION TECHNOLOGY PROGRAMMESBachelor of Science in Information Technology - B.Sc. (IT)Master of Science in Information Technology - M.Sc. (IT)
KUVEMPU UNIVERSITY
Incollaboration
with
Directorate of Distrance EducationKuvempu University
Shankaraghatta, Shimoga District, Karnataka
Universal Education TrustBangalore
M.Sc.(IT) - 4th Semester
MSIT - 41 OOAD with UML
MSIT - 42 Distributed Computing
II
Titles in this Volume :MSIT - 41 OOAD with UMLMSIT - 42 Distributed Computing
Prepared by UNIVERSAL EDUCATION TRUST (UET)Bangalore
First Edition : November 2005
Copyright © by UNIVERSAL EDUCATION TRUST, BangaloreAll rights reserved
No Part of this Book may be reproducedin any form or by any means without the writtenpermission from Universal Education Trust, Bangalore.
All Product names and company names mentionedherein are the property of their respective owners.
NOT FOR SALEFor personal use of Kuvempu UniversityIT - Programme Students only.
Corrections & Suggestionsfor Improvement of Study materialare invited by Universal Education Trust, Bangalore.
E-mail : [email protected]
Printed at :Mayur Print AdsBangalore - 20Ph : 94480 - 42724
III
OOAD WITH UML(MSIT - 41)
: Contributing Author :
Sri. S. PrabhudevaAssistant Professor
Jawaharlal Nehru National College of Engineering,
Shimoga
IV
V
a
Contents
CHAPTER 1
STRUCTURED APPROACH VS. OBJECT ORIENTED APPROACH 1
1.1 Introduction...................................................................................... 11.2 Objectives........................................................................................ 11.3 What is software?............................................................................. 21.4 High-Quality software....................................................................... 21.5 Where does the traditional approach fail?........................................... 3
1.5.1 Pitfalls of top down design................................................... 31.5.2 How object method succeeds?............................................. 4
1.6 Merits of object approach.................................................................. 41.7 Summary.......................................................................................... 51.8 Self-check Exercises......................................................................... 6
1.8.1 Fill-in the blanks.................................................................. 61.8.2 Objective type questions...................................................... 71.8.3 Review questions................................................................ 7
CHAPTER 2
THE OBJECT MODEL 9
2.0 Introduction...................................................................................... 92.1 Objectives........................................................................................ 92.2 Foundations of the object Model......................................................... 102.3 Definitions: OOA , OOD and OOP.................................................. 102.4 Major elements of Object Model........................................................ 11
VI
2.4.1 Abstraction......................................................................... 122.4.2 Encapsulation...................................................................... 132.4.3 Modularity.......................................................................... 142.4.4 Hierarchy........................................................................... 15
2.5 Minor elements of the object model..................................................... 192.5.1 Typing................................................................................ 202.5.2 Concurrency....................................................................... 232.5.3 Persistence......................................................................... 24
2.6 Summary.......................................................................................... 252.7 Self-check Exercises......................................................................... 29
2.7.1 Fill-in the Blanks.................................................................. 292.7.2 Objective type questions...................................................... 302.7.3 Review questions................................................................ 31
CHAPTER 3
CLASSES AND OBJECTS 33
3.0 Introduction...................................................................................... 333.1 Objectives........................................................................................ 333.2 Object.............................................................................................. 33
3.2.1 Definition........................................................................... 343.2.2 Relationships among objects................................................ 34
3.3 Class................................................................................................ 383.3.1 Definitions.......................................................................... 383.3.2 A class is a set of objects that share a common structure
and a common behavior....................................................... 383.3.3 Relationships among Classes................................................ 40
3.4 Summary ......................................................................................... 433.5 Self-check Exercises......................................................................... 47
3.5.1 Review questions................................................................ 473.5.2 Objective type questions...................................................... 473.5.3 Fill-in the Blanks.................................................................. 49
CHAPTER 4
ROAD MAP FOR OOA AND OOD 50
4.1 Objectives........................................................................................ 504.2 Various Activities of a Design............................................................ 50
4.2.1 OOA Phase....................................................................... 51
VII
4.2.1.1 Creating Classes................................................... 524.2.1.2 Assigning Responsibilities...................................... 534.2.1.3 CRC Modeling...................................................... 544.2.1.4 OOA Checkpoint.................................................. 56
4.2.2 OOD Phase....................................................................... 574.2.3 OOD Checkpoint................................................................ 58
4.3 Software problems........................................................................... 594.4 Best practices of software engineering............................................... 594.5 Self-check Exercises......................................................................... 61
4.5.1 Fill-in the Blanks.................................................................. 614.5.2 Objective type questions...................................................... 614.2.3 Review questions................................................................ 61
UML 62
CHAPTER 5
UNIFIED MODELING LANGUAGE 63
5.0 Objectives........................................................................................ 635.1 Introduction...................................................................................... 645.2 UML and brief background............................................................... 64
5.2.1 Architecture of UML.......................................................... 655.2.2 Why is UML powerful?...................................................... 655.2.3 What is a process?............................................................. 66
5.3 Phases and Iterations......................................................................... 675.4 Steps in UML................................................................................... 685.5 Modeling and UML........................................................................... 695.6 Goals of UML................................................................................... 705.7 Outside The Scope Of UML............................................................. 715.8 An overview of UML........................................................................ 72
5.8.1 Views................................................................................. 735.8.2 Modeling elements.............................................................. 745.8.3 Relationships...................................................................... 755.8.4 UML diagrams................................................................... 765.8.5 Extensibility mechanisms..................................................... 76
CHAPTER 6
ML MODELING ELEMENTS 78
6.0 Introduction ..................................................................................... 78
VIII
6.1 Objectives........................................................................................ 786.2 Class............................................................................................... 79
6.2.1 Attribute............................................................................. 806.2.1.1 Attribute Compartment.......................................... 816.2.1.2 Attribute Scope..................................................... 816.2.1.3 Derived Element................................................... 82
6.2.2 Operation........................................................................... 826.3 Object.............................................................................................. 846.4 Interface.......................................................................................... 866.5 Packages......................................................................................... 86
CHAPTER 7
RELATIONSHIPS CONNECT MODELING ELEMENTS 88
7.0 Introduction...................................................................................... 887.1 Objectives........................................................................................ 887.2 Relationships Notations...................................................................... 887.3 Association...................................................................................... 897.4 Association End................................................................................ 907.5 Aggregation...................................................................................... 917.6 Composition...................................................................................... 927.7 Generalization.................................................................................. . 927.8 Dependency..................................................................................... 937.9 Realization........................................................................................ 947.10 Relationship between Objects............................................................. 95
CHAPTER 8
DIAGRAMS IN UML 96
8.0 Introduction...................................................................................... 968.1 Objectives........................................................................................ 978.2 Use Case model............................................................................... 978.3 Static view diagram........................................................................... 103
8.3.1 Class diagram..................................................................... 1048.3.2 Object diagram.................................................................. 105
8.4 Dynamic view diagram...................................................................... 1068.4.1 Statechart diagram............................................................. 1068.4.2 Interaction diagram............................................................. 107
8.4.2.1 Sequence diagram................................................. 107
IX
8.4.2.2 Collaboration diagram............................................ 1138.5 Implementation diagram..................................................................... 115
8.5.1 Component diagram............................................................ 1168.5.2 Deployment diagram........................................................... 121
8.6 Summary of Diagrams in UML......................................................... 125
CHAPTER 9
EXTENSIBILITY MECHANISMS 126
9.0 Introduction...................................................................................... 1269.1 Objectives ....................................................................................... 1269.2 Constraint and Comment.................................................................... 1279.3 Tagged values................................................................................... 1299.4 Stereotypes....................................................................................... 1309.5 Self-check Exercises......................................................................... 132
9.5.1 Review questions................................................................ 1329.5.2 Fill in the Blanks.................................................................. 1339.5.3 Objective type questions...................................................... 134Reference Book................................................................................ 134