Slr 23 Flashcards
Sequence
Executing instructions one after another
Selection
A construct that allows a program to change direction depending on the outcome of a condition
Selection example
If statement
Iteration
Allows user to repeat sections of code
Iteration example
For loop (count controlled- number of iterations known before)
While loop (condition controlled- number of iterations not known because the variable used to determine when it ends is changing within the iteration itself)
Nest programming constructs
Iteration or selection (or both)
Local variable accessibility
Single subroutine only
Local variable created
Declared inside a subroutine
Local variable destroyed
When the subroutine exits
Global variable accessibility
Entire program
Global variable created
Declared outside a subroutine. Typically at the start of a program.
Global variable destroyed
When the program ends
Modularity
Concept of breaking down a large program or problem into smaller chunks
Modularity goal
To design a program in a way that each module carries out a single, specific task
Modules known as
Subroutines, procedures, functions, methods
Procedure
Block of code that takes in zero, one or more parameters and performs a set task
Function
Block of code that takes in zero, one or more parameters; performs a set task; and returns a value
Return value
Does not need to be assigned to a variable as long as it returns something valid
First line means
The first line of a subroutine specifies the interface for that subroutine
The interface outlines
The name of the subroutine
The list of parameters it requires when it is called
The data type for those parameters
The order of those parameters
- if the subroutine interface is for a function, it also typically includes the data type of its return value
Two methods to pass data into subroutine
Passing by value
Passing by reference
IDE definition
An IDE is a program that provides a set of tools and related functionality designed to maximise a programmers productivity (e.g. IDLE)
IDE common features
Code editors
Error diagnostics
Run time environments
Translators
Auto documentation
Syntax highlighting
Autocompletion
Define code editors
A text area for programmers to enter code directly into the IDE, often supports additional features like syntax highlighting, autocomplete and automatic indentation