I recently started using a generative AI assistant in my IDE.
Initially I was reluctant as my IDE already generates code for me that I want and gives me control in doing so. For example, I can create a class with members and it will generate getters and setters for me, or if I extend a class it will put in methods are required to be over-written. It also offers content assist or auto complete when I want it. What would an AI tool give me that I need, and would it interfere with my concentration by suggesting things that don’t make sense or doing so too often?
And here is something else really important — my IDE does not take my code (my companies code!) and upload it to the internet! Some AI Assistants do this, and one should be cautious about what tool they use and how their data is used.
With that criteria in mind, I shopped around for something that promised to give good results, wouldn’t take my data, and received positive feedback on forums like Hacker News.
I wanted one that work within my usual IDE, and I found one that met my criteria and installed it. What happened next was a bit surprising — absolutely nothing! Did I do something wrong? Was my IDE incompatible? Did I need to summon the AI somehow?
And then, a few days later as I was writing some unit tests and the AI assistant began making suggestions. As part of my unit tests I needed to mock up some data, so I created a List. As I was initialising the List, a suggestion came up to use an ArrayList. I accepted by hitting the tab key — and voila the line of code was completed. That’s kind of neat. There are many implementations of List, but ArrayList is the most common so this was helpful.
I started to add some values to my List. Again, the AI assistant kicked in and finished my line of code. Then I hit return, and it automatically suggested another add to the List which is exactly what I wanted to do. That is very cool.
Next, my try blocks were being completed with a catch block, and as I was writing a unit test, the fail() method was subsequently suggested in the catch block. Something we have in other parts of the code, so that was a good suggestion!
I quickly created a number of tests on the problematic area, and as I was writing them quickly, my naming was the same with a different number at the end. The AI Assistant spotted this and suggested the name of the new test to be the same as the previous test + 1. Therefore the AI Assistant must be actively looking at my code, and making suggestions based on it, and not just making suggestions based on pre-canned or open source code that it may have been trained with.
Perhaps that is the reason it did not start offering suggestions immediately? It was taking time to scan my projects in my IDE to learn and make suggestions? I am not exactly sure!
What I am sure of though is that the AI Assistant is making me more efficient as a Developer by acting upon my prompts and giving me good suggestions. Now I am using AI to create AI in IBM AIOps!