Beruflich Dokumente
Kultur Dokumente
KIT2 OOAD-UML-II
Chapter 9
Understanding Software Architecture
The design of a software system should represent its software architecture. Software architecture depicts all the components of a software system and the relationships between these components. This helps a developer to visualize all the software components of the system. In addition, it helps the developer to identify the hardware on which these components need to be deployed. UML provides various diagrams that help depict the software architecture of a system. This chapter explains how to depict the architecture of a software system by using various types of UML diagrams, such as package, component, and deployment.
Objectives
In this chapter, you will learn to: Create package diagrams Create component diagrams Create deployment diagrams
7/21/12
KIT2 OOAD-UML-II
relationships among them. Packages enable you to organize the following constituents into logical groups: Use cases Classes Objects Interfaces Collaborations Components Applications Subsystems UML diagrams
Note
An application represents a complete software system that contains constituents, such as classes, components, and libraries. The application can be logically partitioned into subsystems. Note that a subsystem is a logical unit of software system that can be implemented independently.
The constituents of software system need to be grouped so that each constituent is declared in only one package. In addition, there is a composite relationship between a package and its constituents. This means that if the package is destroyed, then the constituents contained in the package are also destroyed. In addition, a package may contain another package. The package is represented as a rectangular structure that resembles a folder. You need to assign a name to a package that uniquely identifies it. You may simply give a name to a package without including the content of the package. The following figure shows the O r d e rP a r t spackage and its contents.
The preceding figure shows the O r d e rP a r t spackage for the Inventory Management System (IMS) that includes the O r d e rand P a r t sclasses. The O r d e rP a r t spackage groups the classes that collaborate to generate the order for spare parts. The O r d e rclass generates an order for a specific spare part, the details of which are accessed from the attributes of the P a r t sclass.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 2/37
7/21/12
KIT2 OOAD-UML-II
It is beneficial to use packages to model the constituents of a software system because packages: Enable you to visualize the functional groups and the relationship among them. For example, in the IMS, you can create a package of the constituents that establish connectivity between the software system and the database accessed by the software system. You can create another package of the constituents, which updates data in the database. Enable easy management of large software systems. You can have constituents with the same name in different packages. This resolves the problem of assigning unique names to constituents. In other words, any constituent can be uniquely identified by a combination of the package name and the constituent name. For example, in the IMS, you may have two classes with the same name, Calculator, belonging to different packages, such as Accounting and Bill Processing.
In the preceding figure, the I n v e n t o r yM a n a g e r is the actor who uses the use cases contained in the two packages. Group use cases based on the actors that use them. For example, in the IMS, the I n v e n t o r y M a n a g e ris an actor who uses the G e n e r a t eT e n d e r ,A c c e p tQ u o t a t i o n ,P l a c eO r d e r ,
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 3/37
7/21/12
KIT2 OOAD-UML-II
and P r o c e s sO r d e r use cases. The A c c o u n tM a n a g e r is an actor who uses the P r o c e s s B i l l use case. As a result, you can have two packages, Inventory containing the use cases used by the I n v e n t o r yM a n a g e r and A c c o u n t s containing the use cases used by the A c c o u n tM a n a g e r . The following figure shows the use cases packaged according to the actors that use them.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
4/37
7/21/12
KIT2 OOAD-UML-II
2. Package the classes that are related through a composition relationship. For example, in the IMS, each spare part has a specification associated with it. A specification includes details such as the thickness, material, weight, and diameter of the spare part. The P a r t sclass includes the P a r t S p e c i f i c a t i o nclass as an attribute. As a result, the P a r t sand P a r t s S p e c i f i c a t i o nclasses share a composition relationship and can be grouped together in the P a r t D e t a i l spackage, as shown in the following figure.
3. Package the classes that collaborate and interact with each other to realize use cases. For example, in the IMS, the S u p p l i e rand O r d e r classes collaborate to realize the P r o c e s s O r d e r use case. The collaboration between the S u p p l i e r and O r d e rclasses occurs because the s u b m i t O r d e rmethod of the s u p p l i e robject invokes the a c c e p t O r d e r method of the o r d e robject at run time. The s u b m i t O r d e rmethod of the s u p p l i e r class provides the details of the parts that are submitted against a specified order, to the O r d e r class as parameters. The a c c e p t O r d e rmethod processes the details of the order such as validating if the spare parts are supplied against the correct order number. The O r d e rclass
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 5/37
7/21/12
KIT2 OOAD-UML-II
also stores the details of the number of parts accepted and rejected in the database. For this reason, the S u p p l i e r and O r d e rclasses are grouped in the O r d e r S u b m i s s i o npackage, as shown in the following figure.
7/21/12
KIT2 OOAD-UML-II
package can access the constituents of another package by importing the package. For example, if class A belongs to a package, pack1, and class B belongs to a package, pack2, then class A can invoke the methods of class B by importing the package, pack2. You can access only the public constituents of the imported package, which in this case is pack2. The public constituents of a package are called exports. Consider another example. In the IMS, the Tender class of the Tender package accesses the TenderRules and SupplierSelectionRules classes of the TenderPolicy package. The Tender class requests for the details of the tender agreement from the TenderRules class. The Tender class also requests for the supplier selection criteria from SupplierSelectionRules class. In this case, the Tender package is referred to as the client package and the TenderPolicy package is referred to as the supplier package. The access dependency relationship is depicted by using a dashed arrow connecting the client package to the supplier package. The following figure depicts the access dependency relationship between the T e n d e r and T e n d e r P o l i c y packages.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
7/37
7/21/12
KIT2 OOAD-UML-II
Generalization Relationship
A generalization relationship exists between a general package and the specific package derived from the general package. A specific package inherits the attributes of a general package. For example, in the IMS, you may have a general package for depicting the spare parts and specific packages for depicting the types of spare parts. The following figure shows the generalization relationship among the general package, s p a r ep a r t s , and the specific packages, a u t o m o b i l es p a r ep a r t s and e l e c t r o n i cs p a r ep a r t s .
Depicting the Package Diagrams for the IMS Diagrams for the IMS
You can depict all the packages that are contained in the IMS by using a single package diagram. The various packages in IMS are: Tender package : Contains the Tender class and Tender Database table.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 8/37
7/21/12
KIT2 OOAD-UML-II
Order package : Contains the Order class and Order Database table. Supplier package : Contains the Supplier class and Supplier Database table. Parts package : Contains the Parts, PartSpecification, ElectronicParts, AutomobileParts classes and Parts database table. TenderPolicy package : Contains the TenderRules class and SupplierSelectionRules class. The T e n d e rpackage imports the T e n d e r P o l i c ypackage because the T e n d e rClass requires the classes of the T e n d e r P o l i c ypackage. The T e n d e rand O r d e rpackages are dependent on the S u p p l i e rand P a r t sclasses contained in the S u p p l i e r and P a r t spackages respectively. The following package diagram depicts the various packages and the relationships among the packages for the IMS.
7/21/12
KIT2 OOAD-UML-II
software system: Deployment components : Includes the components that form the executable system. For example, Dynamic Link Libraries (DLLs) and Executables (EXEs) are deployment components that enable you to execute a system. Work product components : Includes the components that are the outcome of the implementation phase of the SDLC. For example, the source code files and data files can be depicted as crucial components of the software system. Execution components : Includes the components that are created when a system is executing. For example, COM+ objects are instances of DLLs that are created at runtime. You can depict the COM+ objects as components. In UML, you represent a component as a rectangle with tabs. Each component has a name that identifies it. You can also depict the content of the component. The following figure shows the P r o c e s s O r d e r component and its details.
The preceding figure shows a component named P r o c e s s O r d e rthat provides realization of the interfaces, i O r d e r S u b m i s s i o n and i O r d e r A c c e p t a n c e .
Note
If there are a large number of components in a software system, you can organize them by grouping the related components into packages. You can also depict the dependency, generalization, realization, and association relationships among components.
7/21/12
KIT2 OOAD-UML-II
collaborates with other classes to implement a specific function. You can model the various classes contained in a component and their relationship using a component diagram. For example, in the IMS, the P r o c e s s O r d e rcomponent depends on the S u p p l i e rand O r d e r classes because the component uses the methods of these classes for implementing the functions of processing an order received from a supplier. You can model the dependency relationship between the P r o c e s s O r d e rcomponent and S u p p l i e rand O r d e rclasses by using a component diagram. The following figure shows the dependency relationship between the P r o c e s s O r d e rcomponent and the S u p p l i e rand O r d e rclasses.
7/21/12
KIT2 OOAD-UML-II
In the IMS, the various source code files are T e n d e r . c s ,S u p p l i e r . c s ,O r d e r . c s , and P a r t s . c s . The T e n d e r . c s file defines the functions of the T e n d e rclass. Similarly, the S u p p l i e r . c s and P a r t s . c s files define the functions of the S u p p l i e rand P a r t s classes, respectively. The T e n d e r . c s file is dependent on the S u p p l i e r . c s and P a r t s . c s files because the T e n d e r . c s file uses the S u p p l i e r and P a r t sclasses. Similarly, the O r d e r . c s file is dependent on the T e n d e r . c s ,S u p p l i e r . c s , and P a r t s . c s files because the O r d e r . c s file uses the T e n d e r ,S u p p l i e r , and P a r t sclasses. The following figure shows the component diagram containing the various source code files for the system and illustrating the dependency relationship among them.
Notice that the components in the component diagram are depicted using the file symbol instead of the usual component notation. You depict the components by using the file symbol when you want to emphasize that the component is a source code file. This is called stereotyping the constituents that you want to depict in the diagram.
7/21/12
KIT2 OOAD-UML-II
The following figure depicts the various executable file components of IMS.
The preceding figure shows the P r o c e s s O r d e r . e x e ,G e n e r a t e O r d e r . e x e , and P r o c e s s B i l l . e x e executable components. All the executable components of the IMS use the inventory database, I n v e n t o r y . d b f .
Database Modeling
You can model the database components by using component diagrams. Each database component further contains database table components. You use special symbols in place of the usual component notation to represent a database and a database table component in a component diagram. You can also depict columns and stored procedures associated with each database table component. The significance of representing the various databases and database table components in the component diagram is that you can clearly visualize the large number of tables that the software system may include. The following figure shows the component diagram for modeling the inventory database of the IMS.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
13/37
7/21/12
KIT2 OOAD-UML-II
The preceding figure depicts that the information related to t e n d e r ,o r d e r ,s u p p l i e r , and parts is stored in the database tables, P a r t s ,P a r t D e t a i l s ,O r d e r ,T e n d e r ,S u p p l i e r , and S u p p l i e r H i s t o r y .
Note
A set of components that are executed on a particular node is called a distribution unit.
Notation of a Node
In UML, a node is represented as a 3-D rectangular box containing the components that execute within the
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 14/37
7/21/12
KIT2 OOAD-UML-II
node. A node may be located anywhere on a network. The following figure shows the notation of a node.
Distinction among nodes is achieved by assigning each node a name and classifying the various nodes into types depending on the type of components they execute. Nodes are associated with each other by a connection, which represents a communication channel. Communication channels depict how the various nodes are connected with each other. For example, it may specify whether the nodes are connected by using a Local Area Network (LAN), Wide Area Network (WAN), Internet or Ethernet. You depict a communication channel among nodes by a straight line drawn between the communicating nodes. For example, in the IMS, the components are i n v e n t o r y . e x e and i n v e n t o r y . d b f . The following figure shows a communication channel between the database server node executing the inventory database and the application server node executing the inventory application.
The dependency of a node on components is depicted using a dashed line. This indicates that a node uses the services of the components that are executing on another node. For example, you can depict the dependency relationship between an a p p l i c a t i o ns e r v e r node and a d a t a b a s es e r v e r component, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
15/37
7/21/12
KIT2 OOAD-UML-II
The following figure depicts the deployment diagram for the Inventory Management System.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
16/37
7/21/12
KIT2 OOAD-UML-II
Note
You can also use deployment diagrams to depict a node instance that contains the run-time components of a software system.
Just a minute:
Which of the following diagrams is used to visualize the hardware on which the
17/37
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
7/21/12
KIT2 OOAD-UML-II
software components need to be deployed? 1. 2. 3. 4. Package diagram Component diagram Deployment diagram Interaction overview diagram
Answer:
3. Deployment diagram
Problem Statement
Janes Technology needs to create the architectural model for the prototype of the InfoSuper bank ATM system. The prototype will include only the cash withdrawal feature of the InfoSuper bank ATM system. The project manager of Janes Technology has identified the following classes, attributes, and operations for the prototype of the InfoSuper bank ATM system.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
18/37
7/21/12
KIT2 OOAD-UML-II
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
19/37
7/21/12
KIT2 OOAD-UML-II
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
20/37
7/21/12
KIT2 OOAD-UML-II
The project manager has also created the following class diagram after identifying the classes and operations for the prototype of the InfoSuper bank ATM system.
Identify the activities that the project manager needs to perform to create the architectural view for the prototype. Prerequisite : To perform this activity, you will need the BANK_ATM.vsd file, which you created in the activity Creating an Activity Diagram for the Infosuper Bank ATM of Chapter 8.
Solution
To create the architectural view for the prototype of the ATM system, you need to perform the following tasks: 1. Identify components and relationships among them. 2. Identify the nodes and their executable components.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 21/37
7/21/12
KIT2 OOAD-UML-II
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
22/37
7/21/12
KIT2 OOAD-UML-II
7/21/12
KIT2 OOAD-UML-II
To create a component diagram, you need to perform the following steps: 1. Select StartAll Programs Microsoft Office Microsoft Office Visio for Enterprise Architects . 2. Open the Bank_ATM Visio file. The Bank_ATM model appears in Visio. 3. Right-click Top Package in the Model Explorer window, and select NewPackage . The UML Package Properties dialog box appears. 4. Type Component in the Name text box, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
24/37
7/21/12
KIT2 OOAD-UML-II
8. Double-click Component1 to rename it. The UML Component Properties dialog box appears. 9. Type Bank Database in the Name text box, as shown in the following figure.
11. Similarly, draw the following components for the cash withdrawal feature of the ATM system: ATM Card Scanner ATMClient CashDispenser Printer After drawing all the components the component diagram should appear as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 25/37
7/21/12
KIT2 OOAD-UML-II
12. Drag the Dependency symbol ( ) from the UML Component (Metric) stencil on the drawing page to create a dependency relationship between Bank Database and ATM components, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
26/37
7/21/12
KIT2 OOAD-UML-II
13. Similarly, draw dependency relationships between all the components, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
27/37
7/21/12
KIT2 OOAD-UML-II
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
28/37
7/21/12
KIT2 OOAD-UML-II
Node Symbol
6. Double-click Node1 to rename it. The UML Node Properties dialog box appears. 7. Type Regional ATM Server in the Name text box, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
29/37
7/21/12
KIT2 OOAD-UML-II
9. Drag the Component symbol from the UML Deployment (Metric) on the drawing page and place it on the Regional ATM Server node, as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
30/37
7/21/12
KIT2 OOAD-UML-II
10. Double-click the component and rename it as ATM , as shown in the following figure.
11. Similarly, draw the nodes for Database Server for Bank and InfoSuper Bank ATM , as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
31/37
7/21/12
KIT2 OOAD-UML-II
12. Drag the Dependency symbol ( ) from the UML Deployment (Metric) on the drawing page to draw the dependency relationship between all the components as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
32/37
7/21/12
KIT2 OOAD-UML-II
drawing page to draw the communication relationship between the Regional ATM Server and Infosuper Bank ATM node. Double-click the communication symbol connecting the Regional ATM Server node and the InfoSuper Bank ATM nodes to open the UML Association Properties dialog box. Type WAN in the Name text box and click the OK button. Right-click the communication symbol connecting the Regional ATM Server node and the InfoSuper Bank ATM nodes and select the Shape Display Options option. The Shape Display Options dialog box appears. Select the Name check box in the General options section and clear the First end name , Second end name , and End multiplicities check boxes in the End options section. Click the OK button. The deployment diagram appears as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
33/37
7/21/12
KIT2 OOAD-UML-II
19. Similary, draw the communication link between the Regional ATM Server and the Database Server for Bank nodes. The final deployment diagram should appear as shown in the following figure.
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
34/37
7/21/12
KIT2 OOAD-UML-II
20. Save and close the BANK_ATM model. 21. Close Microsoft Visio.
Summary
In this chapter, you learned that: Architectural modeling is used to depict the physical constituents of a software system. The physical constituents consist of the components and nodes on which the components execute. The components of a software system can be modeled on the basis of different architectural viewtypes. The various viewtypes are the module viewtype, component and connector viewtype, and allocation viewtype. The artifacts that UML provides to enable architectural modeling are: package diagrams, component diagrams, and deployment diagrams. Packages are used to group the related constituents of a software system. Component diagrams are used to model the various components required for a system to execute. Deployment diagrams are used to depict the various nodes on which the components of a software system execute.
Exercises
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm 35/37
7/21/12
KIT2 OOAD-UML-II
Exercise 1
Blue Valley Consulting Inc. has decided to implement the data entry system, which includes providing functionality to enter the information of the disposed property, for Real Estate Management System. The details of the module, which is required to implement the data entry system, are:
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
36/37
7/21/12
KIT2 OOAD-UML-II
Reference Links
http://smartdraw.com/resources/centers/uml/uml6.htm#whatcomponent
www.niitstudent.com/india/Content/063OUML2S1/OEBPS/07_ch09.htm
37/37