2.2 Problem Solving and Programming.280155520
2.2 Problem Solving and Programming.280155520
• Variables can be either global or local scope. • Stakeholders say what they need from the solution. • Large or complex programs can • Sequence – Code is executed line by line from the
• Scope refers to the section of code where the • This information is used to produce a clear list of system requirements and a be split into smaller self top down.
variable can be accessed. definition of the problem. contained modules. • Breaching – A block of code is run only if a condition
• A local variable in a subroutine has • We may consider the strengths and weaknesses of a current system. • This makes it easier to divide is met using IF and ELSE statements
precedence over a global variable with the • We may consider the required inputs, outputs and the volume of stored data. tasks between a team and • Count Controlled Iteration – A block of code is run a
same name. manage the project. certain number of times. Uses FOR, WHILE or
Local Variables • It simplifies maintenance since REPEAT UNTIL statements.
• Can only be accessed within the subroutine each component can be handled • Condition Controlled Iteration – A block of code is
where they were defined. individually. run while or until a condition is met. Uses FOR,
• Multiple variables with the same name can • It improves the reusability of WHILE or REPEAT UNTIL statements.
exist in different subroutines. code.
• Are deleted when the subroutine ends. • Top Down (Stepwise) Refinement
• Ensures subroutines are self contained. • A technique used to modularise Integrated Development Environment
programs. • Programs used to write code.
Global Variables
• The problem is broken into sub • Contains a set of tools which make it easier for
• Can be accessed through the whole program.
problems until each sub problem programmers to write, develop and debug code.
• Used for values needed throughout the
is a single task. • May include stepping, variable watching,
program.
• Modules form blocks of code breakpoints, source code editor and debugging
• Risk the variable is unintentionally edited.
called subroutines. tools.
• Uses memory for longer.