[Tutor] How to invoke different member-function according to different object?
steve at pearwood.info
Sat Jan 7 06:15:43 CET 2012
> 2. I think it's a little tedious, but I don't know how to improve it.
Welcome to programming!
In the school books and example code, you see a nice, clean, fifteen line
function and think that programming is easy.
Then you try to write the program, and you start of with 15 lines of code.
Then you add error handling, and you end up with 50 lines. Then you add a user
interface, and you have 130 lines. Then the user interface needs error
handling, and you have 250 lines of code. Then you try to improve the
presentation of the output, and you have 600 lines of code. Add error handling
to that, and a test suite, and before you know it, your 15 line function is
buried in the middle of a 3,000 line application.
Real programs always end up much bigger and more complicated and tedious than
the way you think they should be.
More information about the Tutor