6 Ways ChatGPT Can Help You Code

ChatGPT is blowing up at the moment, and for good reason. Its capabilities are unlike anything we've ever seen. 

Will it take our jobs as developers? No. But, if used correctly, it will transform them completely. Here's how I am already using ChatGPT to turbocharge my productivity. It's fair to say if you're not using this, you're going to be at a significant disadvantage.

Here's just a few ways you can use ChatGPT to rocket boost your development work.

Provide a starting point

If you know what your code needs to do, ChatGPT can quickly fill out the functionality for you:

Understanding code

A simple example but a great way to get some context on badly named or hard to follow functions.It’s also very good at explaining the different decision paths and giving useful examples.

Improving Code

Add more functionality to your code based on your suggestions:

Give some more suggestions for improvements: 

Simplifying code, with explanations

I originally wrote this method (a looong time ago), and wanted to see how ChatGPT could make it simpler.

public static void ConvertImageToThumbnailJPG(Stream input, Stream output, int thumbnailsize = 200)
            int width;
            int height;
            var originalImage = new Bitmap(input);

            if (originalImage.Width > originalImage.Height)
                width = thumbnailsize;
                height = thumbnailsize * originalImage.Height / originalImage.Width;
                height = thumbnailsize;
                width = thumbnailsize * originalImage.Width / originalImage.Height;

            Bitmap thumbnailImage = null;
                thumbnailImage = new Bitmap(width, height);

                using (Graphics graphics = Graphics.FromImage(thumbnailImage))
                    graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    graphics.SmoothingMode = SmoothingMode.AntiAlias;
                    graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                    graphics.DrawImage(originalImage, 0, 0, width, height);

                thumbnailImage.Save(output, ImageFormat.Jpeg);
                if (thumbnailImage != null)

Documenting Code

ChatGPT can easily add comments based on what the code is doing. 

Writing Tests

And now, for the biggest time saving operation - automatically defining test cases, AND writing those tests:

It continued to give me all the tests I needed. This alone saved me a couple of hours.

Be careful relying on ChatGPT

You’ll notice some issues in the generated code - test cases 3 and 5 for example have inputs and assumptions which are not quite right. However, it’s trivial to change this in the real code. The important thing is that you are aware that ChatGPT often makes mistakes and you must check its work.

It can also be a little stupid at times:

A great companion

ChatGPT is not going to do all your work for you. But it can be an excellent partner - helping with a lot of grunt work and providing comprehensive suggestions. It’s up to you to vet those suggestions.

For simple code, this can be a massive time saver. For more complex code, be careful that it doesn’t give you more work by providing complex solutions which don’t quite work. It’s best to break the code down as much as possible as it seems to cope much better, most of the time.

Productivity 100x

Don’t think of ChatGPT as a threat to your job as a developer. Think of it as a critical tool, which can help you increase your productivity by several orders of magnitude..

Anyone not using it will find themselves left behind.

Start learning how to get the most out of ChatGPT today.


Popular posts from this blog

Story Points are Utter Nonsense

Foundations of Humane Technology - Course completed