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:
|