Pass by Value - A copy of the data is made and stored by way of the name of the parameter, Any changes to the parameter have NO affect on data in the calling function.
Pass by Reference - A ‘reference parameter’ refers to the original data in the calling function. Thus any changes made to the parameter are ALSO MADE TO THE ORIGINAL variable.
Pass by Pointer (not required in syllabus) - A pointer is an argument in stead of a variable then the address of the variable is passed instead of the value. So any change made by the function using the pointer is permanently made at the address of passed variable.
Analysis - to define the problem, use abstraction and decomposition
Abstraction: filtering out and concentrating on the relevant information in a problem; allowing a programmer to deal with complexity
Decomposition:breaking down problems into sub-problems in order to understand a process more clearly; program modules, procedures and functions all help the programmer to break down large problems 1
(use modular programming)
Design - use structure charts, state-transition diagrams or pseudocode to plan how the tasks can be completed
Coding - write the program with actual code
Testing - run the program under different test data by different test methods
Maintenance - dealing with any problems that arise during use
This is the process of developing a modular design by splitting a problem into smaller sub-tasks, which themselves are repeatedly split into even smaller sub-tasks until each is just one element of the final program.
Break down the complex problem into smaller and more manageable parts.
These steps parts then need to be written as a series of steps.
Each step can be written as a statement in a high-level programming language.
Structure chart is a modelling tool used to decompose a problem into a set of sub-tasks.
It shows the hierarchy or structure of the different modules and how they connect and interact with each other.
Shows the sequence of module execution.
Represents Module Hierarchy (top-down approach with major modules on top)
Shows selections.
Shows repetitions.
Depicts the interface/connection between modules using parameters.
3 programming actions / features that can be depicted in a structure chart:
Procedures and functions - each module is represented by a box and the parameters passed to and from the modules are shown by arrows pointing towards the module receiving the parameter.
Selection - the diamond shaped box shows a condition that can be true or false.
Repetition - the repetition is shown by adding a label and semi-circular arrow above the module to be completed.
Symbol
Name
Meaning
Process
Each box represents a programming module = a calculation, output etc.
Data Couple
Data being passed from module to module that needs to be processed.
Flag
The check data sent to process to stop or start process. (only represent Boolean value)
State transition diagrams are suitable for systems with a fixed number of states that may change on input or when an event occurs (Final state machine).
It visually represents a system’s states, the events that causes transitions (Inputs or times), and the transitions between states.
They may also show the condition needed for an event to cause a transition (the guard condition) and the outputs or actions carried out resulting from a transition.
States are represented as nodes (circles).
Transitions are represented as interconnecting arrows.
Events are represented as labels on the arrows.
Conditions can be specified in square brackets after the event label.
The initial state is indicated by an arrow with a black dot.
A stopped state is indicated by a double circle.
↑finite state machine - a machine that consists of a fixed set of possible states with a set of inputs that change the state and a set of possible outputs.
Dry run / Walkthrough: The developer works through a program or module from a program manually and document the results using a trace table. A walkthrough is a formalised version of a dry run using pre-defined test case.
White-box testing: the detailed testing of how each procedure works, this involves testing the structure and logic of every part through a program module.
Black-box testing: tests a module’s input and output.
Integration testing: The testing of any separately written modules to ensure that they work together.
Stub Testing
Stubs are the modules that act as temporary replacement for a called module and give the same output as the actual product.
Test stubs are programs that mimic (copy) the behaviors of software components (or modules) that a module undergoing tests depends on.
Stubs are used during Top-down integration testing.
对于消费者的测试:
Alpha testing: used first - The completed or nearly completed program is tested in-house by development team.
Beta testing: used second, the completed program is tested by a small group of users before it is formally released.
Acceptance testing: Used third. The completed program to prove to the customer that it works as required in the environment in which it will be used.