Re:Code Smells: Iteration
by hedora on Wednesday August 23, 2017 @11:58AM
(#15082555)
The "smell" here is that the API does O(n) allocations for a read-only check of a database schema?
Why add an API to have a method that checks for containment directly (and hopefully delete the conatiner returning one entirely?)
Also, it probably makes sense to cache the schema data somewhere.
Finally, my gut tells me the check for the existence of this name probably can be moved earlier in execution (like during initialization of the called class), which will cause the system to fail earlier and be easier to debug (so it would be good to check that before touching it).
Why add an API to have a method that checks for containment directly (and hopefully delete the conatiner returning one entirely?)
Also, it probably makes sense to cache the schema data somewhere.
Finally, my gut tells me the check for the existence of this name probably can be moved earlier in execution (like during initialization of the called class), which will cause the system to fail earlier and be easier to debug (so it would be good to check that before touching it).