-
Enhancement
-
Resolution: Done
-
Minor
-
None
-
None
-
2022 Week 05-07 (from Jan 31)
-
3
-
NEW
-
NEW
SolutionDescriptor (via methods such as getAllFacts()) forces inefficiency to spread throughout OP code. This method first creates a list of all entities and problem facts, only for call sites to then iterate over it, possibly several times. This means that, in order to get anything done, the list will be iterated over at least twice.
This can be avoided if we instead provide a method visitAllFacts(), which does not return a list, but rather goes over every item that would have been added to the list and applies a visitor on it. In this approach, no list is ever created, and the number of iterations stays at 1, regardless of how many operations need to be performed. (As these can be grouped inside of the visitor.)