DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • ReactJS With ChatGPT: Building Conversational AI Into Your Web Apps
  • Top 3 AI Tools to Supercharge Your Software Development
  • Exploring the Security Risks of Large Language Models
  • Unleashing the Power of GPT: A Comprehensive Guide To Implementing OpenAI’s GPT in ReactJS

Trending

  • Using My New Raspberry Pi To Run an Existing GitHub Action
  • BPMN 2.0 and Jakarta EE: A Powerful Alliance
  • Building a Performant Application Using Netty Framework in Java
  • Architecture: Software Cost Estimation
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. AI Code Intentions

AI Code Intentions

Any modern IDE includes Code Intentions that allow you to perform some predefined actions on your code based on a context or do some manipulation with the code.

By 
Gregory Ledenev user avatar
Gregory Ledenev
·
Jul. 07, 23 · Opinion
Like (3)
Save
Tweet
Share
4.8K Views

Join the DZone community and get the full member experience.

Join For Free

Any modern IDE includes Code Intentions that allow you to perform some predefined actions on your code based on a context. For example, for a  for statement, there can be several intentions like Convert to while, Reverse order, Use Streams, etc. The use of Intentions is very handy as it allows us to perform quick refactoring or do some manipulation with the code. 

Intentions are pretty hard to develop, so they are usually hard-coded and bundled with the IDEs by respective IDEs vendors. In some IDEs, it is possible to develop your own Intentions, but it is not so easy as it requires good knowledge of an IDE platform, writing lots of code, developing plug-ins to deploy your Intentions, etc.

Though, hard-coded Intentions can become obsolete. Today, you can ask an LLM, e.g., ChatGPT, to perform some action on your code, and it is pretty easy. You have to provide your code snippet and a proper prompt. For example, if you supply the following loop with the Reverse direction of a loop prompt to ChatGPT:

Java
 
for (int i = 1; i <= max; i++) 
    System.out.println("i = " + i);


You will get the same result as using similar hard-coded Intention provided by your IDE:

Java
 
for (int i = max; i >= 1; i--) 
    System.out.println("i = " + i);


So, it is pretty natural that we should introduce AI Intentions, which are basically named AI prompts bound to some context. Context can be a file, class, statement, particular method, etc., and IDE would be responsible for supplying the correct context, asking LLM with the correct prompt, obtaining and parsing results, and committing them back to the code. 

The advantages of having AI Intentions are:

  1. Almost any refactoring can be done using plain language. The prompts can be as simple as Replace using format for well-known  APIs (like Java’s PrintStream.println(String)), or they can be more complex with more instructions for less-known APIs.
  2. No need to hardcode AI Intentions.
  3. No need to write plugins to distribute AI Intentions.
  4. AI Intentions can be easily user-configurable.
  5. No need to use a Chat interface, especially for repeating activities.
  6. Less LLM token traffic to allow saving the cost compared to the use of a Chat interface.

Another cool option is AI intentions that are baked right into the API using annotations. Such declarative AI Intentions would instruct the IDE what intentions are available per class, field, or method and which prompt should be used to perform a particular Intention by asking an LLM. Such declarative AI Intentions can be supplied by framework/libraries authors, and therefore they can be immediately available to all the developers in IDEs that support them.

For example, the following annotation would specify a Replace using format AI Intention that allows replacing println(String) calls taking a concatenated string to println(String, Object...) calls taking format and arguments list:

Java
 
@AIIntention(title="Replace using format", prompt="Replace using format and arguments list")
public void println(String x) {
}


So applying such an Intention to a call:

Java
 
System.out.println("i = " + i);


Would result:

Java
 
System.out.printf("i = %d%n", i);


The use of declarative AI Intentions can drastically improve dealing with deprecated APIs. So some/each deprecated method can include a few AI Intentions to allow refactoring it to a modern version — no more need to skip refactoring in the future. Browse docs and manual coding - just make your code up-to-date in a single click.

I believe AI Intentions is the future of IDEs and LLMs integrations. So I hope they will appear in many IDEs in the nearest future.

AI API Integrated development environment ChatGPT Language model

Opinions expressed by DZone contributors are their own.

Related

  • ReactJS With ChatGPT: Building Conversational AI Into Your Web Apps
  • Top 3 AI Tools to Supercharge Your Software Development
  • Exploring the Security Risks of Large Language Models
  • Unleashing the Power of GPT: A Comprehensive Guide To Implementing OpenAI’s GPT in ReactJS

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: