The world of software development is constantly evolving, and with the recent advancements in AI technologies, developers now have powerful tools at their disposal to help with everyday tasks. In this blog post, we will discuss how AI tools like ChatGPT and GitHub CoPilot have made a significant impact on our workflow, increasing productivity and improving the quality of our work.
GitHub CoPilot: The AI-Powered Assistant for Developers
I have been using GitHub CoPilot since August 2022, and it has proven to be an invaluable asset. It has provided the following benefits:
Speeding Up Smaller Tasks
GitHub CoPilot has significantly sped up smaller tasks such as creating demo content in CSV files, updating hooks, and managing dependency injections. This has allowed our developers to focus more on complex tasks and problem-solving.
Dependency Injection is a fundamental part of Drupal development, and it’s a chore that we need to do over and over again. Here’s how CoPilot speeds it up for an existing class:
Demo content is essential for our way of developing and it also makes testing much easier. But the creation of such content was, well, boring. Here’s how CoPilot speeds it up:
Seamless Integration with IDEs
Although GitHub CoPilot sometimes interferes with the built-in autocomplete feature of PhpStorm, it generally integrates nicely with our favorite IDE. This seamless integration ensures that we can use GitHub CoPilot’s AI-powered suggestions without disrupting our normal workflow.
ChatGPT: A Multi-faceted AI for Developers
My journey started March 2023, when I subscribed to ChatGPT and it has been a game-changer in various ways.
Speeding Up Larger-Scale Tasks
ChatGPT has proven to be extremely helpful for larger-scale tasks. For example, it wrote the entire SQL-Database-Scanner script, which we only had to make minor corrections to. This Python script scans an SQL dump, checking for crypto-miners and injected scripts in general.
This is actually executable and works flawlessly. The only thing I modified is the extension, to allow .yml
extension too, to
scan a config directory in a Drupal instance. The multi-threading part worked like a charm, multiple CPU cores were utilized - that’s something
much more difficult to do properly using PHP.
So for someone who has very limited Python knowledge, but general programming experience, it became quite easy to craft a Python script. We are much less bound to the language, and can focus on the problem at hand. Also, on its own it’s not a larger-scale task. If you aim for something really complex, be prepared to have errors in the generated code, but it’s a good technique just to copy-paste the error to the chat and it can iteratively improve the code.
Assisting with Post-Mortems and Issue Descriptions
ChatGPT has provided excellent help for writing post-mortems and issue descriptions on Drupal.org. In one instance, when the maintainer asked for more explanation on a patch, we gave ChatGPT the patch and asked it to fill the issue template. The result was a clear and concise description that satisfied the maintainer’s request.
In the above recording, I picked a random Drupal core issue and asked to create a standard issue description from it. As you can see, the explanation is fairly good, only a few edits were needed to make it better.
Criticism and Concerns
As these tools use language models, they don’t understand the code, so sometimes there are trivial mistakes that we need to correct. For example for the SQL scanner tool, it wanted to read the whole SQL dump in the memory. That’s a novice mistake, but after raising the performance concern, it was able to fix it. Also there’s a great concern about who uses the data and and how data is used by these types of tools. There’s a large effort to provide LLMs that can run on your local computer, using a local dataset, and not sending the data to the cloud. We are eager to see how this will evolve. The current available self-hosted tools still lag behind in quality.
Summary
From a web developer’s point of view, these tools put the fun back into coding. You can outsource mundane tasks to AI and focus on what’s exciting. From a business perspective, it’s a great way to save time and money.
Did I already mention that you can ask the AI to formulate a blog post? For the record, the screencasts were not generated by the AI.
The blog post thumbnail is from the Midjourney Discord server: