Dave's Notebook

Optimizing Angular For Speed

I was recently asked how I would optimize an Angular site for speed. Interestingly, I’ve never written about this explicitly even though I’ve actually done quite a bit of work related to this issue.

For the purposes of this article, I’m going to assume you have already implemented most of the things that Angular gives you “for free.” For example, we won’t talk about “Tree Shaking”, that’s a given.

So, I give you my 30 or so tips on how to optimize an Angular application for speed.

Read More

Avoiding NgRx Boilerplate

One of the recurring complaints I hear about NgRX is that it requires too much boiler plate code. But, it doesn’t have to be this way. In fact, I’ve been working on a project that has a lot of NgRX code and I’ve been able to reduce the amount of boilerplate code to a minimum and gain features in the process.

Read More

Clean State Management with NgRx

Once again I’ve run into a situation where the code I’m looking at doesn’t resemble how the code was meant to be written.

I’ve spent the last month fixing bugs that can all be summarized by the following problems:

  • Reducers updating nested data.
  • Storing data manipulations that Selectors could perform
  • Using Effects as Selectors
  • Components doing too much data manipulation
  • Too many actions and indirection

Read More

NgZones Performance Impact

I’ve been working on this article for a month, off and on. When I started, I set out to demonstrate the performance impact of change detection in Angular. In particular, I wanted to demonstrate that turning zones off would have a significant impact on performance even if you followed all my other advice regarding performance optimization.

That is, if you had:

Read More

Every Programming Issue Solved

As I’ve considered all the issues I’ve seen over the years and, as I’ve talked with and interviewed with other developers, I’ve come to the conclusion that our industry has two main problems. Fix these and all the other issues we face will solve themselves.

Read More

Rethinking Action Names (Redux/NgRX)

If you’ve been using some form of Redux, you are familiar with the basic flow of data through the Redux loop. Central to this flow are Actions, the messages that trigger code in our Reducer or Effect/Epic/Saga (depending on what flavor of Redux you are using).

The model allows us to disconnect our code so that it only cares that an action was triggered in some way. That is, “when this action occurs, I will run this code.”

Because of this, we can create an action that triggers multiple code blocks to run. Our only concern is that the code that gets triggered can’t depend on each other.

In fact, much of the official literature encourages this practice.

And, this is where all our troubles begin.

Read More


The temptation, when using RxJS is to include conditional logic inside your map, tap, or subscribe blocks. But there is a much better way to deal with conditional logic that will make your code much easier to read and reason about. It also should make your code easier to test. But of course, once you have code that is easy to test, you probably no longer need to test it.

Read More