For the last 18 months, I’ve been working for an organization that has what some might consider a unique requirement. Because of where our application’s data is sourced, we need to aggregate data on the client side rather than on the server. What this means is that for any one screen, we may make multiple calls to the server to grab all the data we need. Fortunately, because we adopted NgRX early in our adoption of Angular, we could avoid a lot of the headaches associated with client-side aggregation.
Maybe this is all obvious to you, but since I don’t see anyone talking about this when I search for “how to do NgRX” or the various variants, I thought I’d call it out in this weeks post.
If you haven’t been following along, you’ll want to review my previous posts on NgRX.
Last week I introduced how to really use NgRX. As promised, this week, I want to demonstrate some ways you might use NgRX in your own code.
Last week we went into a lot of detail about how the NgRX system should be wired together. Here is all of that in picture form.
- Tightly coupled code runs faster.
- Tightly coupled code is easier to write.
- Test Driven Development increases development time.
- Test Driven Development negatively impacts code design.
- Knowing the names of design patterns isn’t important as long as you can use them.
- All my customer cares about is how soon they can have the product, not how clean the code is.
All of these statements, and others like them, are excuses for not writing code correctly. And you know what an excuse is, right?
The skin of a reason stuffed with a lie.
The story goes that there were two men, Joe and Frank, who were camping out in the woods when a bear showed up in the camp. Terrified, they decided the best they could do would be to stay perfectly still until the bear left. Hopefully, the bear wouldn’t notice them. As the bear was poking around, Joe says to Frank, “What are we going to do if this doesn’t work?” Frank says, “Run!” Joe says, “You really think we can out run a bear?” Frank says, “I don’t need to out run the bear. I only need to out run you.”