How GitHub Copilot and ChatGPT change the dynamics between NoCode and FullCode

How GitHub Copilot and ChatGPT change the dynamics between NoCode and FullCode

How AIs can help to level the field of knowledge and coding (with examples)

With more sophisticated NoCode Platforms like Azure Logic Apps or O365 Power Automate came more opportunities for IT personnel that do not code to dive into the automation realm, previously exclusive to Coders.

One thing NoCoders are reliant on is connectors. Connectors extend the workflow engines with connections to other systems and APIs like storage, databases or E-Mail services. This dependency on other people's work comes at the cost of being limited to the capabilities of the available connectors. If a connector does not provide a functionality there is usually no way for a NoCoder to add this afterwards.

Even for FullCoders (people who know how to implement algorithms by the means of sourcecode) those NoCode Platforms have a big advantage: Whatever you do here, someone can understand, improve and repair your work. In a time of programmer scarcity, this opens opportunities to share responsibilities.

Unfortunately more often than not a NoCode approach is deficient in terms of time effort and functionality. Depending on how much effort was put into a connector using it can be a tedious task, costing time and nerves (and sometimes one's sanity).

Wouldn't it be great if everyone could at least understand and maintain source code?

Using OpenAI chatGPT / DaVinci

Now almost everyone can. If the basics of programming are present (what is a loop? what is a function? what is a class?) there is are now tools to guide one through the process of improving or fixing a software available as code. Using ChatGPT a NoCoder can ask to simplify, comment and explain a given code.

Scenario: the logfiles reveal the error "The given key 'TimeOutUtc' was not present in the dictionary." and point towards the following function:

        private async Task CleanupStorage(string storageName, string containerName, ILogger log)
        {
            BlobServiceClient client = new BlobServiceClient(new Uri($"https://{storageName}.blob.core.windows.net"), new DefaultAzureCredential());
            BlobContainerClient container = client.GetBlobContainerClient(containerName);
            var blobs =  container.GetBlobsAsync().ConfigureAwait(false);
            await foreach (var blob in blobs)
            { 
                var blobClient = container.GetBlobClient(blob.Name);
                var metadata = blobClient.GetProperties().Value.Metadata;

                    if (DateTime.Parse(metadata["TimeOutUtc"]) < DateTime.UtcNow)
                    {
                        blobClient.Delete();
                        log.LogInformation($"Blob '{blob.Name}' deleted from Storage '{storageName}'");
                    }                
            }
        }

People with a strong coding background might already see the problem. (If not: don't worry. We are all at different stages of the coding journey)

It does clean up something, some storage. A NoCoder was tasked with investigating the problem. Let's first learn what it does:

This code asynchronously cleans up storage by deleting blobs whose metadata TimeOutUtc value is earlier than the current time. It does this by connecting to an Azure storage account with a given name, getting all blobs from the given container, and then looping through each blob. For each blob, it checks the metadata TimeOutUtc value, and then deletes it if that value is earlier than the current time. A log message is also outputted to provide additional information on the deleted blob.

(This output was made by the GPT3 Davinci Model, since chatGPT is on capacity right now. The GPT3 Model still does help though).

Next, let's explore the code in more detail:

Add comments to the code

// This is a private asynchronous method that performs a cleanup operation on a Blob container in an Azure Storage Account.
private async Task CleanupStorage(string storageName, string containerName, ILogger log)
{
    // Creates an instance of BlobServiceClient using the connection string and Azure DefaultCredential
    BlobServiceClient client = new BlobServiceClient(new Uri($"https://{storageName}.blob.core.windows.net"), new DefaultAzureCredential());
    // Get the reference to the specified Blob container
    BlobContainerClient container = client.GetBlobContainerClient(containerName);
    // Get a collection of Blobs asynchronously
    var blobs =  container.GetBlobsAsync().ConfigureAwait(false);
    // Iterate through each Blob
    await foreach (var blob in blobs)
    { 
        // Get the reference to the current Blob
        var blobClient = container.GetBlobClient(blob.Name);
        // Get the metadata of the current Blob
        var metadata = blobClient.GetProperties().Value.Metadata;
        // Check if the TimeOutUtc property of the metadata is earlier than the current time in UTC
        if (DateTime.Parse(metadata["TimeOutUtc"]) < DateTime.UtcNow)
        {
            // Delete the Blob
            blobClient.Delete();
            // Log the deletion of the Blob
            log.LogInformation($"Blob '{blob.Name}' deleted from Storage '{storageName}'");
        }                
    }
}

Now we have an even better understanding on what is going on. Lets try to fix the problem.

I am getting the error "The given key 'TimeOutUtc' was not present in the dictionary.". How do i fix that?

The error is thrown because the metadata of the Blob does not contain the key "TimeOutUtc". To handle this, you can add a check to ensure the key exists before attempting to access its value. You can modify the code as follows:

if (metadata.ContainsKey("TimeOutUtc") && DateTime.Parse(metadata["TimeOutUtc"]) < DateTime.UtcNow)
{
    blobClient.Delete();
    log.LogInformation($"Blob '{blob.Name}' deleted from Storage '{storageName}'");
}

And there we have it. We understand what is going on, what the problem is and how it is fixed. Now commit and home a CI/DI pipeline is working, or search the documentation on how to deploy.

GitHub CoPilot

GitHub CoPilot on the other hand helps directly with extending a given codebase. Github CoPilot learns from the project you are using. For example: if you have a functionality implemented in a different code file than the one open GitHub Copilot is aware of that and can suggest it to you without you even knowing it to be there.

The way these works is either by creating comments to tell CoPilot what to do or by writing the first few lines and letting copilot figure out the rest.

Scenario: A new API was added to a solution to upload a file. A feature needs to be implemented to save the uploaded file to the same blob storage other files are written to as well.

As NoCoder, we just provide a comment on what to do. GitHub Copilot figures out from the rest of the code what should be done. Of course, we need to verify what happens, do a step-by-step debugging, but the initial hurdle of starting is done.

Conclusion

Using OpenAI and Microsoft technology people who are not native to writing code can now perform maintenance and small improvement tasks. This is for the benefit of FullCoders as well, as they get freed up to do other things. It also allows NoCoders to abstract connectors by implementing features with code.

Did you find this article valuable?

Support Jens Caasen by becoming a sponsor. Any amount is appreciated!