Timeline for Storing values or calculating values
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 16, 2017 at 11:41 | vote | accept | JonathanPeel | ||
Nov 5, 2016 at 17:44 | comment | added | radarbob |
Yes, In this case the API is the same . What I meant to say is picking Angle1 because "it is cleaner, easier, and read-ier" is completely dismissing appropriate design considerations. Scale that to a million lines of code then the lack of coherence and consistency hits you right between the frontal lobes and future you is in for many, many hours of WTF-ery.
|
|
Nov 5, 2016 at 6:48 | comment | added | JonathanPeel | I really can't see the difference in using the two, there is a chance I missed something, but my intent was that from the outside, the two should be indistinguishable. | |
Nov 5, 2016 at 2:24 | comment | added | Cort Ammon |
There's another purpose of the lazy loading which may make Angle1 preferable in some circumstances. Lazy calculations are invaluable if memory is a major constraint. Angle2 has a much larger memory footprint. If the programmer may instantiate a few million Angle instances, Angle1 naturally communicates that intent. This is especially clear in examples like this where we really have one object that can be viewed two ways (a decimal angle or a DMS angle)
|
|
Nov 4, 2016 at 21:13 | history | answered | radarbob | CC BY-SA 3.0 |