If your parsing needs to be done in any case before the object has any use, why not do it in the constructor.
If you need to answer the various questions immediately after construction, lazy evaluation is of low usefulness: better have all the heavy lifting done up-front then.
If the return value of some methods depend on other info being available beforehand, then that is a good reason to control yourself the processing and not expect the user to make the right choices.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: Writing Object-Orientated Module: use of “new” and other methods.
by CountZero
in thread Writing Object-Orientated Module: use of “new” and other methods.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |