AI Does The Difficult Job Of Naming Variables
Written by Kay Ewbank   
Wednesday, 10 January 2024

Microsoft has updated its Copilot extension for Visual Studio to add renaming suggestions based on AI. Is this a feature we'll rush to adopt?

Announcing the update on the Visual Studio developers blog, Dalia Abo Sheasha said:

"This feature doesn't just suggest names; it learns how your identifier is used and your code style to propose identifiers that seamlessly fit into your codebase. It's like having a dedicated naming expert by your side, enhancing your code while keeping you in the coding flow."

wincopilot

The new feature uses AI to analyze your identifier's current usage and the code's naming style. It then comes up with a range of expressive name suggestions. Yes, we've all been there on a bad day, though some of our name suggestions are more to do with alternative names for the pointy headed manager.

Microsoft's tool is more focused, with the aim of helping:

"improve the readability and maintainability of your code, ensuring its longevity and ease of comprehension for years to come."

The way it works is that you just select any identifier, right-click, and choose Rename. The tool will come up with a list of naming suggestions tailored to the context of your code.

Renaming in Visual Studio

To try out the feature you'll need an active GitHub Copilot subscription. Update the GitHub Copilot Chat Extension and enable the renaming feature from Options, GitHub, Copilot chat,  “Enable rename suggestions”.

Of course, those older developers among us (speak for yourself (Ed)), can remember the delights of code where the original developer had chosen to name everything randomly, such as the program where all the variables were named after racehorses. While that's an outlier, I have some nostalgia for those old Fortran programs where everything was I, J, K etc. to save on memory. After all, where's the fun in leaving your successors big clues as to what a variable is doing?

More seriously, it's tricky sometimes to think up something meaningful when you're creating the procedure. Would having help from Copilot be a good idea? Your answer is probably age related. While the results of the 2023 Stack Overflow Survey revealed that 77% of respondents are favourable towards using AI tools as part of their development workflow there is a clear correlation with experience - the longer your experience as a professional developer the less likely you are to be interested in using AI tools.

wincopilot 

More Information

GitHub Copilot Chat Extension

Related Articles

Microsoft Adds Copilot Key To Windows  

Microsoft Announces New Tools at Ignite

Developers Positive About Using AI Tools

GitHub Sees Exponential Rise In AI

Copilot Chat Improves Confidence and Enjoyment

What Devs Think About AI

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


ACM Adopts Open Access Publishing Model
05/04/2024

ACM, the Association for Computing Machinery, the professional body for computer scientists, has relaunched Communications of the ACM, the organization’s flagship magazine, as a web-first  [ ... ]



Avi Wigderson Gains Turing Award
16/04/2024

Israeli mathematician and computer scientist, Avi Wigderson, is the recipient of the 2023 ACM A.M Turing Award which carries a $1 million prize with financial support from Google.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 10 January 2024 )