This past week I took a stab at implementing NgRX 4 Lazy Loading and learned a few things that weren’t obvious to me. I thought you’d want to hear about them.
I made a tweak to my Angular code process over the last month or so that has resulted in greater productivity in my development environment and fewer bugs.
Now, I didn’t make this change because I thought it would improve my productivity. At least that wasn’t the primary reason. I made the change because I thought it would reduce the chance of introducing bugs into my code. And while it does reduce the number of bugs in my code, the result has been generally improved productivity.
What is this great secret?
While testing Components is possible, it is not easy and is often pointless. Using the Model View Presenter pattern, or a variation of it, solves the problem.
Here’s the deal. Long time readers of my blog know I’ve been a proponent of Unit Testing for a very long time. While I was learning React, I went through the exercise of trying to write test as I was learning. Now, the great thing about Angular and React is that it is possible to test your components. The problem with testing components is that you are either testing that your HTML ended up in the right spot, that Angular directives did what they should, or you are evaluating the DOM to verify that component logic worked. In most cases, putting tests that do any of these at the component level is the wrong way to test.
Emotions are a weird element of being human. They can propel us forward or hold us back. Sometimes they are violent. Most of the time they whisper.
Several events have occurred recently that have me thinking about this more.
To start with, I’ve started paying more attention to my health. There were a lot of things holding me back from this in the past. But it turns out, most of what was holding me back was just a lie.
I’ve started interviewing again. The nature of what I do means I get to do this a lot. You’d think I’d get used to it. But, I don’t like the interview process. I don’t like changing jobs. I really don’t like code interviews. But, I do them because I like having money.
Some of the interviews I’ve been on have revealed that managers think in similar short-term ways that I have. Short-term thinking is so easy to see when it is someone else.