2.2.1 programming techniques Flashcards
IDE
integrated development environment
features in IDE
- auto-indent
- auto-numbering
- auto-suggestion
- auto-fill
- coloring
- run time management
- debugging
debugging in IDE
- breakpoint: stop at that line
- step through: one line at a time
- watch: display variables
- trace: execute code, message at each function
types of errors
- syntax errors: wrong typing
- logic errors: codes does not make sense
types of IDE
-compiler: displays all errors after compilation
-interpreter: displays errors one by one
programming constructs
-sequence: order of code executed
-iteration: for/while/do…until
-branching: (selection) - if else; switch case
recursion
characteristics:
- must call itself
- finite number of calls (must be reached)
- must have a base case (stopping condition)
global variable
can be used outside of subroutines
local variable
used only within subroutines
passing by value
only a copy of data is passed
changes would be lost when the function/procedure ends
must return the variable to be passed onto the main code
(mark scheme)
passing by reference
will pass out of subroutine
return value automatically
modularity
modularisation - using functions and procedures
modules- a block of code with a given name
breaking down problems into subproblems like modules
benefits of modularisation
programs are more easily and quickly written (breakdown, modules reused, library)
programs are more reliable and have fewer errors
take less time to test and debug
programs are easier to maintain
functions
subroutine that returns a value
procedures
subroutines that perform the executions