Unit 2
Unit 2
• Abstraction
• Architecture
• Patterns
• Separation of Concerns
• Modularity
• Information Hiding
• Functional Independence
• Refinement
• Aspects
• Refactoring
• Object-Oriented Design Concepts
• Design Classes
Design Concepts
• Abstraction
• At the highest level of abstraction, a solution is stated in broad terms using
the language of the problem environment.
• At lower levels of abstraction, a more detailed description of the solution is
provided.
• A procedural abstraction refers to a sequence of instructions that have a
specific and limited function, while a data abstraction is a named collection of
data that describes a data object.
• e.g. Open door here open is a function while door is an object
• i.e. open(walk and go to door, reach out and grasp knob, turn knob,pull door, step away
from the moving door etc.), door(type of door, swing direction, weight, opening
mechanisam etc.)
Design Concepts
• Architecture
• It is the structure or organization of program components (modules), the
manner in which these components interact, and the structure of data that
are used by the components.
• A set of architectural patterns enables a software engineer to solve common
design problems.
• Shaw and Garlan [Sha95a] describe a set of properties that should be
specified as part of an architectural design:
• Structural properties
• Extra-functional properties
• Families of related systems
Design Concepts
• Architecture
• Structural properties:
• It defines the components of a system (e.g., modules, objects, filters) and the manner in
which those components are packaged and interact with one another. For example,
objects are packaged to encapsulate both data and the processing that manipulates the
data and interact via the invocation of methods.
• Extra-functional properties:
• It should address how the design architecture achieves requirements for performance,
capacity, reliability, security, adaptability, and other system characteristics.
• Families of related systems:
• It should draw upon repeatable patterns that are commonly encountered in the design
of families of similar systems. In essence, the design should have the ability to reuse
architectural building blocks.
Design Concepts
• Architecture design can be represented using one or more models as:
• Structural models: represent architecture as an organized collection of program
components.
• Framework models:increase the level of design abstraction by attempting to identify
repeatable architectural design frameworks that are encountered in similar types of
applications
• Dynamic models:address the behavioral aspects of the program architecture, indicating
how the structure or system configuration may change as a function of external events
• Process models:focus on the design of the business or technical process that the
system must accommodate.
• Functional models can be used to represent the functional hierarchy of a system.
• A number of different architectural description languages (ADLs) have been developed
to represent these models [Sha95b].
Design Concepts
• Patterns
The intent of each design pattern is to provide a description that enables a designer to determine
(1) whether the pattern is applicable to the current work,
(2) whether the pattern can be reused (hence, saving design time), and
(3) whether the pattern can serve as a guide for developing a similar, but functionally or structurally different
pattern
Design Concepts
• Separation of Concerns
• It 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.
• A concern is a feature or behavior as part of the requirements.
• By separating concerns into smaller, and therefore more manageable
pieces, a problem takes less effort and time to solve.
Design Concepts
• Modularity
Software is divided into separately named and
addressable components, sometimes called modules,
that are integrated to satisfy problem requirements.
“modularity is the single attribute of software that
allows a program to be intellectually manageable”
you should break the design into many modules,
hoping to make understanding easier and, as a
consequence, reduce the cost required to build the
software.
However, as the number of modules grows, the effort
(cost) associated with integrating the modules also
grows.
Design Concepts
• Modularity
• Undermodularity or overmodularity should be avoided
• You modularize a design (and the resulting program) so that
• development can be more easily planned;
• software increments can be defined and delivered;
• changes can be more easily accommodated;
• testing and debugging can be conducted more efficiently, and
• long-term maintenance can be conducted without serious side effects.
Design Concepts
• 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.
• The use of information hiding as a
design criterion for modular systems
provides the greatest benefits when
modifications are required during
testing and later during software
maintenance
Design Concepts
• 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, and reusable modules
are possible.
• Independence is assessed using two qualitative
criteria: cohesion and coupling.
Design Concepts
• Functional Independence
• Cohesion is an indication of the relative functional strength of a module.
• A cohesive module should (ideally) do just one thing. Although you should
always strive for high cohesion.
• Coupling is an indication of the relative interdependence among modules.
• Coupling depends on the interface complexity between modules, the point at
which entry or reference is made to a module, and what data pass across the
interface.
• strive for lowest possible coupling.
Design Concepts
• Refinement
• Stepwise refinement is a top-down design strategy originally proposed by
Niklaus Wirth [Wir71].
• A program is developed by successively refining levels of procedural detail.
• A hierarchy is developed by decomposing a macroscopic statement of
function (a procedural abstraction) in a stepwise fashion until programming
language statements are reached.
• Refinement is actually a process of elaboration. You begin with a statement of
function (or description of information) that is defined at a high level of
abstraction.
• You then elaborate on the original statement, providing more and more detail
as each successive refinement (elaboration) occurs.
Design Concepts
• Refinement
• Stepwise refinement is a top-down design strategy
originally proposed by Niklaus Wirth [Wir71].
• A program is developed by successively refining levels of
procedural detail.
• A hierarchy is developed by decomposing a macroscopic
statement of function (a procedural abstraction) in a
stepwise fashion until programming language statements
are reached.
• Refinement is actually a process of elaboration. You begin
with a statement of function (or description of information)
that is defined at a high level of abstraction.
• You then elaborate on the original statement, providing
more and more detail as each successive refinement
(elaboration) occurs.
Design Concepts
• Aspects
• An aspect is a representation of a crosscutting concern.
• A crosscutting concern is some characteristic of the system that applies across
many different requirements.
• e.g. There are two requirements for abc.com
• Requirement A-Only registered users can access video and requirement B says registered
users must be validated prior to using abc.com
• An aspect is implemented as a separate module (component) rather than as
software fragments that are “scattered” or “tangled” throughout many
components [Ban06]
Design Concepts
• Refactoring
• It is a reorganization technique that simplifies the design (or code) of a component
without changing its function or behavior.
• Refactoring is the process of changing a software system in such a way that it does not
alter the external behavior of the code [design] yet improves its internal structure.
Fowler [Fow00]
• When software is refactored, the existing design is examined for redundancy, unused
design elements, inefficient or unnecessary algorithms, poorly constructed or
inappropriate data structures, or any other design failure that can be corrected to
yield a better design.
• For example, a first design iteration might yield a component that exhibits low
cohesion (i.e., it performs three functions that have only limited relationship to one
another). After careful consideration, you may decide that the component should be
refactored into three separate components, each exhibiting high cohesion.
Design Concepts
• Design Classes
• design classes that refine the analysis classes by providing design detail that
will enable the classes to be implemented, and implement a software
infrastructure that supports the business solution.
• Five different types of design classes, each representing a different layer of
the design architecture, can be developed [Amb01]:
• User interface classes
• Business domain classes
• Process classes
• Persistent classes
• System classes
Design Concepts
• Design Classes
• What is a “wellformed” design class?
• Arlow and Neustadt [Arl02] suggest that each design class be reviewed to
ensure that it is “well-formed.”
• They define four characteristics of a well-formed design class: Complete and
sufficient, Primitiveness, High cohesion, Low coupling,
Design Concepts
• Object-Oriented Design Concepts
Design Models
• Importance of Design Models
• Clarifies system structure: Helps in breaking down the system into
manageable components.
• Facilitates communication: Serves as a communication tool between
developers, designers, and stakeholders.
• Guides implementation: Provides a reference for developers when writing
code.
• Supports testing: Design models help identify potential issues early in the
development process.
Design Models
• Transforming customers requirements as per SRS into design.
• The design model has four major elements/models
• data, architecture, components, and interface, additionally deployment
Design Models
• Data Design Model
• Purpose: Defines the data structure and database design.
• Concepts:
• Data Flow: How data moves through the system.
• Data Store: Where data is stored and retrieved.
• Data Models: Logical and physical representations of data.
• e.g.
Consider an online library system:
Entities: Books, Users, Borrow Records.
Data Model: A relational database with tables for Users, Books, and BorrowRecords.
Design Models
• Architectural Design Model
• Purpose: Defines the software architecture, specifying the system's structure and the
relationship between its components. It also defines set of h/w and s/w components. S/w
architecture shows security(OTP,PW credential for authority, Antivirus),Perfomance (Request
and Response with minimum time e.g. any search engine),safety etc,
• Concepts:
• Architecture Styles: Layered, client-server, microservices.
• Components: Core elements or modules of the system.
• Connectors: Define how components interact.
e.g. In the online library system:
Layered Architecture:
Presentation Layer: User interface.
Business Logic Layer: Manages borrowing books, user authentication.
Data Access Layer: Manages database queries and updates.
Design Models
• Interface Design Model
• Purpose: Defines how the system interacts with users and other systems. i.e to communicate
externally and enable internal communication and collaboration among components
• Concepts:
• User Interfaces: Graphical and text-based interfaces. Front-end view from where user can
interact. UI design (increasingly called usability design) .
• External Interfaces: How the system communicates with external systems or services or
devices or network. i.e. which information is sent or received.
• It should incorporate error checking and (when necessary) appropriate security features.
• Internal interfaces :
e.g. Online library system:
User Interface: A web-based portal where users can view books and borrow them.
External Interface: Integration with a payment gateway for fees or an external book inventory API.
Design Models
When software becomes popular?
When its user interface is
UI design (increasingly called usability design) .
(e.g., layout, color, graphics, interaction mechanisms)
Design Models
• Component Design Model
• Purpose: Describes the internal details of each software components or modules.
• The component-level design defines data structures for all local data objects and algorithmic detail for
all processing that occurs within a component and an interface that allows access to all component
operations (behaviors).
• Concepts:
• Module Design: Defines how individual modules are implemented.
• Responsibilities: Specifies what each module does.
• Interaction: Defines how modules interact with each other.
e.g.
For the online library system:
Component 1: User Authentication Module (handles login, registration).
Component 2: Book Borrowing Module (handles the process of borrowing books).
Component 3: Notification Module (sends alerts to users for overdue books).
Design Models
• Deployment Design Model
• Purpose: Defines how the system will be deployed in the target
environment.
• Concepts:
• Hardware and Software Environment: Where and how the software will run.
• Deployment Diagram: Visualizes physical deployment of components.
e.g.
For the online library system:
Deployment: The system could be hosted on cloud servers. The user interface could be
deployed on web servers, while databases and business logic are handled by backend
servers.
Software Architecture
• What is software architecture?
• The software architecture of a program or computing system is the
structure or structures of the system, which comprise software
components, the externally visible properties of those components,
and the relationships among them. [Bass, Clements, and Kazman]
• It is a representation that enables you to (1) analyze the effectiveness of the
design in meeting its stated requirements, (2) consider architectural alternatives
at a stage when making design changes is still relatively easy, and (3) reduce the
risks associated with the construction of the software.
• It a blueprint for a system.
i.e. It shows all users, functionalities and database in one diagram.
Architecture Style
• An architectural style is a transformation that is imposed on the design of an entire
system.
• Each style of software architecture describes a system category that encompasses:
(1)A set of components (e.g., a database, computational modules) that perform a
function required by a system;
(2) A set of connectors that enable “communication, coordination and cooperation”
among components;
(3) Constraints that define how components can be integrated to form the system;
and
(4) Semantic models that enable a designer to understand the overall properties of a
system by analyzing the known properties of its constituent parts
Architecture Style
• Taxonomy of architecture style
• The architecture style is categorized as:
• Data-centered architectures
• Data-flow architectures.
• Call and return architectures.
• Object Oriented architectures
• Layered architectures
Architecture Style
• Taxonomy of architecture style
• Data-centered architectures
A data store (e.g., a file or database) resides at the
center of this architecture and is accessed frequently by
other components that update, add, delete, or
otherwise modify data within the store.
Used in DBMS, Library management system etc. e.g. In
library management system database-students,faculties,
books, suppliers, admin, staff database etc.
Client software accesses a central repository.
In some cases the data repository is passive. That is,
client software accesses the data independent of any
changes to the data or the actions of other client
software.
Architecture Style
• Taxonomy of architecture style
• Advantages:
• User can use data independently. Every user can perform action as per requirements.
• existing components can be changed and new client components added to the architecture without
concern about other clients. i.e. Modification is easy.
• data can be passed among clients using the blackboard mechanism(that sends notifications to client
software when data of interest to the client changes)
• Disadvantages:
• Data replication or duplication is possible.
• Changes affect to other user
Architecture Style
sensors are used by the security software and are shown as subordinate to it.
The homeowner and control panels are actors that are both producers and consumers of
information
Architecture Design
Architecture Design
• Architectural design tasks:
2. 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. In general, a
relatively small set of archetypes is required to design even relatively complex
systems.
e.g. archetypes for home safe system:
Node. Represents a cohesive collection of input and output elements , say sensors and alarm
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.
Architecture Design
• Architectural design tasks:
3. Refining the Architecture into Components:
But how are these components chosen? Classes are used from
requirements model. Classes represent entities of application domain-
source for derivation and refinements of components are:
1. Application(Business) domain
2. Infrastructure domain
Architecture Design
• Architectural design tasks:
3. Refining the Architecture into Components:
For the SafeHome home security function example, you might define the set of
top-level components that address the following functionality:
• External communication management—coordinates communication of the security
function with external entities such as other Internet-based systems and external alarm
notification.
• Control panel processing—manages all control panel functionality.
• Detector management—coordinates access to all detectors attached to the system.
• Alarm processing—verifies and acts on all alarm conditions.
• Design classes (with appropriate attributes and operations) would be defined
for each
• Transactions are acquired by external communication management as they move in from components that
process the SafeHome GUI and the Internet interface.
• This information is managed by a SafeHome executive component that selects the appropriate product
function (in this case security).
• The control panel processing component interacts with the homeowner to arm/disarm the security
function.
• The detector management component polls sensors to detect an alarm condition, and
• The alarm processing component produces output when an alarm is detected.
Architectural Design
• The Process
• The analysis and design process for user interfaces is iterative and can be
represented using a spiral model with the following activities:
• (1) interface analysis and modeling: focuses on the profile of the users (2)
interface design: defines a set of interface objects and actions. screen
representations.
• (3) interface construction: begins with the creation of a prototype that
enables usage scenarios to be evaluated.
• (4) interface validation: focuses on (1) the ability of the interface to
implement every user task correctly, to achieve all general user
requirements, how easy to learn and use, and users’ acceptance
User Interface Analysis and Design
• Interface Analysis
• Understand
1. the people (end users) who will interact with the system through the interface
known as user analysis. For this User Interviews can be done, inputs from sales,
marketing or support person can be taken.
2. the tasks that end users must perform to do their work, as task analysis.
What tasks and subtasks will be performed, What is the sequence of work tasks—the workflow?,
What is the hierarchy of tasks? etc., for this diagrams like Usecase can be used. Task analysis can
be done either mapping manual work with automated tasks or you can study an existing
specification for a computer-based solution and derive task that accommodate users model.
Focus on object elaboration with attributes as classes, understand how a work process is
completed when several people (and roles) are involved as work flow, a task hierarchy can be
defined for each user type.
User Interface Analysis and Design
• Interface Analysis
• Understand
3. the content that is presented as part of the interface:
display content can range from character-based reports (e.g., a spreadsheet), graphical
displays (e.g., a histogram, a 3-D model, a picture of a person), or specialized information (e.g.,
audio or video files).
4. the environment in which these tasks will be conducted:
In some applications the user interface for a computer-based system is placed in a “user-
friendly location” (e.g., proper lighting, good display height, easy keyboard access), but in
others (e.g., a factory floor or an airplane cockpit), lighting may be suboptimal, noise may be a
factor, a keyboard or mouse may not be an option, display placement may be less than ideal
Interface Design Steps
1. Using information developed during interface analysis, define
interface objects and actions (operations):
• they are categorized by type. Target, source, and application objects are
identified.
• A source object (e.g., a report icon) is dragged and dropped onto a target
object (e.g., a printer icon), action is to create a hard-copy report.
• Application object represents application-specific data that are not directly
manipulated as part of screen interaction. For example, a mailing list is used
to store names for a mailing. The list itself might be sorted, merged, or purged
(menu-based actions), but it is not dragged and dropped via user interaction.
• After this, screen layout is performed.
Interface Design Steps
2. Define events (user actions) that will cause the state of the user
interface to change. Model this behavior.
• User Interface Design Patterns.
• A design pattern is an abstraction that prescribes a design solution to a
specific, well-bounded design problem. e.g. consider a situation in which a
user must enter one or more calendar dates, solution is CalendarStrip that
produces a continuous, scrollable calendar.
Interface Design Steps
3. Design Issues
• system response time, user help facilities, error information handling, and
Menu & command labeling.