Part 2, Numbers Strings and Lists Flashcards
what is a “prototype program”
this is a set of smaller programs which may become part of a larger program
or a program created to get an early idea of how a program may look
what is a “constant”
a constant is a variable which will not change its value during the execution of the program
what is meant by “self documenting” code
this is code that almost documents itself it means it is easily readable and self explanatory for anyone reading it
appropriately named variables and modules is such an example of self documenting code
what is meant by the term “hard coded”
this is a term to describe a value that appears in the code and will not change
unlike constants it will have no name and so is sometimes referred to as “magic numbers” because they make the code work but why is unclear and how it relates to the rest of the program is unclear
instead of hard coding a value what would be a more suitable solution that maintains readability
creating a constant for the value would be a more suitable solution instead of hard coding
this means all occurrences of the value are easily changed and the code is “self documenting”/more readable
what is “incremental construction”
this is the idea of constructing a value or variable step by step
example:
if we had to display a sentence to the user which contained variables we might construct a display_text variable adding parts of the sentence piece by piece
once built we display the display_text to the user
what does “running step-by-step” mean
this involves breaking a script apart and running each block one by one. then watching how each block operates within the program
what are four benefits of “running step-by-step”
- understand what a script does
- understand how variables change
- understand someone else’s work
- debugging
what is a “list”
a list is a collection of data stored together as one
name two properties that lists have
- lists can shrink and grow dynamically
2. lists can store numbers, strings and more
what are “data structures”
a data structure is how a programming language stores and handles data
this might include any relationships the data has or what actions may be performed on that data
what is “persistent data”
persistent data is data that is held unless explicitly deleted
an example could be data in a variable which would still remain after each running of a program unless explicitly deleted
what is a “specification”
a specification is description of a program giving details of what it should do
what is an algorithm
an algorithm is a step by step description of your program
creating an algorithm can be split into two distinct steps
what are they
- design
2. implementation