UML Diagram What is UML? UML stands for “Unified Modeling Language” Unified: UML has become a world standard. UML was adopted as a standard by Object Management Group(OMG). Modeling: Describing a software system at a high level of abstraction. Language: Express idea, not a methodology. UML is a way to visually represent the architecture, design, and implementation of complex software systems. It is a industry-standard graphical language for specifying, visualizing, constructing, and documenting the artifacts of software systems. The UML uses mostly graphical notations to express the OO analysis and design of software projects. Simplifies the complex process of software design. Why we use UML? Use graphical notation: more clearly than natural language and code. Help acquire an overall view of a system. UML is not dependent on any one language or technology. UML moves us from fragmentation to standardization. When you’re writing code, there are thousands of lines in an application, and it’s difficult to keep track of the relationships and hierarchies within a software system. UML diagrams divide that software system into components and subcomponents. Types of UML Diagrams Behavioral Structural : behavioral features of a system / business process : element of spec. irrespective of time •Class •Component •Deployment •Object •Composite structure •Package •Activity •State machine •Use case •Interaction Interaction : emphasize • • • • object interaction Communication Sequence Interaction overview Timing Class Diagram Used for describing structure and behavior in the use cases. Show the static structure of a system, including classes, their attributes and behaviors, and the relationships between each class. Used for requirement capture, end-user interaction. Detailed class diagrams are used for developers. Class representation Each class is represented by a rectangle subdivided into three compartments • Name –at the top • Attributes –in the middle • Operations/methods –at the bottom Modifiers are used to indicate visibility of attributes and operations. • ‘+’ is used to denote Public visibility (everyone) • ‘#’ is used to denote Protected visibility (friends and derived) • ‘-’ is used to denote Private visibility (no one) By default, attributes are hidden and operations are visible. Relationship that exists between class Inheritance Association Aggregation Composition Multiplicity Object Diagram Object Diagram sometimes referred to as Instance diagrams are very similar to class diagram. Like class diagrams, they also show the relationship between objects but they use real-world examples. Object is an instance of a class in a particular moment in runtime that can have its own state and data values. They show how a system will look like at a given time. Because there is data available in the objects, they are used to explain complex relationships between objects. An object diagram focuses on the attributes of a set of objects and how those objects relate to each other. Component Diagram A component diagram are used to visualize the organization of system components and the dependency relationships between them or say it displays the structural relationship of components of a software system. These are mostly used when working with complex systems with many components. Components communicate with each other using interfaces. The interfaces are linked using connectors. The components can be a software component such as a database or the interface; or a hardware component such as a circuit, microchip or devices; or a business unit such as supplier, payroll or shipping. Use Case Diagram Use case diagram give a graphic overview of the actors involved in a system, different functions needed by those actors and how these different functions interact. Used for describing a set of user scenarios. Mainly used for capturing user requirements. Work like a contract between end user and software developers. Use Case Diagram (Core Components) A use case diagram contains four components. The boundary/system, which defines the system of interest in relation to the world around it. The actors, usually individuals involved with the system defined according to their roles. The use cases, which are the specific roles played by the actors within and around the system. The relationships between and among the actors and the use cases. Use Case Diagram (Core Components) System/Boundary: The system boundary is potentially the entire system. We represent a system with a rectangle. Actors: The users that interact with a system. An actor can be a person, an organization, or an outside system that interacts with your application or system. They must be external objects that produce or consume data. We represent actor with stick figure. Use case: A set of scenarios that describing an interaction between a user and a system, including alternatives. We represent use case with oval shape. Use Case Diagram(core relationship) Association: Communication between an actor and a use case. Represented by a solid line. Generalization: Relationship between one general use case and a special use case (used for defining special alternatives). Represented by a line with a triangular arrow head toward the parent use case. Include: The include relationship shows dependency between a base case and an included use case. A dotted line labeled <<include>> beginning at base use case and ending with an arrows pointing to the include use case. Extend: The extend relationship has a base use case and an extend use case. A dotted line labeled <<extend>> with an arrow toward the base case. Activity Diagram An activity diagram is a behavioral diagram i.e. it depicts the behavior of a system. An activity diagram portrays the control flow from a start point to a finish point showing the various decision paths that exist while the activity is being executed. Components of Activity Diagram Action: A step in the activity wherein the users or software perform a given task. actions are symbolized with round-edged rectangles. Decision node: A conditional branch in the flow that is represented by a diamond. It includes a single input and two or more outputs. Control flows: Another name for the connectors that show the flow between steps in the diagram. Start node: Symbolizes the beginning of the activity. The start node is represented by a black circle. End node: Represents the final step in the activity. The end node is represented by an outlined black circle. Sequence Diagram A sequence diagram is a type of interaction diagram because it describes how—and in what order—a group of objects works together. Sequence Diagrams are interaction diagrams that detail how operations are carried out. Sequence Diagrams are time focus and they show the order of the interaction visually by using the vertical axis of the diagram to represent time what messages are sent and when. Entity Relationship Diagram (ERD) ERD is a visual representation that illustrates how “entities” such as people, objects or concepts related to each other within a system. They are most often used to design or debug relational databases in the fields of software engineering, business information systems, education and research. Also known as Entity Relationship Model, used for designing in database. It is based on perception of real word that consists of s collection of objects called entities and of relationship among these objects. ER Models use a defined set of symbols such as rectangles, diamonds, ovals and connecting lines to represent the interconnectedness of entities, relationships and their attributes. Relationship between Entities The association among several entities is known as relationship. It defines the relationship between the entities. There are mainly three types of relationship which can exist between two different entities: One to One : The relationship takes place when a single occurrence of an entity is related to just one occurrence of a second entity is called one to one relationship. Example: one member has only one member log and one member log represent only one member. One to Many : The relationship takes place when a single occurrence of an entity is related to many occurrences of a second entity is called one to many relationships. Example: one branch can have many members. Many to Many: The relationship takes place when multiple occurrences of an entity are related to multiple occurrences of a second entity is called many to many relationships. Example: customers can purchase various products, and products can be purchased by many customers. ER Diagram Symbols • An Entity Relationship Diagram is composed of different components and each component in ER diagram is represented using a specific symbol. Some ER diagram symbols are discussed below: Data Flow Diagram (DFD) A data flow diagram is a way of representing a flow of data through a process or a system. The DFD also provides information about the outputs and inputs of each entity and the process itself. It is developed during analysis phase. Major Symbols of DFD 1. External Entity: It supplies data to or receive data from the system. Label should be noun phrase. source - supplies data to sink - receive data from 2. Process: An activity that performs some action on data. Label should be verb phrase. OR 3. Data Flow: Depicts the movement of data between component of a DFD. Label should be noun phrase. 4. Data Store: It is a holding space for information. Label should be noun phrase. OR