My issue with this is that it works well with sample code but not as well with real-world situations where maintaining a state is important. What if rider.preferences was expensive to calculate?
Note that this code will ignore a rider’s preferences if it finds a lower-rated driver before a higher-rated driver.
With that said, I often work on applications where even small improvements in performance are valuable, and that is far from universal in software development. (Generally developer time is much more expensive than CPU time.) I use C++ so I can read this like pseudocode but I’m not familiar with language features that might address my concerns.
My issue with this is that it works well with sample code but not as well with real-world situations where maintaining a state is important. What if
rider.preferences
was expensive to calculate?Note that this code will ignore a rider’s preferences if it finds a lower-rated driver before a higher-rated driver.
With that said, I often work on applications where even small improvements in performance are valuable, and that is far from universal in software development. (Generally developer time is much more expensive than CPU time.) I use C++ so I can read this like pseudocode but I’m not familiar with language features that might address my concerns.