Show students what code looks like with and without methods to motivate the reasons for using them.
Comparing code, like the examples listed below, can help:
students understand methods by mapping the code back to code without them.
motivate methods by helping students see how it makes the code easier to understand.
Code Comparison Examples:
Example code with methods:
|
Example code without methods:
|