PROGRAM DESIGN AND DATA DESIGN
In software engineering, both program and data
design are crucial for creating robust and efficient
software systems.
Program design focuses on the structure and flow
of the software itself, while
data design focuses on how data is organized,
stored, and retrieved.
Documentation
Documentation
Allsupporting material that goes with a program
Two major categories: for users and for programmers
User Documentation: End users (people who use
computer programs)
Program Documentation
Internalprogram documentation: comments within code
External program documentation: supporting
paperwork written before programming begins
Output Documentation
Figure 3-2 Inventory records Figure 3-3 Inventory records
displayed in a GUI environment displayed in a running program
Input Documentation
Describes what input is available to produce the
output
File description:
Describes data stored in a file
Indicates fields, data types, and lengths
Figure 3-6 Inventory file description
Completing Documentation
• Program documentation may contain:
– Output design
– Input description
– Flowcharts
– Pseudocode
– Program code listing
• User documentation may contain:
– Manuals
– Instructional material
– Operating instructions
Modularization
Modularization: breaking a large program into
modules
Advantages of modularization:
Provides abstraction
Allows multiple programmers to work simultaneously
Allows code reuse
Makes identifying structures easier
Modularization
Module:
Unitof code that performs one small task
Called a subroutine, procedure, function, or method
Invoke (call) a method is to execute it
Calling method invokes the called method
Program contains unlimited number of methods
Each method can be called unlimited number of times
Modularization Provides Abstraction
Focuses on important properties while ignoring non-
essential details
Avoids low-level details
Makes complex tasks look simple
High-level programming languages allow English-like
vocabulary
One statement corresponds to dozens of machine
instructions
Modules provide another way to achieve abstraction
Modularization Provides Abstraction
(continued)
To-do list with abstraction To-do list without
abstraction
Pick up laundry basket
Do laundry
Take laundry basket to
Call Aunt Gogo the washing area
Prepare for SE paper Collect soap and buckets
Fill water in a bucket
Add washing soap
Soak the clothes in the
soapy water for 10
minutes
Wash, rinse,
Hang clothes on a rail
. . .
Modularization Allows Multiple
Programmers to Work on a Problem
Commercial programs rarely written by a single
programmer
Development time is significantly reduced
Large programming projects can be divided into
modules
Modules can be written by different programmers
or programming teams
Modularization Allows You to
Reuse Your Work
Subroutines that are useful should be used more
than once in a program
Example: routine that checks the current date
Instructions placed in their own module are easy to
port to other applications
Reusability: the ability to use modules in a variety
of applications
Reliability: assurance that a module has been
tested and proven to function correctly
Reliable software saves times and money
Modularizing a Program
Most programs contain a main program
Contains the mainline logic
Accesses other modules or subroutines
Rules for naming modules different for every
programming language
For this text:
◼ Must be one word
◼ Should be meaningful
◼ Followed by a set of parentheses
◼ Corresponds to module naming in Java, C++, C#
Modularizing a Program (continued)
Table 3-1 Suggested identifiers for a module that calculates
an employee’s gross pay
Modularizing a Program (continued)
Calling program (or calling module): one that uses
another module
Flowchart symbol for calling a module: rectangle with
bar across the top
Flowchart for the module
Startsymbol: contains module name
Stop symbol: contains exit or return
When a module is called, logic transfers to the model
When module ends, logic transfers back to the caller
Figure 3-8 Sample logic Figure 3-9 Logic from Figure 3-8
using a method
Figure 3-10 Logic from Figure 3-9 using two methods
Modularizing a Program (continued)
Method is encapsulated in another method if it is
contained in another method
Knowing when to break a module into its own
subroutines or submodules is an art
Best practice: place together statements that
contribute to one specific task
Functional cohesion: extent to which the statements
contribute to the same task
Data Design
Data Design
In software engineering, data design plays a pivotal role in defining
how data is stored, accessed, and manipulated within a software
system.
It serves as the foundation upon which software applications operate,
ensuring that data structures are optimized for performance,
scalability, and maintainability
What is Data Design?
• Data design refers to the process of organizing and
structuring data within a software system.
• It involves determining the data types, relationships,
and constraints that will be used to store and
manipulate information.
• Effective data design ensures that the software
system can efficiently process data, maintain data
integrity, and support future changes or scalability.
Importance of Data Design in Software
Engineering
[Link] Data Integrity and Consistency: Proper data design ensures that
the system maintains accurate and consistent data, supported by UML
diagrams that clarify relationships and data flows.
[Link] System Performance: Effective data design, visualized through
class and sequence diagrams, ensures that data operations are optimized
for performance, reducing latency and improving system responsiveness.
[Link] Maintenance and Scalability: A well-documented data design
makes it easier for developers to understand, maintain, and extend the
system. Diagrams provide a clear visual representation of data structures
and interactions, simplifying future modifications.
[Link] Robust Security Measures: Data design also incorporates
security considerations, such as access controls and encryption, ensuring
that sensitive data is protected throughout its lifecycle.
Challenges in Data Design
• Balancing Complexity and Simplicity: While detailed UML diagrams
provide clarity, they can also introduce complexity.
Striking the right balance is crucial to ensure that diagrams remain
useful without becoming overwhelming.
• Adapting to Changing Requirements: Evolving business requirements
can necessitate changes in data design. UML diagrams help in visualizing
the impact of these changes, but keeping them up-to-date can be
challenging.
• Managing Large-Scale Systems: In large systems, data design can become
intricate, with numerous classes, entities, and interactions. UML
diagrams provide a structured way to manage this complexity, but they
require careful planning and maintenance.
Best Practices for Effective Data Design
[Link] UML Diagrams Early in the Design Process: Start by creating
class, sequence, and other UML diagrams during the initial phases of
design to capture the system’s data requirements accurately.
[Link] Diagrams Updated: As the system evolves, ensure that your
UML diagrams reflect any changes in data design to maintain an
accurate representation of the system.
[Link] on Clear and Simple Design: Strive for clarity and simplicity in
your diagrams, avoiding unnecessary complexity that could hinder
understanding.
[Link] Feedback from Stakeholders: Regularly review your
data design and associated diagrams with stakeholders to ensure
they meet the system’s needs and are aligned with business goals.