Detailed Design
Detailed Design
Business
Algorithms
Data structures
Design Verification and Validation
Design Documentation
Detailed Design
• A detailed design is the complete specification of the
software and hardware components.
• It defines how the components will be developed to meet
the requirements.
• A detailed design document may include flowcharts, ER
diagrams, database tables, interface definitions etc.
Detailed Design
• Detailed design activities include
- creating a prototype user interface which helps developers and users to visualize the
interface before system development.
- developing detailed hardware and software component specification showing the
hardware, software and connectivity requirements to support the application e.g.
• amount of memory (16 GB RAM)
• processing power (Intel Core i3, 2.5 GHz)
• Storage (8 GB HD available space)
• Operating system (Windows 10, 64 bit)
• Web browser (Microsoft Edge)
• Protocols supported (TCP/IP, FTP, HTTP/HTTPS)
• Internet (Wi-Fi connection required for updates)
• Etc.
Algorithms
• The software specification includes algorithms, data structures.
• An algorithm is a step-by-step procedure for solving a problem.
• A set of well-defined instructions for performing a specific task.
• Algorithms are used to automate and solve complex tasks
• Data science: analyze and extract information from large amounts
of data
• Maths: solve linear equations
• AI: develop intelligent systems that perform tasks like image
recognition, voice recognition
Examples of Algorithms
• Cake recipe
• Finding the nearest restaurant
• Searching for articles on Software Engineering since 2020 up to
date
• Sorting a list of BBC students by CGPA
• Making weather predictions
• Analyzing the relationship between age and social media usage
• Etc.
Characteristics of an Algorithm
• Clear: Each step should be clear and have only one meaning
• Finete-ness: Should terminate after a finite time
• Feasible: Simple and practical
• Language independent: Written in plain instructions that can
be implemented in any programming language
• Input: Accept zero or more inputs
• Output: Should produce at least one output
• Effective: Each step should carry out some work
Example: Add two numbers and
Designing an Algorithm print the sum
1. The problem: Add two
1. Identify the problem to numbers and print the sum
be solved 2. Constraints: The numbers
must be digits not other
2. Identify constraints characters
3. Identify input required 3. Input: Two numbers
4. Identify output expected 4. Output: Sum of two numbers
5. Provide solution to the 5. Adding two numbers
problem
Designing an Algorithm
Step 1: Start
Step 2: Declare three integer variables num1, num2, sum
Step 3: Take the two numbers to be added as input
Step 4: Add the two numbers and store the result in the variable sum
Step 5: Print the value of the variable sum
Step 6: Stop
_____________________________________________________
Test the algorithm
Expressing an Algorithm – Flowcharts and
Pseudocode
• A flowchart is a graphical representation of an a algorithm.
• Easy to understand
• Difficult to present complex tasks
• Pseudocode expresses an algorithm in the form of informal text
written in plain English
• Easy to understand
START Start
Input Input Name
Name Output Hello Name
Output Hello End
Name
STOP
Expressing an Algorithm
Start
START
Declare num1, num2, sum
Read num1, num2
Read num1
Read num2
sum = num1 + num2 sum = num1 + num2
Print sum
Print sum Stop
Stop
Expressing an Algorithm
START
• Enter input of a salary, if
Enter salary
the salary is greater than
100,000 add a bonus of
5000 otherwise add bonus Salary>100,000 N Salary = salary + 2000
of 2000.
Y
Salary = salary + 5000
Output
salary
END
Expressing an Algorithm
• Enter input of a salary, if Start
the salary is greater than Enter salary
100,000 add a bonus of
5000 otherwise add bonus If salary > 100,000 then
of 2000. salary = salary + 5000
else
salary = salary + 2000
Output salary
Stop
Expressing an Algorithm - Practice
1. Write an algorithm for logging into your mubsep
account
2. Input a number and print prime or not prime
3. Draw flowcharts and pseudocode for the algorithms
Types of Algorithms
• Common types of algorithms include;
• Sorting Algorithms: Arrange elements in a specific order such as
numerical or alphabetical.
• Searching Algorithms: Find the position of an element in a collection
of data.
• Graph Algorithms: Solve problems related to graphs.
• Dynamic Programming: Solve complex problems by breaking them
down into simpler sub-problems.
Efficiency of an Algorithm
• If a program uses less CPU time and memory, it is efficient.
• Complexity of an algorithm refers to the measure of the time
that will be needed to execute to get the expected output
and the space required to store all the data.
• Time factor is measured by counting number of operations
e.g. arithmetic operations, if-else, loops, initialization
• Space factor is measured by counting the maximum memory
space required for the algorithm to run to completion.
Efficiency of an Algorithm
• Time complexity: Estimation of total CPU computations required
to execute algorithm. It is measured by counting the number of
times an instruction is executed referred to as frequency count
• Estimating time complexity
• Constant time part: Includes any instruction that is executed just
one e.g. input, output, if-else, switch, arithmetic operations
• Variable time part: Any instruction that is executed more than one
e.g. loops
Efficiency of an Algorithm
• Space complexity: Estimation of main memory space required to
execute an algorithm. Space to store source code, simple
variables, data structures used, recursive algorithms
• Estimating space complexity
• Fixed part: Space required for input and output variables,
constants
• Variable part: Space can be different based on the
implementation of algorithm. Used for temporary variables,
data structures
Data Structures
• Data structure provide a way of organizing and storing data in a
computer. Data is stored depending on the type of data and what is
needed to do with the data.
• Used to categorize and access data quickly and easily.
• Using the appropriate data structure helps develop efficient programs
in terms of execution time and memory usage.
• Enables design of algorithms that can handle large amounts of data.
• Choosing the right data structure involves considering the type and
volume of data, the desired operations and expected performance.
Data Structures
• Primitive data structures: Basic data structures provided by
programming languages to represent single values such as
integers, floating point numbers, Booleans, characters
• Abstract data structures: These are used to store large
amounts of data and provide complex operations e.g. arrays,
linked lists, stacks, queues, hash tables, trees and graphs
Abstract Data Structures
• Array: A collection of elements accessed using indexes.
Elements are stored in contiguous memory locations making
searching for elements in an array easy. However, it is harder
to insert or delete elements in an array.
1 2 3 4 Elements
0 1 2 3 indexes
Abstract Data Structures
• Linked list: Contains a pointer to the address of the next
element in the list.
• Faster at inserting and deleting elements
• To read from a linked list, you have to search from the
beginning making data access slower.
20 21 100 101
1 100 2 290
Abstract Data Structures
• Hash tables: Similar to arrays but instead uses keys to read
elements.
• Each value is paired with a key to identify and search
elements easily.
Kampala Nairobi Kigali