Skip to main content
edited body
Source Link
Alexander
  • 5.2k
  • 1
  • 25
  • 28

It's a classical time vs. space trade-off.

If a, b, and c are trivial to derive from bar, then it's easiest to just have them be computed properties that derive a value from bar.

If they're expensive to computercompute, and small enough that they're worth the memory to cache, then you should make them stored properties. Their value should computed and cachecached either when bar is changed, or when they're accessed, whichever is less frequent.

It's a classical time vs. space trade-off.

If a, b, and c are trivial to derive from bar, then it's easiest to just have them be computed properties that derive a value from bar.

If they're expensive to computer, and small enough that they're worth the memory to cache, then you should make them stored properties. Their value should computed and cache either when bar is changed, or when they're accessed, whichever is less frequent.

It's a classical time vs. space trade-off.

If a, b, and c are trivial to derive from bar, then it's easiest to just have them be computed properties that derive a value from bar.

If they're expensive to compute, and small enough that they're worth the memory to cache, then you should make them stored properties. Their value should computed and cached either when bar is changed, or when they're accessed, whichever is less frequent.

Source Link
Alexander
  • 5.2k
  • 1
  • 25
  • 28

It's a classical time vs. space trade-off.

If a, b, and c are trivial to derive from bar, then it's easiest to just have them be computed properties that derive a value from bar.

If they're expensive to computer, and small enough that they're worth the memory to cache, then you should make them stored properties. Their value should computed and cache either when bar is changed, or when they're accessed, whichever is less frequent.