In this module we show how you can take "pieces" and put them together to create new stories. These "pieces" are the methods that we saw in the last module. In that module, we simply broke up a large block of code into these pieces, and then made calls to each piece in turn, to mimic our original code. In this module, we are going to explore this second use of methods - to enable us to re-use sections of code. We will see how methods can be used many times and in many different orders.
Things you will learn in this module:
All of these can be used to create a new story.
Vocabulary for this module:
Method: A collection of instructions that naturally belong together to do some thing/task (e.g., Freak Out).
Reuse: Making use of work done earlier to create code to solve a task. Achieved in two ways... (1) by putting code for a task that is performed more than once into a method, and then making multiple calls to that method prevents the need for the code to appear more than once. And (2) by copying a section of code or a method from one program to another. The code is copied, yes, but the effort to create the code is 'reused' in the second program.