( , ) , . if basePrice(), . if .
, . , .
, , . . ( ) , ( , , - , .., ,… ). , , . , ( , , ).
What I usually do is that I code in queries most of the time, and when I see that I call a specific request several times (unlike this example, where it is in separate conditional branches), I can use temp if it is local or introduces a memo or other type of caching system (such as a simple global variable or class member), if I need access to it in a wider, less local area.
When the reverse refactoring "Replace the request with Temp" comes in handy.
source
share