Optimizing build pipelines in Azure DevOps

Build time before optimization: ~50 minutes

We have a monolith application hosted in Azure DevOps. We use the Pipelines product to run builds and tests on every pull request. After merging, the builds run again. Build times were creeping up towards an hour, leading to some pain points for our developers:

  • It’s really frustrating to feel pressure to release a hotfix, but it takes multiple hours to prep a release artifact
  • Even an insignificant code change due to PR feedback led to delaying the merge another hour
  • Developers get distracted during builds and move on to new tickets, increasing work-in-process counts and delaying merges

I wanted to get it down to under 20 minutes. Here’s how we did it.

Read More

Using Keyed Services in .NET 8

.NET 8 is going to ship Keyed Services with Microsoft.Extensions.DependencyInjection, the default IOC container. Keyed services allow developers to register multiple implementations of an interface under different names (or, more generically, “keys”). This is useful in some scenarios. Let’s take a look.

Read More

Choosing a DotNet Test Framework

I saw a Reddit post asking which test framework to use: xUnit, NUnit, or MSTest. I’ve used xUnit almost exclusively for years and don’t have firm enough experience with the others to recommend for or against them. Any bias I have against MSTest is probably years out of date. I hear it’s pretty good now!

Instead, I thought I would list my top test framework considerations.

Read More

Why AutoFac

I’ve frequently seen a question arise about why anyone would use an open-source dependency injection framework like AutoFac when Microsoft provides Microsoft.Extensions.DependencyInjection (MEDI). Isn’t that good enough?

It’s a fair question. MEDI is a capable dependency injection container and will support most application needs. However, I still find it worthwhile to plug AutoFac in.

Microsoft created MEDI so that framework and library authors could depend on some basic dependency injection capabilities without writing adapters for every popular DI container. Microsoft specified base-level functional expectations, but application developers that wanted more power could use a different tool as long as it could conform to the protocol Microsoft specified. As a result, the MEDI provides a limited feature set by design.

I frequently want more robust capabilities and will install AutoFac to get them.

The rest of this post will highlight some of the features of AutoFac that I particularly like. While not provided out of the box, Developers can emulate many of these features with MEDI, though perhaps clumsily. Some have no analog at all. Sample code is also on GitHub.

Read More

Tips for selling your technical vision

My company’s CEO once commented that Architect is a sales position. I think that is a wise observation and applies to most technical leadership roles.

It’s not enough to have good ideas: you need to sell them.

Here are some tips I’ve found that help build consensus and nudge a team in a direction I believe is best.

Read More

Using codemods to upgrade legacy code

Last week I helped a client plan an upgrade from an internal custom JavaScript library to a more modern UI framework. The existing code uses a tool called “jingo“ to manage dependencies. We wanted to support modern bundlers that use the new EcmaScript Modules (import and export) syntax. A straight forward mechanical transformation exists but the codebase consists of hundreds of files to convert. It would be tedious, boring work over the course of days. However, I could use codemods to write a script that would convert the syntax automatically.

Read More