Docsity

Overview of Database Design, Analysis Modeling - Software Engineering | CS 487, Exams of Software Engineering

Toggle sidebar
bg1
CS 487 Analysis Modeling
Chapter 8
Overview of Database Design
Data modeling
What are the objects and associations in the enterprise?
What information about these objects and associations should we store in the
database?
What are the integrity constraints or business rules that hold?
A database `schema’ in the ER Model can be represented pictorially using
UML notation.
Can map this model into a relational schema.
This will give us our "first cut" of the conceptual schema. (Show you how to
build the tables in the database.)
Data Modeling Basics
Data Objects: Real-world object distinguishable from other objects. A data
object is described (in DB) using a set of attributes. Has only data, no
operations.
Can be represented as a table.
Each data object has a key.
Each attribute of the data object has a domain.
Association: The relationship among two or more data objects.
Example: Wallace works in Pharmacy department.
Cardinality ratios or Key Constraints
Expresses the number of occurrences of one object that can be related to the
number of occurrences of another object.
One-to-one Data object A is associated with at most one data object B, and
data object B is associated with at most one data object A.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Overview of Database Design, Analysis Modeling - Software Engineering | CS 487 and more Exams Software Engineering in PDF only on Docsity!

CS 487 Analysis Modeling Chapter 8 Overview of Database Design Data modeling  What are the objects and associations in the enterprise?  What information about these objects and associations should we store in the database?  What are the integrity constraints or business rules that hold?  A database `schema’ in the ER Model can be represented pictorially using UML notation.  Can map this model into a relational schema.  This will give us our "first cut" of the conceptual schema. (Show you how to build the tables in the database.) Data Modeling Basics Data Objects: Real-world object distinguishable from other objects. A data object is described (in DB) using a set of attributes. Has only data, no operations.  Can be represented as a table.  Each data object has a key.  Each attribute of the data object has a domain. Association: The relationship among two or more data objects. Example: Wallace works in Pharmacy department. Cardinality ratios or Key Constraints Expresses the number of occurrences of one object that can be related to the number of occurrences of another object.  One-to-one Data object A is associated with at most one data object B, and data object B is associated with at most one data object A.

One-to-many Data object A is associated with any number of data object B's. Data object B, however, can only be associated with at most one data object A.  Many-to-many Data object A is associated with any number of data object B's, and data object B is associated with any number of data object A's. Note: With UML notation, this can be refined to express a specific number of associations (N) that are allowed. Modality (or Participation Constraints) Tells us if participation in the association is optional or mandatory.  Total participation - an entity must have the relationship. It is mandatory. (Shown with a lower bound of 1.)  Partial participation - an entity may or may not have the relationship. It is optional. (Shown with a lower bound of 0.) Example: Every loan account at a bank must have a customer. Not every customer of a bank takes out a loan. UML Notation for Data modeling basics:  Model data only, no operations are modeled. UML Class diagrams are used to show data objects and their associations. Only a small subset of the notation is needed to draw: objects, attributes and their relationships. A partitioned rectangle is used for a data object. Primary Key - The attribute in the data object that uniquely identifies an occurrence or instance of the data object. Name


attributes

This is shown with a diamond and a line to all participating data objects.

Bahavioral Modeling: The goal is to show the dynamic behavior of the system with respect to specific events and time. It shows how the software will respond to external events or stimuli. The analyst must identify the states of the system, the events of the system and how the events will trigger a transition. These are shown using a UML statechart diagram. The statechart diagram will show the legal flows through the system. It shows how the states are linked with transitions. While in a particular state, work may or may not be going on. A statediagram is sometimes called a state machine. How to model a statechart diagram:

  1. Start by reviewing your analysis classes and identify those that have behavior.
  2. Review your use cases and consider interface requirements.
  3. Consider how other systems may trigger your system.
  4. Determine the initial and final states of the entity.
  5. Identify the events that have an affect on the entity.
  6. Start with the initial state and trace the flow through the system.
  7. Identify all entry and exit actions for each state.
  8. You may need to expand the diagram and identify intermediate states.
  9. When completed, review your analysis class and make sure all operations are supported in your classes. If not, add them. Statechart diagrams: Models behavior from the perspective of a single entity, such as a class. It can also be used for a system or subsystem. Activity diagrams and collaboration diagrams can model behavior of many entities in a single diagram.

Action - A state can trigger actions. Actions are atomic computational procedures (non-interruptible). Five ways an action can be triggered: On Entry: As soon at the state is entered. Do: During the lifetime of the state. On Event: Triggered by an event. On Exit: Just before the state exits. Include: Invokes a submachine (another statechart diagram). The action must be implemented as a operation on classes (either this class, or on related classes). Actions when in the state are placed in this compartment. Other things are placed in the third: nested state diagrams, s sub-region name… Form for action line: Action label / action - used for entry, exit, do and include Event-name (parameters) [guard-condition] / action - used for events.  The parameters may be a comma-separated list.  The guard condition must be true for the event to trigger the action. Tips:  If single exit out of state, the action is best expressed as an exit action on the state.  Multiple exits, that have different actions, attach them to the appropriate transitions.  The same event can be handled within the state, or trigger a transition, depending on the guards. Name


Internal transition compartment


Scenario Based Modeling: The goal is to understand how the users will interact with the system. Use Case a verbal description of a usage scenario. It is written from the perspective of a defined actor of the system. May be written as a paragraph or as an ordered sequence of user actions. If an ordered sequence is used, exceptions (alternate interactions) must be shown. A set of use cases should be developed to define all the actors, operational goals, objects and functionality of the system. In UML, this information may be shown with a diagram. Use Case diagram: A use case is a description of a scenario by the user. These are used to clearly communicate the requirements of the system to the developers.  Defines the functional and operational requirements of the system.  Takes the place of the DFD in flow oriented modeling.  Models the system from the end-user's perspective.  Use case diagrams show different levels of abstraction, just like DFDs. Objectives:

  1. Define the functional and operational requirements of the system (product) by defining a scenario of usage. (These should be agreed upon by the users and developers.)
  2. Describes how the system and the users will interact.
  3. Basis for testing. (Each use case will be tested.) Use Case Terms: Actor - Entities that interact with the system. Can be people, other systems or machines. Use Case - Actions/functions of the system. Relationship - Shows the associations among use cases and actors.

Relationship Actors are connected to use cases with a line. This line represents an interaction or association between the two. What this really means is eventually, the use case will be implemented with software and the actor will use it. A single actor may be associated with more than one use case and a use case may be associated with more than one actor. (actor role name) Rate IPRO Presentation IPRO judge Four other kinds of relationships:

  1. Generalization between use cases When two use cases serve the same general function, but are different in some aspect of operation. Shown with a solid line with a "triangle" end that points to the more general use case. Use case name More general use case Specialized use case name
  1. Generalization between actors When two actors use the same use cases, but one has even more. Instead of showing associations between all the same use cases and two actors, it is easier to show the one as a specialization of the other. Shown with a solid line with a "triangle" end that points to the more general actor. More general actor role name More specialized actor role name (Student) (graduate student)
  2. Include relationship between use cases (old: uses) When one use case includes the functionality of another. Shown with a dashed, arrowed line that points to the "included" use case. The word <> is shown on the line. This is convenient when the functionality of a use case is shared by other use cases. It allows the functionality to be defined in one place. <> (process credit card) (register for course)
  3. Extend relationship between use cases (old: extends) When a use case extends the functionality of another. Shown with a dashed, arrowed line that points to the use case that is being extended. The word <> is shown on the line. <> (process credit card) (process debit card) How to draw use cases: Included use case na,mease Including use case name Extended use case na,mease Extending use case name

Class Diagram and Object Diagrams Describes the static, or structural, aspects of the system. It describes how it is structured, not how it behaves. In the beginning of a project, you will model analysis classes. These are used to understand and model the problem domain classes. Later, as design advances, classes that are necessary for implementation will be added. Class diagrams contain classes , entities with attributes and operations, and associations. The associations represent the relationships that relate two or more classes. Object diagrams show the static structure of a system at a particular time. Object diagrams contain objects , instances of classes, and links, which are the instances of associations. Object diagrams show the actual values for the attributes. Object diagrams must follow the rules of the class model. Note: Object diagrams are often used to validate the class model of a system. If a problem occurs, then the object diagram is wrong or the class model has an error. How to draw a class: The class symbol includes compartments for the name, attributes and operations. All or any combination may be used. B is an attribute of A C is an operation of A Second example:


CAR

manufacturer model A


B

C()

year license plate number


start car() stop car() drive car() reverse car() brake car() turn on lights() turn off lights()


In the analysis phase general information will be included. By the design phase, details required for implementation will be provided, such as the parameters for the operations and how they should be defined. Attribute and Operation names: Basic form the same for both: : Type is the data type of the attribute or the data type returned by the operation. Attribute and Operation Visibility: Types of visibility: private (-), public (+) and protected (#). This describes how it is available to other classes. Place the symbol before the attribute name in the class box.  Private - it is available the class that owns it.  Public - it is available to any class that is associated with the class that owns it.  Protected - it is available to the class that owns it and any subtype of the class (used in the generalization association). More on Attributes: Three properties of an attribute can be listed:  Initial value specified by using the clause = after the attribute type.  Derived value can be determined from the values of other attributes, or of features of other classes. A forward slash (/) immediately before the attribute name is used to show it is a derived value.

Associations: OO systems are constructed from class types that work together to accomplish the tasks of the system. They collaborate with each other by passing messages and receiving responses. When instances of one class pass messages to instances of another class, there is an implied association between the two classes. Association Names: An association is shown as a solid line. Between two classes is called a binary association. Remember, there can be more, but this is the most common type. The association can be labeled with a name to describe the relationship. An arrow-head can be used to show the direction of the description. ◄ owns Multiplicity: This describes how many instances of a class and object may be associated with. (In terms of data modeling, this is the cardinality.) Note:  m..n, where m is the lower bound and n is the upper bound.  1, is short for 1..1.  0..* , means there may be zero and an unlimited maximum.  * is short for 0..*. Aggregation & Composition: Home Person

Sometimes, the association between two classes describe the relationship that one class is made up or composed of objects of another class. UML has two special associations, that are part of the class diagram, to show these types of associations. They are not different associations, they just describe the nature of the association. Aggregation: Typically described as a "part of" relationship. An aggregation association is used to show that as well as having attributes of its own, an instance of one class, includes instances of another class. UML uses an unfilled diamond to show this. It is placed at the aggregate, the class that is made up of something else. ◊ (Shown with converging paths. May be shown with separate paths and four diamonds.) Composition: Typically described as a "whole-part" relationship. Book


Name Author


Cover

Graphics

Chapter

pages

Index

Topic Pagenumber


Pictures


Activity Diagram Used to describe a workflow. Similar to statechart diagrams. They can be used throughout the lifecycle of a project. A few examples are listed below:  In the beginning of a project, to during business analysis, to model high level business requirements and business workflows.  High level workflows are examined to help identify candidate use cases.  They are used to model workflow within and between use cases.  They are used to model complex workflows in operations on objects. Terms: Activities, states and transitions. Activity: A unit of work that must be accomplished by the system. Drawn as a rectangle with rounded ends. The name is placed inside. The name should describe the actions to take place. Actions may be listed in the activity or they may also be documented separately in a text document. Similar to statechart diagrams, there are four ways to trigger actions: On Entry: actions are triggered as soon as the activity starts. Do: action takes place during the life time of the activity. On Event: actions take place in response to an event. On Exit: actions take place just before the activity completes. Actions may be simple English statements or programming statements. See example. A second form is: ^target.event(arguments) target - some object that needs to respond to the event. event - name of the event arguments - information passed with the event

State: A point where some event needs to take place before the flow can continue. Activities and states are roughly the same thing. Both have actions. Activities must complete all actions, before exiting normally. States are used to imply waiting, not doing. A state is drawn as a rectangle with rounded corners. Special states: Special State: ● - Start state. Only one allowed/diagram. ● - End State. Several allowed/diagram. Transitions: Used to show movement from one activity to the next, from one state to another or from one state to an activity… Drawn as an arrowed line. There may be different paths out of a state or activity. Decision Point: May be used to show a possible branch. A diamond shape is used to indicate the decision point. Swimlanes: Notation used to show where the activity takes place. They vertical columns that may show actors, objects, use cases… See page 193.