Title: COSC 4406 Software Engineering
1 COSC 4406Software Engineering
Haibin Zhu, Ph.D. Dept. of Computer Science and
mathematics, Nipissing University, 100 College
Dr., North Bay, ON P1B 8L7, Canada,
haibinz_at_nipissingu.ca, http//www.nipissingu.ca/fa
culty/haibinz
2Lecture 9 Component-Level Designand User
Interface Design
3What is a Component?
- OMG Unified Modeling Language Specification
OMG01 defines a component as - a modular, deployable, and replaceable part of
a system that encapsulates implementation and
exposes a set of interfaces. - OO view a component contains a set of
collaborating classes - Conventional view logic, the internal data
structures that are required to implement the
processing logic, and an interface that enables
the component to be invoked and data to be passed
to it.
4OO Component
5Conventional Component
6Designing Class-Based Components
7Basic Design Principles
- The Open-Closed Principle (OCP). A module
component should be open for extension but
closed for modification. - The Liskov Substitution Principle (LSP).
Subclasses should be substitutable for their
base classes. - Dependency Inversion Principle (DIP). Depend on
abstractions. Do not depend on concretions. - The Interface Segregation Principle (ISP). Many
client-specific interfaces are better than one
general purpose interface. - The Release Reuse Equivalency Principle (REP).
The granule of reuse is the granule of release.
- The Common Closure Principle (CCP). Classes that
change together belong together. - The Common Reuse Principle (CRP). Classes that
arent reused together should not be grouped
together.
Source Martin, R., Design Principles and
Design Patterns, downloaded from
http//www.objectmentor.com, 2000.
8Design Guidelines
- Components
- Naming conventions should be established for
components that are specified as part of the
architectural model and then refined and
elaborated as part of the component-level model - Interfaces
- Interfaces provide important information about
communication and collaboration (as well as
helping us to achieve the OPC) - Dependencies and Inheritance
- it is a good idea to model dependencies from left
to right and inheritance from bottom (derived
classes) to top (base classes).
9Cohesion
- Conventional view
- the single-mindedness of a module
- OO view
- cohesion implies that a component or class
encapsulates only attributes and operations that
are closely related to one another and to the
class or component itself - Levels of cohesion
- Functional only one function
- Layer one direction dependence
- Communicational shared data
- Sequential pipeline (ones out is the followers
in) - Procedural invoked one by one
- Temporal special behaviors such as exception
handling - Utility similar components/classes/operations
grouped together
10Coupling
- Conventional view
- The degree to which a component is connected to
other components and to the external world - OO view
- a qualitative measure of the degree to which
classes are connected to one another - Level of coupling
- Content access others internal data
- Common share global data
- Control A() calls B() by passing a control flag.
- Stamp classB is declared as a type for an
argument of an operation of classA - Data when passing large data
- Routine call one invokes another
- Type use one component A uses the types of
another component B - Inclusion or import component A imports
component B - External a component communicates with
components of another component
11Component Level Design-I
- Step 1. Identify all design classes that
correspond to the problem domain. - Step 2. Identify all design classes that
correspond to the infrastructure domain. - Step 3. Elaborate all design classes that are
not acquired as reusable components. - Step 3a. Specify message details when classes or
component collaborate. (UML collaboration
diagram) - Step 3b. Identify appropriate interfaces for
each component. - Step 3c. Elaborate attributes and define data
types and data structures required to implement
them. - Step 3d. Describe processing flow within each
operation in detail. (UML activity diagram)
12Component-Level Design-II
- Step 4. Describe persistent data sources
(databases and files) and identify the classes
required to manage them. - Step 5. Develop and elaborate behavioral
representations for a class or component. (UML
statechart) - Step 6. Elaborate deployment diagrams to provide
additional implementation detail. - Step 7. Factor every component-level design
representation and always consider alternatives.
13Collaboration Diagram
14Refactoring
15Activity Diagram
16Statechart
17Algorithm Design
- the closest design activity to coding
- the approach
- review the design description for the component
- use stepwise refinement to develop algorithm
- use structured programming to implement
procedural logic - use formal methods to prove logic
18Stepwise Refinement
open
walk to door
reach for knob
open door
repeat until door opens
turn knob clockwise
walk through
if knob doesn't turn, then
close door.
take key out
find correct key
insert in lock
endif
pull/push door move out of way
end repeat
19Algorithm Design Model
- represents the algorithm at a level of detail
that can be reviewed for quality - options
- graphical (e.g. flowchart, box diagram)
- pseudocode (e.g., PDL) ... choice of many
- programming language
- decision table
- conduct walkthrough to assess quality
20Structured Programmingfor Procedural Design
uses a limited set of logical constructs
sequence
conditional
if-then-else, select-case
loops
do-while, repeat until
leads to more readable, testable code
can be used in conjunction with proof of
correctness
important for achieving high quality, but not
enough
21A Structured Procedural Design
22Decision Table
23Program Design Language (PDL)
24Interface Design
Easy to learn?
Easy to use?
Easy to understand?
25Interface Design
Typical Design Errors
lack of consistency too much memorization no
guidance / help no context sensitivity poor
response Arcane/unfriendly
26Golden Rules
- Place the user in control
- Reduce the users memory load
- Make the interface consistent
27Place the User in Control
- Define interaction modes in a way that does not
force a user into unnecessary or undesired
actions. - Provide for flexible interaction.
- Allow user interaction to be interruptible and
undoable. - Streamline interaction as skill levels advance
and allow the interaction to be customized. - Hide technical internals from the casual user.
- Design for direct interaction with objects that
appear on the screen.
28Reduce the Users Memory Load
- Reduce demand on short-term memory.
- Establish meaningful defaults.
- Define shortcuts that are intuitive.
- The visual layout of the interface should be
based on a real world metaphor. - Disclose information in a progressive fashion.
29Make the Interface Consistent
- Allow the user to put the current task into a
meaningful context. - Maintain consistency across a family of
applications. - If past interactive models have created user
expectations, do not make changes unless there is
a compelling reason to do so.
30User Interface Design Models
- User model a profile of all end users of the
system - Design model a design realization of the user
model - Mental model (system perception) the users
mental image of what the interface is - Implementation model the interface look and
feel coupled with supporting information that
describe interface syntax and semantics
31User Interface Design Process
32Interface Analysis
- Interface analysis means understanding
- (1) the people (end-users) who will interact with
the system through the interface - (2) the tasks that end-users must perform to do
their work, - (3) the content that is presented as part of the
interface - (4) the environment in which these tasks will be
conducted.
33User Analysis
- Are users trained professionals, technician,
clerical, or manufacturing workers? - What level of formal education does the average
user have? - Are the users capable of learning from written
materials or have they expressed a desire for
classroom training? - Are users expert typists or keyboard phobic?
- What is the age range of the user community?
- Will the users be represented predominately by
one gender? - How are users compensated for the work they
perform? - Do users work normal office hours or do they work
until the job is done? - Is the software to be an integral part of the
work users do or will it be used only
occasionally? - What is the primary spoken language among users?
- What are the consequences if a user makes a
mistake using the system? - Are users experts in the subject matter that is
addressed by the system? - Do users want to know about the technology the
sits behind the interface?
34Task Analysis and Modeling
- Answers the following questions
- What work will the user perform in specific
circumstances? - What tasks and subtasks will be performed as the
user does the work? - What specific problem domain objects will the
user manipulate as work is performed? - What is the sequence of work tasksthe workflow?
- What is the hierarchy of tasks?
- Use-cases define basic interaction
- Task elaboration refines interactive tasks
- Object elaboration identifies interface objects
(classes) - Workflow analysis defines how a work process is
completed when several people (and roles) are
involved
35Swimlane Diagram
36Analysis of Display Content
- Are different types of data assigned to
consistent geographic locations on the screen
(e.g., photos always appear in the upper right
hand corner)? - Can the user customize the screen location for
content? - Is proper on-screen identification assigned to
all content? - If a large report is to be presented, how should
it be partitioned for ease of understanding? - Will mechanisms be available for moving directly
to summary information for large collections of
data. - Will graphical output be scaled to fit within the
bounds of the display device that is used? - How will color to be used to enhance
understanding? - How will error messages and warning be presented
to the user?
37Interface Design Steps
- Using information developed during interface
analysis (SEPA, Section 12.3), define interface
objects and actions (operations). - Define events (user actions) that will cause the
state of the user interface to change. Model this
behavior. - Depict each interface state as it will actually
look to the end-user. - Indicate how the user interprets the state of the
system from information provided through the
interface.
38Interface Design Patterns
- Patterns are available for
- The complete UI
- Page layout
- Forms and input
- Tables
- Direct data manipulation
- Navigation
- Searching
- Page elements
- e-Commerce
39Design Issues
- Response time
- Help facilities
- Error handling
- Menu and command labeling
- Application accessibility
- Internationalization
40Design Evaluation Cycle
41Summary
- Component-Level Design
- Component
- Class-based Components
- Conducting Component-level Design
- Designing Conventional Components
- Interface Design
- Golden Rules
- UI Analysis
- UI Design
- UI Design Evaluation