Thinking Ahead Flashcards
What is thinking ahead in terms of computational thinking?
The process of thorough planning of your code to ensure an efficient outcome and where possible using caching/pre-fetching
What is the advantage of documenting inputs and outputs?
There is no ambiguity in what must be supplied to the sub-procedure and what is returned
What is an input?
The capturing of data
What is an output?
The information produced
What are variable identifiers?
A suitable/sensible name for the variable for any programming scenario
What is a precondition?
A condition that must always be true just prior to the execution of some section of code
What happens if a precondition is violated?
The effect of the section of code becomes undefined and may not carry out its intended work
What happens if a precondition is incorrect?
Security problems may arise
What are 3 advantages of preconditions?
1) It makes program components reusable
2) It cuts out unnecessary checks
3) It makes programs easier to debug and maintain
What is a common precondition?
A list must not be empty or a positive integer must be entered
What are reusable programs?
They are programs which consist of pre-written functions or modules that can be repeatedly called
Why are reusable programs beneficial?
It enables programmers to save time during development because they know those modules have already been tested