· tools

An Evening Building an ROI Calculator using Blazor and GitHub CoPilot

If you read the news, it sounds like the AIs are coming for our jobs. While I don’t buy that for a second, we’re undergoing a significant shakeup in developer tools. We’re moving from digital picks and shovels to digital bulldozers and jackhammers. It’s essential to learn how to use these tools.

If you read the news, it sounds like the AIs are coming for our jobs. While I don’t buy that for a second, we’re undergoing a significant shakeup in developer tools. We’re moving from digital picks and shovels to digital bulldozers and jackhammers. It’s essential to learn how to use these tools.

With that in mind, I’m building a series of increasingly complex projects while trying to leverage various generative AI tools. I’ve already kicked the tires on ChatGPT by using it to build PowerShell and Terraform scripts. I had mixed results. ChatGPT is a champ at cranking out boilerplate code, but it’s not 100%.

More recently, I turned my attention towards GitHub Copilot. Unlike ChatGPT, GitHub Copilot integrates into most IDEs, including Visual Studio and Visual Studio Code. Pay your fee, install a couple of plugins, and your dev tools receive an upgrade. While you code, GitHub Copilot will suggest improvements and act as a suped-up autocomplete. Most suggestions are good, but the more code you generate, the less accurate Copilot tends to be. Copilot Chat gives you the ability to ask questions from within your IDE and skip shelling out to your web browser.

Time for a project

I’ve been doing a lot of client-side work in TypeScript lately, and after my latest fiasco with NPM package management, I’m looking for something a little less annoying. Enter Blazor. Blazor is a Web Assembly + Server Side framework that lets you write web browser code using C# and Razor. It’s been on my list for a long time, but until recently, it seemed underdeveloped compared to traditional JavaScript-based frameworks.

Given the average C# enterprise developer’s dislike of JavaScript, I’m surprised I haven’t seen more Blazor adoption. I’m not a JavaScript hater, but I’m all for skipping the bloated build chains and unnecessary complexity you see in large JavaScript / TypeScript projects.

Inspired by xkcd: Is It Worth the Time?, I decided to create an Automation ROI calculator. The goal is to determine whether or not it’s worth automating a task. To keep things interesting, I also added a bunch of variables to test different scenarios, like building an automation script for a group of people.

I spun up a default web assembly template using standard dotnet new tooling to kick things off. Seeing Bootstrap feels like a blast from the past. I’m surprised people still use Bootstrap when so many other UI frameworks have much less bloat.

After building the initial project, I used Copilot Chat to scaffold as much of the project as possible. If you give the tool precise lists of fields, it’ll do an okay job sketching out a class or form.

Code completions were okay most of the time. Copilot feels like a suped-up version of ReSharper. It will predict what you are doing and then let you tab complete through it. It’s fantastic when you have to make the same change in a bunch of places.

I also tried using Copilot to make unit tests for my calculation class. Copilot made tests but also made tests for private methods, which is not ideal. The tests also needed to be fixed. Again, it was good for getting you past blank page syndrome, but I still did most of the work.

After fiddling with Bootstrap styles, I deployed the app to an Azure Static Web App. It’s been a while since I’ve messed around with Static Apps, but the experience has dramatically improved. Azure’s experience is similar to Netlify, my current go-to for static sites.

If you want to calculate some ROIs, you can check out the project here: Should I Automate That

Impressions

Some studies show GitHub Copilot makes developers 40% more efficient. For me, I’d estimate it closer to 10%-20%. That sounds like a slight improvement, but it’s 100% worth the $10-$20/month price tag. My efficiency will likely improve as I use the tool more and Github continues to enhance its product. If you want to be more efficient, I’d recommend getting a subscription to Copilot. Copilot and tools like it will be the future of our industry, so you should jump on board now.

Should I Automate That

Blazor | Build client web apps with C# | .NET (microsoft.com)

GitHub Copilot · Your AI pair programmer

Should I Automate That: Repo

Back to Blog