1. Trang chủ
  2. » Công Nghệ Thông Tin

Giới thiệu UML docx

36 217 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 36
Dung lượng 1,11 MB

Nội dung

Introducing UML Chapter 2 OOAD is a technique for analyzing the requirements and creating the design for a software system. The analysis done using OOAD needs to be depicted in a graphical form. This method of displaying the information graphically is known as visual modeling. The visual models of a software system can be created by using Unified Modeling Language (UML). UML provides a variety of diagrams to represent the structure and design of a software system. It helps project teams to communicate, explore potential designs, and validate the architectural design of the software. This chapter discusses the need, scope, and building blocks of UML. It explains the types of UML diagrams and the various views of software systems. In addition, the chapter provides an overview of Microsoft Visio as a UML tool. Finally, it discusses the benefits, the life cycle, and the best practices of Rational Unified Process (RUP). In this chapter, you will learn to:  Identify the evolution, scope, and building blocks of UML  Identify the types of UML diagrams  Use Microsoft Visio to create UML diagrams  Identify the benefits, lifecycle, and best practices of RUP Objectives ¤NIIT Introducing UML 2.3 Consider an architect who has acquired a contract of a building. The architect needs to work out the blueprint of the building on paper and get it approved from the client before the construction of the building actually begins. The same analogy applies to software systems. You need to create a blueprint that depicts the structure and design of the software system before the development of the software system begins. At the onset, if you model the blueprint of the software system, it prevents the occurrence of any design faults. This reduces the rework and development time of the system in the later phases of SDLC. Unified Modeling Language (UML) is a standard language for creating blueprints that depict the structure and design of the software system. You can use UML for modeling systems that can range between enterprise information systems to distributed Web-based applications. UML is a notational language that enables the stakeholders to view the architecture of the system from various perspectives. There are several tools available, such as Rational Rose, Jude, AgroUML, Visio and Poseidon, which you can use to design software systems by using UML. The evolution of UML began with the need for a modeling language in which you can develop models of object-oriented software systems. During the mid 1970s and late 1980s, object-oriented modeling languages were developed for the analysis and design of software. Of these modeling languages, the most prominently used languages were Booch’s Booch’93, Jacobson’s Object Oriented Software Engineering (OOSE), and Rumbaugh’s Object Modeling Technique-2 (OMT). Each of these languages was complete in itself and was recognized as having certain strengths and weaknesses. For example, Booch’93 was efficient in projecting the software system during the design and construction phases of the projects. OOSE was more helpful in the requirements capturing and analysis phases. OMT was used for the analysis of data-intensive information systems. Because several modeling languages were being used in the industry, there was a need for a standard language for modeling. In October 1994, Grady Booch, Ivor Jacobson, and Jim Rumbaugh of Rational Software Corporation began the unification of Booch’93, OMT, and OOSE. They developed a unified language and released version 0.9 and 0.91 of UML. To standardize UML, Object Management Group (OMG), a non-profit organization for standardizing specifications, issued a Request for Proposal (RFP) in 1996. In response to the RFP issued by OMG, a UML consortium was established with the support of major Overview of UML Evolution of UML 2.4 Introducing UML ¤NIIT software organizations such as HP, I-Logix, IBM, Microsoft, Oracle, Rational Software, and Unisys. The UML consortium prepared and presented the revised version of UML 1.1 to OMG. Finally, OMG accepted UML as a standard modeling language and took over the responsibility for overseeing the maintenance of UML. Many versions of UML were released with more additions and modifications. This course discusses UML 2.0. Rational Software Corporation, which has now been acquired by IBM, defines UML as follows: “The Unified Modeling Language (UML) is a language for specifying, constructing, visualizing, and documenting the artifacts of a software-intensive system.” The artifacts might include requirements, architecture, design in terms of classes, objects or interfaces, source code, tests, prototypes, and the software releases of a software system. For a better understanding, you can further divide the definition of UML into the following sub-parts:  UML is a language for specifying artifacts: This means that UML provides the notations for classes, objects, and interfaces, which enable the development team to define the scope and content of a software system.  UML is a language for visualizing artifacts: This means that UML allows you to create diagrams to visualize a software system. Creating diagrams provides a better understanding of the structure and content of the software system. For example, a diagram depicts the hierarchical arrangement of classes more clearly than code. Another benefit is that even if the code is lost, the logical structure of the system remains intact in the form of diagrams. The use of predefined notations for developing diagrams enables one development team to interpret the models created by other teams.  UML is a language for constructing artifacts: This means that UML allows code generation from a UML model. Generating code from a UML model is called forward engineering. In addition, UML enables reverse engineering, which means it allows you to reconstruct a model from code.  UML is a language for documenting artifacts: This means that you can use the diagrams as input documents for the subsequent phases of SDLC. The building blocks of UML include the components that are necessary for creating models of the software systems. The three types of UML building blocks are:  Basic UML constituents: Include the static, dynamic, grouping, and annotational constituents of UML. Scope of UML Building Blocks of UML ¤NIIT Introducing UML 2.5  Relationships: Depict the relations between the various constituents of a UML model.  Diagrams: Represent the various artifacts of a system graphically. Diagrams enable you to visualize a system from all the aspects of software development. To understand the basic UML constituents, let us revisit the analogy of constructing a building. You require bricks, sand, cement, plastic, and iron bars as the base constituents to begin the construction of a building. These constituents do not change when you are giving shape to the building. Similarly, to begin the design of a software system, you need to identify classes, interfaces, objects, use cases, collaborations, components, and nodes. These form the static constituents of the software system because they do not change even while you identify the interactions or change of state of these constituents. Again going back to the analogy of the building, you need to identify which door leads to which room and which window is opening in which direction. This will give a shape to the building. You may also refer to it as the behavior of the building. Similarly, the static constituents, such as classes, need to interact to depict their response to the other objects and classes. You can depict such responses and relations between classes by using messages at the design phase. Messages and states form the dynamic constituents of the software system. The walls, doors, windows, ceiling, and floor make up a room of the building. Going into more detail, the rooms, kitchen, and wash rooms form the complete apartment. Similarly, the classes and interfaces need to be grouped in packages, which in turn, can be grouped together to form a complete software system. A package is the grouping constituent used in UML. Each apartment in the building has an owner and a name plate of its owner. Similarly, to provide more explanation on each structural or grouping constituent, such as classes and packages, you should provide an explanation on the role of each constituent in the model. The UML annotational constituent, note, provides an explanation on the structural, behavioral, and grouping constituents. 2.6 Introducing UML ¤NIIT N ote UML provides the following thirteen diagrams to represent the structure and design of a software system:  Use case diagrams  Class diagrams  Object diagrams  Communication diagrams  Sequence diagrams  State Machine diagrams  Activity diagrams  Package Diagrams  Component diagrams  Deployment diagrams  Timing Diagrams  Composite Structure Diagrams  Interaction Overview Diagrams UML diagrams use various notations to specify the syntax of the constructs used for creating the diagrams. For example, UML notations specify how to depict the user or the classes and interfaces of the system. A use case diagram depicts the various operations that a system performs. It contains use cases, actors, and their relationships. Use cases are the sequence of actions that form a single unit of work for an actor. An actor represents a user who is external to the system and interacts with the use case. Identifying the Types of UML Diagrams Defining Use Case Diagrams ¤NIIT Introducing UML 2.7 The following figure depicts the graphical notation for a use case diagram. Graphical Notation for a Use Case Diagram A use case diagram can be drawn for any given software system. For example, in an order processing system, the inventory department places a request for the machine parts that are out of stock. In this case, the inventory department is an actor that uses the system to place an order for the parts. Similarly, the inventory department also receives the supply to update the stocks. The use cases for the actor, Inventory Department, are Order Parts and Accept Supply. The following figure shows the use case diagram for the order processing system. Use Case Diagram for the Order Processing System A class diagram represents a set of classes, interfaces, and their relationships. You can represent a class in a rectangular box with three compartments. The first compartment shows the class name. The second compartment shows the attributes of the class and the third compartment shows the methods associated with the class. Defining Class Diagrams Actor Use Case Relationship Inventory De p artment Order Parts A cce p t Su pp l y 2.8 Introducing UML ¤NIIT The following figure shows the graphical notation for classes along with their attributes, methods, and relationships. Graphical Notation for Classes You can draw a class diagram by identifying the classes in the system. For example, the classes identified in the order processing system are Supplier and Parts. The various attributes of the Supplier class are scode, name, and city, and the methods of the Supplier class are supply() and receivepayment(). The various attributes for the Parts class are pcode, name, qty_ordered, qty_received, and qty_rejected, and the methods of the Parts class are order(), received(), and updateinventory(). The following figure shows the class diagram for the order processing system. Class Diagram for the Order Processing System Class1 A ttributes Methods Class2 A ttributes Methods Class3 Attributes Methods Supplier scode name city supply() receivepayment() Parts pcode name qty_ordered qty_received qty_rejected order() received() updateinventory() ¤NIIT Introducing UML 2.9 An object diagram represents instances of a class diagram. You represent an object in a rectangular box with two compartments. The object name appears before the class name in the first compartment. The second compartment shows the attributes of the objects. The following figure shows the graphical notation for objects along with their attributes and relationships. Graphical Notation for an Object Diagram You can draw an object diagram by identifying the classes in the system. The following figure shows the object diagram for the order processing system. Object Diagram for the Order Processing System Communication diagrams represent an interaction between objects in the form of messages. For example, the following figure depicts the interaction between the Inventory Department and an object of the supplier class of the order processing system. Communication Diagram for the Order Processing System Communication diagrams are also called as collaboration diagrams. Defining Object Diagrams Defining Communication Diagrams Inventory De p artment supp1: Supplier 1. Places Order 2. Supplies Order 2.10 Introducing UML ¤NIIT Sequence diagrams represent an interaction between objects in the form of messages ordered in a sequence by time. The difference between the sequence and communication diagrams is that communication diagrams emphasize on the structural organization of objects as opposed to sequence diagrams that show the messages exchanged between objects ordered in a sequence by time. You can draw a sequence diagram for any given system by using the classes and use cases identified for the system. The following diagram shows the sequence of messages in the order processing system. Sequence Diagram for the Order Processing System In the order processing system, the Inventory Department places the order with the supplier, supp1. The supplier, supp1, supplies these parts to the Inventory Department . A state machine diagram shows how a class reacts when an event occurs. You can draw a state machine diagram by using the classes and the use cases identified for the system. For example, in the order processing system, the Parts class has an attribute, re-order. An order is placed when the stock reaches a particular level. In this case, the re-order attribute is set to true. After the supplier supplies the parts, the re-order level is changed to false. Defining Sequence Diagrams Defining State Machine Diagrams Inventory De p artment supp1: Supplier 1. Places Order 2. Supplies Order [...]... view 2.22 Introducing UML NIIT Identifying the Role of UML in SDLC The diagrams developed using UML serve as key documents in each phase of SDLC In addition, you can use UML to develop software systems based on any SDLC model For example, you can use UML to design a software system that follows the linear, prototyping, or iterative approach to system modeling You can map each of the UML diagrams with the... case diagrams 2.24 Introducing UML NIIT Introducing Visio as a UML Tool Visio is a Microsoft tool that facilitates object-oriented design using UML This tool runs efficiently on Windows XP, Windows 2000, Windows NT, and Mac operating systems It helps to create UML diagrams It also helps in generating C#, C++, or Visual Basic code for the UML diagrams Using Visio to Create UML Diagrams To create a simple... want to use when you start a new drawing NIIT Introducing UML 2.27 5 Select the UML Use Case (Metric) stencil in the Shapes window to view the shapes it contains, as shown in the following figure UML Drawing Window 6 Drag the Actor symbol ( stencil, to draw an actor ) on the drawing page from the UML Use Case (Metric) ) on the drawing page from the UML Use Case 7 Drag the Use case symbol ( (Metric) stencil,... Places Order Supplies Order Interaction Overview Diagram for Inventory Management System Associating UML Diagrams with UML Modeling Techniques You can divide all the UML diagrams into four modeling techniques: Requirements modeling: Involves depicting the requirements using use case diagrams NIIT Introducing UML 2.19 Static modeling: Involves depicting the static constituents of the software system using... the stakeholders UML diagrams are used in the analysis and design phases of SDLC Visio is a tool that can be used to draw UML diagrams Rational Unified Process (RUP) is a software development methodology developed by Rationale Software Corporation, which is now a division of IBM It is a process framework that helps you to create and deploy software designed using UML 2.34 Introducing UML NIIT Exercises... system Interaction Overview Depicts how the various processes interact with each other UML Diagrams and their Role in the Requirement Analysis Phase In the design phase, the analysts and architects can be more specific in depicting the details of the system through the UML diagrams The following table lists various UML diagrams that you can use in the design phase Diagram Role in the Design Phase Class... d Transition 4 UML stands for: a Unified Modeling Language b Unified Markup Language c Undefined Modeling Language d Undefined Markup Language 5 In a use case diagram, an actor can be linked to: a A single use case b Multiple use cases c Maximum of two use cases d Minimum of two use cases NIIT Introducing UML 2.33 Summary In this chapter, you learned that: Unified Modeling Language (UML) is a standard... the artifacts of a software system The building blocks of UML consist of basic constituents, relationships, and diagrams The basic constituents include the structural, behavioral, grouping, and annotational constituents UML diagrams enable you to visualize the software system by graphical representation of the various constituents The thirteen UML diagrams are use case, class, object, communication,... appears, as shown in the following figure Microsoft Visio Window NIIT Introducing UML 2.25 3 Click Software from Category section in the Choose Drawing Type window All the templates will appear in the Template section, as shown in the following figure Visio Window Displaying the Software Templates 2.26 Introducing UML NIIT 4 Select UML Model Diagram (Metric) from the list of templates The Drawing1Microsoft... the software quality Control any changes to the software NIIT Introducing UML 2.31 Just a minute: Which of the following phases of RUP includes analyzing the problem domain, developing project plan, and eliminating highest possible risks? 1 Inception 2 Elaboration 3 Construction 4 Transition Answer: 2 Elaboration 2.32 Introducing UML NIIT Practice Questions 1 Which of the following diagrams is a part . of UML building blocks are:  Basic UML constituents: Include the static, dynamic, grouping, and annotational constituents of UML. Scope of UML Building Blocks of UML ¤NIIT Introducing UML.  UML is a language for constructing artifacts: This means that UML allows code generation from a UML model. Generating code from a UML model is called forward engineering. In addition, UML. of UML. Many versions of UML were released with more additions and modifications. This course discusses UML 2.0. Rational Software Corporation, which has now been acquired by IBM, defines UML

Ngày đăng: 12/08/2014, 18:22

TỪ KHÓA LIÊN QUAN

w