Page 237 -
P. 237
custom data objects
Do this!
Amend your code with the updated version
of your Athlete class before proceeding
with this Test Drive.
Test Drive
After running your existing program, try out your test code in the IDLE shell to confirm that
everything is working as expected.
As expected.
Create a new athlete.
Add one timing value.
Display the top three times (there’s only one, so that’s all you see).
Add three more timing values.
Display the top three times (which, now, makes a little more sense).
Great: it worked.
You’ve packaged your code with your data and created a custom class
from which you can create objects that share behaviors. And when extra
functionality is required, add more methods to implement the required
functionality.
By encapsulating your athlete code and data within a custom class, you’ve
created a much more maintainable piece of software. You will thank
yourself for doing this when, in six months, you need to amend your code.
Well done. This is really coming along!
you are here 4 201