SE Units 3b 4 5 v3
SE Units 3b 4 5 v3
(AUTONOMOUS)
ADB Road, Surampalem, E.G. District, A.P.-533 437
DEPARTMENT OF CSE(DS)
Unit-4 Pages 11 to 31
Unit-5 Pages 33 to 49
Syllabus: Unit-3(2)
Class-Based Modeling, Requirements Modeling Strategies, Flow-Oriented Modeling,
Creating a Behavioral Model, Patterns for Requirements Modelling, Requirements Modeling
for WebApps.
TEXTBOOK- I: Chapters 6, 7.
Collaborations:
Collaborations represent requests from a client to a server in fulfillment of a
client responsibility. Collaboration is the embodiment of the contract between
the client and the server.
An object collaborates with another object if, to fulfill a responsibility, it
needs to send the other object any messages. A single collaboration flows in
one direction—representing a request from the client to the server. From the
client’s point of view, each of its collaborations is associated with a particular
responsibility implemented by the server.
In all cases, the collaborator class name is recorded on the CRC model index
card next to the responsibility that has spawned the collaboration.
Therefore, the index card contains a list of responsibilities and the
corresponding collaborations that enable the responsibilities to be fulfilled.
To help in the identification of collaborators, you can examine three different
generic relationships between classes:
o the is-part-of relationship
o the has-knowledge-of relationship
o the depends-upon relationship.
All classes that are part of an aggregate class are connected to the aggregate class via an is-
part-of relationship.
(3.2.3)Flow-oriented Modeling:
DFD = Data Flow Diagram --> Level 0, Level 1, Level 2
Terminology of DFD: bubble, primary input and primary output, label arrows and bubbles,
refine one bubble at a time.
Fig: Level_1 = basic bubble split into two or more detailed blocks
(a) Discovering Analysis Patterns=> The requirements model is comprised of a wide variety
of elements: scenario-based (use cases), data-oriented (the data model), class-based, flow-
oriented, and behavioral.
Structure:
Behavior:
Participants:
• PassiveSensor abstract: Defines an interface for passive sensors.
• PassiveBooleanSensor: Defines passive Boolean sensors.
• PassiveIntegerSensor: Defines passive integer sensors.
• PassiveRealSensor: Defines passive real sensors.
• ActiveSensor abstract: Defines an interface for active sensors.
• ActiveBooleanSensor: Defines active Boolean sensors.
• ActiveIntegerSensor: Defines active integer sensors.
• ActiveRealSensor: Defines active real sensors.
• Actuator abstract: Defines an interface for actuators.
• BooleanActuator: Defines Boolean actuators.
• IntegerActuator: Defines integer actuators.
• RealActuator: Defines real actuators.
• ComputingComponent: The central part of the controller; it gets the data from the sensors
and computes the required response for the actuators.
• ActiveComplexSensor: Complex active sensors have the basic functionality of the abstract
ActiveSensor class, but additional, more elaborate, methods and attributes need to be
specified.
• PassiveComplexSensor: Complex passive sensors have the basic functionality of the
abstract PassiveSensor class, but additional, more elaborate, methods and attributes need to
be specified.
• ComplexActuator: Complex actuators also have the base functionality of the abstract
Actuator class, but additional, more elaborate methods and attributes need to be specified.
Collaborations: objects and classes interact with one another and how each carries out its
responsibilities.
ComputingComponent <----->---> PassiveSensor
ComputingComponent <---<-----> ActiveSensor (They send a life tick at least once during a
specified time frame)
ComputingComponent <-------->-----> actuator
ComputingComponent <-----query, set the operation state of the sensors and actuators
Ex: operation state =zero, then the error is sent to the FaultHandler (a class that contains
methods for handling error messages) like recovery mechanism or a backup device. If
recovery fails then last known value for the sensor or the default value used.
• The ActiveSensors offer methods to add or remove the addresses or address ranges of the
components that want to receive the messages in case of a value change.
Consequences:
* Sensor and actuator classes have a common interface.
* Class decides whether or not to accept the message.
Ex: if a value of an actuator is set above a maximum value, then the actuator class may not
accept the message, or it might use a default maximum value.
* The complexity of the system is potentially reduced because of the uniformity of interfaces
for actuators and sensors.
Syllabus: Unit-4
Design within the Context of Software Engineering, The Design Process, Design Concepts,
The Design Model, Software Architecture, Architectural Genres, Architectural Styles,
Assessing Alternative Architectural Designs, Architectural Mapping Using Data Flow,
Components, Designing Class-Based Components, Conducting Component-Level Design,
Component-Level Design for WebApps, Designing Traditional Components, Component-
Based Development.
Text Book-I: Chapters 8, 9, 10.
TOPICS:
Design Concepts
4.1 Design within the Context of Software Engineering
4.2 The Design Process
4.3 Design Concepts
4.4 The Design Model
Architectural Design
4.5 Software Architecture
4.6 Architectural Genres
4.7 Architectural Styles
4.8 Assessing Alternative Architectural Designs
4.9 Architectural Mapping Using Data Flow
Component-level Design
4.10 Components
4.11 Designing Class-Based Components
4.12 Conducting Component-Level Design
4.13 Component-Level Design for Web Apps
4.14 Designing Traditional Components
4.15 Component-Based Development.
Quality Guidelines
1. A design should exhibit an architecture that:
(a) recognizable architectural styles or patterns
(b) is composed of components that exhibit good design characteristics
(c) thereby facilitating implementation and testing.
2. A design = modular (logically partitioned into elements or subsystems)
3. A design = contain distinct representations of data, architecture, interfaces, and components
4. design = data structures appropriate for the classes to be implemented
5. A design should lead to components that have independent functional characteristics.
6. A design should lead to interfaces that reduce the complexity of connections and with the
external environment.
7. A design = derived using a repeatable method that is driven by information obtained during
software requirements analysis.
8. A design = notation that effectively communicates its meaning.
Quality Attributes
• Functionality is assessed by evaluating the feature set, capabilities, generality and
security of the overall system.
(3) whether the pattern can serve as a guide for developing a similar, but functionally or
structurally different pattern
Separation of Concerns:
* A concern is a feature or behavior that is specified as part of the requirements model for the
software
* Separation of concerns is a design concept that suggests that any complex problem can be
more easily handled if it is subdivided into pieces that can each be solved and/or optimized
independently
Modularity:
* Software is divided into separately named and addressable components, sometimes
called modules, that are integrated to satisfy problem requirements.
Information Hiding:
* modules should be specified and designed so that information (algorithms and data)
contained within a module is inaccessible to other modules that have no need for such
information
Functional Independence:
* Independent modules are easier to maintain (and test) because secondary effects
caused by design or code modification are limited, error propagation is reduced
* Cohesion is an indication of the relative functional strength of a module.
* Coupling is an indication of the relative interdependence among modules
Refinement:
* Refinement helps to reveal low-level details as design progresses. It is actually a
process of elaboration
* Abstraction enables to specify procedure and data internally but suppress the need
for “outsiders” to have knowledge of low-level details
Aspects:
* If requirements analysis is done, then a set of “concerns” is uncovered.
* An aspect is a representation of a crosscutting concern.
* Req-A, Req-B: B can not be satisfied w/o taking A into consideration; => A
crosscuts B.
Refactoring:
* Refactoring is a reorganization technique that simplifies the design (or code) of a
component without changing its function or behavior
OOD Concepts:
Complete and sufficient: A design class should be the complete encapsulation of all attributes
and methods that can reasonably be expected (based on a knowledgeable interpretation of the
class name) to exist for the class
Primitiveness: Methods associated with a design class should be focused on accomplishing
one service for the class. Once the service has been implemented with a method, the class
should not provide another way to accomplish the same thing.
High cohesion: A cohesive design class has a small, focused set of responsibilities and single-
mindedly applies attributes and methods to implement those responsibilities.
Low coupling: Within the design model, it is necessary for design classes to collaborate with
one another. However collaboration should be kept to an acceptable minimum
Design class for FloorPlan and composite aggregation for the class:
For example, the elements of the SafeHome product are configured to operate within three
primary computing environments—a home-based PC, the SafeHome control panel, and a
server housed at CPI Corp. (providing Internet-based access to the system).
Architectural Patterns
Architectural patterns address an application-specific problem within a specific context and
under a set of limitations and constraints
Organization and Refinement
* Control: How is control managed within the architecture? hierarchy ? topology
? synchronized ?
* Data: How are data communicated between components?
• Superordinate systems—those systems that use the target system as part of some higher-
level processing scheme.
• Subordinate systems—those systems that are used by the target system and provide data or
processing that are necessary to complete target system functionality.
• Peer-level systems—those systems that interact on a peer-to-peer basis (i.e., information is
either produced or consumed by the peers and the target system.
• Actors—entities (people, devices) that interact with the target system by producing or
consuming information that is necessary for requisite processing
The overall SafeHome product controller and the Internet-based system are both
superordinate to the security function is shown below:
Defining Archetypes
* An archetype is a class or pattern that represents a core abstraction that is critical to the
design of an architecture for the target system
* SafeHome security function has the following archetypes:
• Node: Represents a cohesive collection of input and output elements of the home security
function. For example a node might be comprised of (1) various sensors and (2) a variety of
alarm (output) indicators.
• Detector: An abstraction that encompasses all sensing equipment that feeds information into
the target system.
• Indicator: An abstraction that represents all mechanisms (e.g., alarm siren, flashing lights,
bell) for indicating that an alarm condition is occurring.
• Controller: An abstraction that depicts the mechanism that allows the arming or disarming
of a node. If controllers reside on a network, they have the ability to communicate with one
another
Refining the Architecture into Components
The overall architectural structure (represented as a UML component diagram) is illustrated
in Figure below:
Architectural Complexity
Sharing dependencies represent dependence relationships among consumers who use the
same resource or producers who produce for the same consumers. For example, for two
components u and v, if u and v refer to the same global data, then there exists a shared
dependence relationship between u and v
Flow dependencies represent dependence relationships between producers and consumers of
resources. For example, for two components u and v, if u must complete before control flows
into v (prerequisite), or if u communicates with v by parameters, then there
exists a flow dependence relationship between u and v.
Constrained dependencies represent constraints on the relative flow of control among a set
of activities. For example, for two components u and v, u and v cannot execute at the same
time (mutual exclusion), then there exists a constrained dependence relationship between u
and v.
* Transform Mapping
Step 1. Review the fundamental system model
Step 2. Review and refine data flow diagrams for the software
Step 3. Determine whether the DFD has transform or transaction flow11 characteristics
Step 4. Isolate the transform center by specifying incoming and outgoing flow boundaries
Step 5. Perform “first-level factoring"
Step 6. Perform “second-level factoring"
Step 7. Refine the first-iteration architecture using design heuristics for improved software
quality
The objective of the preceding seven steps is to develop an architectural representation of
software
(ISP): Many client-specific interfaces For improved readability, it is a component itself. Global variable used by multiple
are better than one general purpose good idea to model dependencies components
interface from left to right and inheritance #Functional. Exhibited
The Release Reuse Equivalency from bottom (derived classes) to primarily by operations Control coupling. Occurs when
Principle (REP): The granule of reuse top (base classes) #Layer. Exhibited by packages, operation A() invokes operation B()
is the granule of release components, and classes and passes a control flag to B.
The Common Closure Principle #Communicational All
(CCP): Classes that change together operations that access the same Stamp coupling: Occurs when
belong together. data are defined ClassB is declared as a type for an
The Common Reuse Principle within one class. argument of an operation of ClassA.
(CRP): Classes that aren’t reused
together should not be grouped Data coupling: Occurs when
together operations pass long strings of data
arguments.
PDL provides an
elaboration of the
procedural design for an
early version of an
alarm management
component i.e.,
Algorithm like.
Syllabus: Unit-5
The Golden Rules, User Interface Analysis and Design, Interface Analysis, Interface Design Steps, Web App Interface Design, Design
Evaluation, Elements of Software Quality Assurance, SQA Tasks, Goals & Metrics, Statistical SQA, Software Reliability, A Strategic Approach
to Software Testing, Strategic Issues, Test Strategies for Conventional Software, Test Strategies for Object-Oriented Software, Test Strategies for
Web Apps, Validation Testing, System Testing, The Art of Debugging, Software Testing Fundamentals, Internal and External Views of Testing,
White-Box Testing ,Basis Path Testing
Topics:
Text Book-I: Chapters 11, 16, 17, 18. 5.1 The Golden Rules
5.2 User Interface Analysis and Design
5.3 Interface Analysis
5.4 Interface Design Steps
5.5 Web App Interface Design
5.6 Design Evaluation
Place the user in control Reduce the user’s memory load Make the interface consistent
• Do not force unnecessary actions • Reduce demand on short-term memory • Current task into a meaningful context
• Flexible interaction • meaningful defaults • Maintain consistency across a family
• Interaction must be interruptible • Define shortcuts for intuitive of applications.
• Customization • Visual interface to be on a real-world • Past interactive model met user
• Skill levels from basic to advance effect expectations? If yes, then do not
• Hide technical internals from casual • Disclose information in a progressive modify unless compiled.
user fashion.
• Direct interaction of objects that
appear on screen
i.e.,
Coding→ Unit Testing → Integration
Testing → Validation Testing →System
Testing → …..
* Understand the users of the software and develop a profile for each user category: Use
cases can reduce overall testing effort by focusing testing on actual use of the product
* Develop a testing plan that emphasizes “rapid cycle testing”: to control quality levels and
the corresponding test strategies
* Build “robust” software that is designed to test itself: capable of diagnosing certain classes
of errors, automated testing and regression testing.
* Use effective technical reviews as a filter prior to testing: reviews can reduce the amount
of testing effort
* Conduct technical reviews to assess the test strategy and test cases themselves: Technical
reviews can uncover inconsistencies, omissions, and outright errors, saves time.
* Develop a continuous improvement approach for testing process: metrics collected during
testing should be used as part of statistical process
5.14 Test Strategies for Object-Oriented Software 5.15 Test Strategies for Web Apps
The strategy for WebApp testing adopts the basic principles for all software
* Unit Testing in the OO Context: testing and applies a strategy and tactics that are used for object-oriented
# You can no longer test a single operation in isolation systems. The following steps summarize the approach:
but rather as part of a class
# conventional software testing = focus on the
1. content model reviewed to uncover errors.
algorithmic detail of a module and the data that flow
across the module interface 2. interface model is reviewed to ensure that all use cases can be
# class testing for OO software = {operations accommodated.
encapsulated by the class} +{state behavior of the class} 3. design model is reviewed to uncover navigation errors.
4. The user interface is tested to uncover errors in presentation and/or
navigation mechanics.
* Integration Testing in the OO Context: There are two
5. Each functional component is unit tested.
different strategies for integration testing of OO systems.
6. Navigation throughout the architecture is tested.
# thread-based testing: integrates the set of classes
required to respond to one input or event for the system. 7. The WebApp is implemented in a variety of different environmental
Each thread is integrated and tested individually configurations and is tested for compatibility with each configuration.
# use-based testing: begins the construction of the 8. Security tests are conducted in an attempt to exploit vulnerabilities in the
system by testing those classes (called independent WebApp or within its environment.
classes) that use very few (if any) server classes. After 9. Performance tests are conducted.
the independent classes are tested, the next layer of 10. The WebApp is tested by a controlled and monitored population of end
classes, called dependent classes, that use the users.
independent classes are tested.
# Cluster testing is one step in the integration testing of The results of their interaction with the system are evaluated for content and
OO software. Here, a cluster of collaborating classes
navigation errors, usability concerns, compatibility concerns, and WebApp
(determined by examining the CRC and object-
reliability and performance. Because many WebApps evolve continuously,
relationship model) is exercised by designing test cases
that attempt to uncover errors in the collaborations. the testing process is an ongoing activity, conducted by support staff who
use regression tests derived from the tests developed when the WebApp was
first engineered.
The Debugging Process: Debugging is not cause may actually be located at a site that is far # Backtracking is a fairly common
testing but often occurs as a consequence of removed. Highly coupled components exacerbate debugging approach that can be used
testing. The debugging process will usually this situation. success fully in small programs.
have one of two outcomes: 2. The symptom may disappear (temporarily) # Cause elimination is manifested by
(1) the cause will be found and corrected or when another error is corrected. induction or deduction and introduces the
(2) the cause will not be found. 3. The symptom may actually be caused by concept of binary partitioning
In the latter case, the per son performing nonerrors. (example: round-off inaccuracies). Automated debugging: Integrated
debugging may suspect a cause, design a test 4. The symptom may be caused by human error development environments (IDEs) provide
case to help validate that suspicion, and work that is not easily traced a way to capture some of the language
toward error correction in an iterative fashion. 5. The symptom may be a result of timing specific predetermined errors (e.g.,
problems, rather than processing problems. missing end-of-statement characters,
6. It may be difficult to accurately reproduce input undefined variables, and so on) without
conditions (e.g., a real-time application in which requiring compilation
input ordering is indeterminate). The people factor: A final maxim for
7. The symptom may be intermittent. This is debugging might be: “When all else fails,
particularly common in embedded systems that get help!”
couple hardware and software inextricably. Correcting the Error
8. The symptom may be due to causes that are “correction” that removes the cause of a
distributed across a number of tasks running on bug. After correction, questions to be
different processors. posted are:
Psychological Considerations: evidence on # Is the cause of the bug
debugging is open to many interpretations, large reproduced in another part of the
variances in debugging program?
Few characteristics of bugs provide some Debugging Strategies # What “next bug” might be
clues: Debugging tactics: introduced by the fix I’m about to
1. The symptom and the cause may be # Brute force category of debugging is probably make?
geographically remote. That is, the symptom the most common and least efficient method for
may appear in one part of a program, while the isolating the cause of a software error.
cause
Path 1: 1-11
Path 2: 1-2-3-4-5-10-1-11
Path 3: 1-2-3-6-8-9-10-1-11
Path 4: 1-2-3-6-7-9-10-1-11
# Cyclomatic complexity is a software metric that pro vides a quantitative measure of the logical complexity of a program. Complexity is
computed in one of three ways:
@ The number of regions of the flow graph corresponds to the cyclomatic complexity.
@ Cyclomatic complexity V(G) for a flow graph G is defined as V(G) =E -N +2 where E is the number of flow graph edges and
N is the number of flow graph nodes.
@ Cyclomatic complexity V(G) for a flow graph G is also defined as V(G) =P +1 where P is the number of predicate nodes
contained in the flow graph G
* Deriving Test Cases
# Using the design or code as a foundation, draw a corresponding flow graph.
# Determine the cyclomatic complexity of the resultant flow graph
# Determine a basis set of linearly independent paths
# Prepare test cases that will force execution of each path in the basis set.
* Graph Matrices
# A data structure, called a graph matrix, can be quite useful for developing a software tool that assists in basis path testing.
# A graph matrix = square matrix whose size (i.e., number of rows =columns) is equal to the number of nodes on the flow graph. Each row and
column correspond to an identified node, and matrix entries correspond to connections (an edge) between nodes.
# Consider below example: