Understanding the requirementspecification - what the program aimstoachieve
Analysis
Decomposition - breaking down a complex problem into smaller parts
Abstraction - keeping the essential elements and discarding unnecessary details
Design
Developers continue the decomposition and start visualizing the end product using methods like structure diagrams, flowcharts and pseudocode
Coding
Programmers work on the design modules and write code to make each part of the program functional
Testing
The system is divided into smaller sections to be tested for input, output and validation, using test data
PDLC
It is a cyclical process, not linear - after launch, programmers go back to analysis to identify new features to add
Computer systems are made up of software, data, hardware, communication and people
Subsystems
Computer systems can be divided into subsystems, which can be further divided into smaller subsystems
Structure diagram
Shows a top-down design in diagrammatic form, breaking down a problem into subsystems
Alarm clock app(Example)
Input: set time, turn alarm on/off
Process: check if time has reached, sound alarm
Output: sound alarm, send notification
A security system on a door allows a user to type a code into a key to enter the room and if an incorrect code is input and every message is shown and a short alarmsound is played
Security system
Input: Keypad to allow user to enter code
Process: Check if code entered is correct
Output: Sound alarm if incorrect code
Algorithm
A set of instructions for solving a problem or accomplishing a task
Flowcharts and pseudocode are effective in communicating how the algorithm that makes up a system or subsystem work because it shows the algorithm in a diagrammatic manner
Flowchart components
Terminal symbol (rounded rectangle): Start/end
Process (rectangle): Instruction/step
Input/Output (parallelogram): User input/output
Subroutine (special symbol): Smaller procedure within program
Flow line (arrow): Direction of flow
Flowchart for computer program
1. Input two numbers
2. Multiply numbers
3. Check if product is greater than 100
4. Output "Greater than 100" if true
5. Ask user if they want to continue
6. Loop back to input if yes, end if no
Flowchart for concert ticket sales
1. Input number of tickets
2. Check if number of tickets is greater than 25
3. If true, ask user to re-enter
4. Calculate totalcost based on number of tickets and discounts
5. Output totalcost
Decision variable
1. Check if number of tickets is greater than 25
2. Check if number of tickets is less than 0
If the condition is met, we'll ask the user to input again. If the condition is not met, the user can continue
If the user has keyed in a valid value between 1 to 25, we need to check if they are eligible for a discount
Discount calculation
1. Check if number of tickets is greater than 10
2. Check if number of tickets is greater than 20
3. Calculate discount percentage
4. Calculate total price after discount
The final step is to output the total price for the user
Pseudocode
A way to write down the algorithm of a program using English keywords, without the strict syntax rules of programming languages
Pseudocode
It is universally understandable, not bounded by programming language syntax
It can be easily translated into any programming language
Assignment statement
Assigning a value to a variable
Array
A container that can store multiple items under one variable name
Declaring an array
1. Declare array_name array 1 to 10
2. Access element at index 12: array_name[12]
Input
Asking the user for input
Output
Displaying information on the screen
Conditional
Allowing the algorithm to do different things based on different conditions
Conditional structure
1. If condition then
2. Else
3. End if
if
Key word used to start a conditional statement
then
Key word used to indicate the code to be executed if the condition is true
else
Key word used to indicate the code to be executed if the condition is false
Condition
The expression that evaluates to true or false
The code encapsulated by the then keyword will be executed if the condition is true, the code encapsulated by the else keyword will be executed if the condition is false
The end if statement signifies the end of the conditional logic
Comparison operators like greater than, less than, equal to are used to create the condition in an if statement
Pseudocode for program that asks user height and weight, outputs message if height>170 and weight<85
1. Input height
2. Input weight
3. If height is greater than 170 AND weight is lighter than 85