Timeline for Map<ID, Map<string, Map<ID, List<PricebookEntry>>>> Good practice or bad?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 12, 2014 at 1:03 | comment | added | DavidWaugh | Scratch that, I switched SFDCFOX's algo to lazy loading, as there are cases where the map will not be required within an execution context. Thanks! | |
Jun 12, 2014 at 1:01 | comment | added | sfdcfox♦ | If you're using lazy-loading, and you call a function, you have to be careful not to directly reference the variable you're loading, or you'll run into a stack overflow. Instead, you'll have to call that function and return a value that will ultimately be assigned to the variable within the getter method. | |
Jun 12, 2014 at 0:45 | comment | added | DavidWaugh | To Jeremey, in this particular case, static init should be acceptable because there is no case where this class will be called where this data structure will NOT need to be populated. But I did look up some use-case info on static init vs. lazy loading, so I feel like I can spot the use cases for both in the future. | |
Jun 12, 2014 at 0:44 | comment | added | DavidWaugh | To SFDCFOX, thank you for your detailed answer. That is excellent insight into translating complex code/structure into a readable, concise method. I obviously still have a lot to learn. I especially appreciate the point about PBEntry and composite key, as that simplifies the 'read' method as well. Thanks for your time. | |
Jun 12, 2014 at 0:41 | vote | accept | DavidWaugh | ||
Jun 12, 2014 at 0:21 | comment | added | Jeremy Nottingham | My concern with using a static initializer like you have is that the Pricebookentry query is run even if that big map isn't called for. If it were moved out of the getter and into a separate method, I think that a "lazy loading" approach could still be worth doing. | |
Jun 11, 2014 at 23:03 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
deleted 6 characters in body
|
Jun 11, 2014 at 22:56 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
deleted 6 characters in body
|
Jun 11, 2014 at 22:50 | history | answered | sfdcfox♦ | CC BY-SA 3.0 |