Mapa mental
3.3.7 Programming techniques
Conteúdo do mapa
3.3.7 Programming techniques
Stepwise refinement/modular programming
- Structured programming
- Problem split down into sub tasks
- Makes use of procedures and functions
- Functions, perform a single task and returns a single value
- Procedures can return 1, none or multiple values
- Control passed to procedure/function from main program, procedure executed and then control returned to main program
- Called from main program
- Data can be passed back and forth via parameters
- Varaiables passed to functions and procedures are called arguments or parameters
- If called by val then parameter would not revert back to original value outside procedure
- But call by ref would change the variable in the procedure
- If called by val then parameter would not revert back to original value outside procedure
- Allows independent creation of modules
- Varaiables passed to functions and procedures are called arguments or parameters
- Control passed to procedure/function from main program, procedure executed and then control returned to main program
- Can write modules in different languages
- Can split modules between people, most skilled programmer works on hardest module
- Save's money
- Saves time and money
- Can make libraries out of commonly used modules
- Makes use of procedures and functions
- Problem split down into sub tasks
- Structured programming
Stack
- Function or proceudre called
- Contents of registers put into stack including the return address
- CPU gets start address of procedure and puts in PC
- Procedure is run
- CPU pops contents of registers into stack including return address into PC
- CPU continues doing what it was doing
- CPU pops contents of registers into stack including return address into PC
- Procedure is run
- CPU gets start address of procedure and puts in PC
- Contents of registers put into stack including the return address
- A list
- Or LIFO data structure
- Function or proceudre called
Parameters
- Variable/ item of data passed to procedure or function to do calculations on
- Either by ref or by val
- If by val, any changes made in sub will not affect variable
- If by ref it does affect the variable
- Either by ref or by val
- Variable/ item of data passed to procedure or function to do calculations on
Global variables
- Declared in beggining of program
- Available to every sub
- Declared in beggining of program
Local variables
- Declared in a sub
- Only available in that sub
- More likley to be changed/corrupted by other subroutines
- Only available in that sub
- Declared in a sub
BNF
- Used to unambigously define the syntax of a computer language
Informações
- Descrição
- Mapa Mental sobre 3.3.7 Programming techniques, criado por Bobby Khaleque em 27-03-2015.
- Criado por
- Bobby Khaleque
- Visualizações
- 2
- Avaliação