2.2.1 programing techniques Flashcards
Sequence
when code is executed line by line
Selection
A block of code is run if a specific condition is met, using IF statement.
Iteration
A block of code is executed a certain number of times or while condition is met.
FOR, WHILE or REPEAT loops.
types of iteration
Count controlled: iteration is repeated certain amount of times.
condition controlled: iteration continues until a given condition is met.
RECURSION
a programming construct in which subroutines calls it self until a certain condition is met.
advantages of recursion
recursion can be presented in fewer lines pf code, which make it less prone to errors.
disadvantages of recursion
inefficient use of memory, as the subroutine calls it self too many times.
Local variables
local variables can only be accessed within the block (subroutine) of code where they defined.
advantages of local variables
-multiple local variables with the same name can exist in different block of codes.
- using local variables ensure that subroutines are self contained, with no danger of variables been affected by codes outside the subroutine
Global variables
can be accessed across the whole program.
all variables used in the main body of program are considered global varibles
advantages of global variables
useful for values that need to be used by multiple parts of the program
IDE
integrated development environment.
a program which provide a set of tools to make it easier for the programmer to develop the code.
IDE stepping
this allows you to monitor the effect of each line by executing single line at a time.
IDE breaking point
IDE allows user to set a point in the program where the program will stop, it can be based on a condition or set to occur at a specific line
IDE Source code editor
The editor aims to make the coding process easier by providing features like autocompletion of words, indention and syntax highlighting