Increasingly, I’m seeing myself using a search engine less, in favor of specific, AI generated code to solve my programming problems.
AI-assisted coding is a great way to enhance your productivity and get more out of your programming endeavors. AI can now provide remarkably accurate and helpful suggestions to reduce the time you spend on coding.
There's a long way to go, but I'm sure this will disrupt my traditional programming workflow that involves:
- Searching for solutions
- Finding the most relevant solution
- Tweaking the code to fit my needs
But I'm embracing the change - AI is enabling me to write code with minimal effort, saving me time and allowing me to focus on solving more complex challenges.
Here's some example's of how I used AI think week. I was honestly astonished by the results.
I wanted to write a SQLite query to remove the last element of a JSON array in the database.
That result is not exactly what I wanted. It is performing the JSON array element removal in Python.
I want the element to be removed entirely as a SQLite query.
Let's trying being a little more specific.
Viola! We have AI written code for us!
Not so fast. The code is not correct. It's off by one character. The correct
json_remove function call above would be
json_remove(json_field,'$[#-1]'). It was missing the
# character that would reference the last element of the array.
Here's another example of usable code generated without much effort.
In this instance, I wanted to take a string like
INVALID_PASSWORD in Jinja and transform it into a more human friendly version
I entered a search query 'jinja Title case' and saw the following results:
I choose the fourth search result. I took a cursory look at the page and the word capitalize stuck out to me. From my previous experience reading Jinja documentation, I remembered that Jinja does provide a function like that. So I went to the Jinja documentation page and looked for capitalize.
Then I tested this expression in a Jinja parser.
And finally, I have the result that I'm looking for!
Even though this process took me a few minutes, its quite a few steps, switching between windows, typing in some text.
I thought, wait a minute, why don't I see if I could have solved this problem using AI.
So that's exactly what I did.
My first prompt gave a usable result. But the second prompt gave me a full functioning piece of code as a Jinja macro that I could use. This took 30 seconds.
If you want to increase your programming productivity, give AI-assisted coding a try. It’s the perfect way to enhance your coding experience and take your productivity to the next level.