Syllabus Detail
- functions 12 ATAR
- modularisation 12 ATAR
- statements 12 ATAR
- stubs 12 ATAR
Background
- Structured programming is a methodology used in programming
- It aims for clear, concise and high quality efficient programs
- Structured programming makes use of blocks of code (aka subroutines) that allow for the re-use of functions
- Loops (for, while and do-while) are commonly used in structured programming
- Structured programming is the fundamental concept behind Object-Oriented Programming
Functions
- A computer function is a procedure or routine a computer follows when executing a program
- Programs contain vast amounts of functions that, when processed and executed, return results
- Some languages define a function as something that returns a value as opposed to a routine which doesn't
- Functions allow us to re-use code without having to re-write it in different locations
- Functions do not execute immediately after the program has loaded, but rather when called upon
- By breaking down a program into functions, we're able to keep code efficient and clean
Example function (PHP):
<?php // This function returns the value of $x. function myFunction(){ $x = 3; return $x; }?>
Modularisation
- Modularisation is a term used for organizing and reducing the complexity of a program
- This is achieved by breaking up sections of code in to modules
- Visual Basic is a programming language that utilises modules
- Each module is used to define a set of tasks for the program to execute once called upon
- Modules are very similar to functions, although a module does not have to return a value
Statements
- A statement is a line or chunk of text written within a program.
- It causes some action to be carried out.
Stubs
- A stub in programming can be seen kind of like a placeholder
- It holds the place for code that is either handled remotely or code that has yet to be developed
- A stub can mimic the functionality of the intended code, but almost certainly is always smaller in size and contains less functionality
- Stubs are used to remind developers what a section of code is used for or to call in the remote processing function if necessary
Further Research
- Read about Structured Programming by c2.com here
- Read a WikiBooks entry about Computer Programming/Structured Programming here
Worksheet and Practice (yet to be added)
Found an error or have an enhancement? Please let us know via this contact form