in reply to Size of inside out object
I advise that you let your decision be governed, first by the overall simplicity of the resulting application, and second by avoiding the need to unnecessarily store “default” values. If you know that a car is Red unless otherwise specified, you don’t need to store Red.
I suggest that you use a true Perl object, unless you truly don’t know what the set of attributes might be. Here, in “getter” and “setter” routines, you can easily specify whatever logic you need, and do it but once. Perl’s “blessing” technique is good and efficient.
Obviously, some edge-cases of computer programming do from time to time present us with situations where “microseconds matter profoundly,” and the amount of storage that we must for one reason or another consume in-memory is enormous. But if it isn’t, then let concerns of simplicity, reliability, and maintainability win the fight over concerns of space and speed.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Size of inside out object
by BrowserUk (Patriarch) on Jun 06, 2012 at 22:30 UTC |