Read time: 4 minutes

Today I want to share with you how I’ve been using AI to get my daily coding tasks done 10x faster.

In fact, I can’t code without some sort of AI assistance anymore. Seriously, I can’t.

Now, some of you might be thinking that AI is here to replace us, but that’s not the case.

AI is here to help us be more productive and focus on the things that matter.

Let me show you 5 ways I’m using specifically GitHub Copilot to get stuff done way faster.


1. It helps me understand new codebases

A few weeks ago I wanted to understand a few things about the new eShop reference application.

In particular, I wanted to understand the complete flow used to present the list of catalog items, going from the Blazor frontend to the backend API, the database and back.

In the past, I would have spent several minutes going through the code and debugging the application to understand this.

But now I can just clone the code to my box, open it in my VS Code instance and ask GitHub Copilot to explain that flow for me:

Notice how Copilot clearly identifies the files and methods involved in the flow, and even provides a brief explanation of what each method does.

This is an amazing way to get up to speed with new codebases in no time.


2. It anticipates and writes code for me

This is the reason why I can’t code without Copilot anymore.

In this case, I had my Game and GameDto classes ready, and I needed a simple method to convert the entity to the DTO.

So, after creating my GameMapping.cs file I just open curly braces to start the implementation and this happens:

The gray text is generated by Copilot, who already knows what I want to do and writes the code for me.

It even maps the objects both ways (entity to DTO and vice versa).

I just have to press Tab and it’s done. I might need to adjust a few things here and there, but 90% of the work is already done.

Big time saver!


3. It documents my code

As a best practice to help others understand your code, every public class and method should be properly documented.

I was very methodical with this in the past, even when it took me a lot of time on every new feature I implemented.

But fortunately, Copilot can help with that too. Here I wanted it to document my new GameMatcher class:

All I had to do was to click on that lightbulb, select the Document using Copilot option, and it generated a nice XML documentation for me.

No more manual documentation. No excuses for not documenting your code anymore.


4. It creates my unit tests

We already know that we should be unit testing the core algorithms and business logic of our applications.

But many times I end up spending more time writing the tests than the actual code, which is crazy.

Copilot can help with that too. Here I wanted to test this method from my GameMatcher class:

public GameMatch Match(string player)
{
    var existingMatch = GetMatchForPlayer(player);

    if (existingMatch != null)
    {
        return existingMatch;
    }

    var openMatch = matches.FirstOrDefault(m => m.MatchState == MatchState.WaitingForOpponent);

    if (openMatch != null)
    {
        openMatch.Player2 = player;
        openMatch.MatchState = MatchState.MatchFound;

        return openMatch;
    }
    else
    {
        var newMatch = new GameMatch
        {
            Id = nextMatchId++,
            Player1 = player,
            MatchState = MatchState.WaitingForOpponent
        };
        
        matches.Add(newMatch);
        return newMatch;
    }
}

So I asked Copilot to do the heavy lifting for me:

The generated tests are not perfect, but surprisingly they all pass and already cover the key scenarios in the GameMatcher business logic.

It’s a great starting point that already saved me a lot of time.


5. It generates my commit messages

At some point, you have to commit all that code.

Writing good commit messages is important to help your team understand what you did and why.

Turns out that Copilot can help with that too. Here I wanted to commit the new unit tests:

All you do is click those stars and it generates a commit message for you based on the changes you made.

It gets a bit confused when you commit multiple files, but for more isolated changes it works great.

And those stars will also show up in other useful places, like in your Terminal when your app crashes or starts throwing weird errors. It can help you explain those errors too!


Summary

AI is here not to replace us, but to help us be more productive and focus on the things that matter.

I’m still learning how to use Copilot to its full potential, but I’m already seeing a huge productivity boost in my day-to-day coding tasks.

If you haven’t tried it yet, I highly recommend you do.

It’s a game-changer.



Whenever you’re ready, there are 3 ways I can help you:

  1. ​Building Microservices With .NET:​ The only .NET backend development training program that you need to become a Senior C# Backend Developer.

  2. ASP.NET Core Full Stack Bundle: A carefully crafted package to kickstart your career as an ASP.NET Core Full Stack Developer, step by step.

  3. Promote yourself to 15,000+ subscribers by sponsoring this newsletter.