2 ms·
We no longer use memoization except for older code. New code has anything that needs to be memoized defined in the initialize method. This solves a lot of prob
by jweir 2y ago
We no longer use memoization except for older code.
New code has anything that needs to be memoized defined in the initialize method. This solves a lot of problems and Sorbet typing is what encouraged us to go this route.
Now there could be a branching problem - one branch will not need to call the expensive thing another would not. In reality I have found this never to be the case in our code base. May be different for your designs.