A coworker suggested to me that a mistake made by another developer where I am who didn't last was to make an Angular 2 component for picking an address that called out directly to a service to get a list of job sites which entails hitting an API endpoint to have C# query a database. The problem with this came in when two component instances sat side by side in the application. Example: In some inventory management scenario across company divisions where you have a form where you select a billing address and a shipping address for product to be moved and those two things (component instances) sit next to each other at a little form we have a problem. Two calls are made to the database for the same list of records. Boo! Instead the call should be made from a service call outside the components and the accrued data should be handed in. Don't repeat yourself. This is a really easy mistake to make and I could easily imagine myself making this mistake when a coworker told me about it. It just seems at first that the call to get the job sites goes with the component to manage a street address selection, right?
No comments:
Post a Comment