This article covers two types of artificial intelligence tools that can make your life as a developer easier while boosting your productivity.

The first category of artificial intelligence tools is AI coding tools. AI coding tools are becoming ubiquitous because they provide numerous benefits, from picking up new languages more quickly to refactoring existing code and implementing tests.

The second category of artificial intelligence tools is collectively known as Atlassian Intelligence. These AI tools are built into Atlassian products and make using Atlassian tools more accessible and more effective.

Part 1: AI coding tools

AI coding tools provide numerous benefits. In this section, we’re going to take a look at five boosts:

  1. Working in an unfamiliar language
  2. Explaining code
  3. Suggesting improvements
  4. Refactoring
  5. Generating test code

Boost 1: Working in an unfamiliar language

You can find value when working in an unfamiliar language. AI coding tools help quickly work with a new language by providing syntax for various code structures. Do you know how to write a for_each loop in C++ but need to work in Go? AI coding tools can help.

C++

std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

for(auto i : v) {
  std::cout << i << std::endl;
}

Go

v := [10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

for _, s := range v {
  fmt.Println(s)
}

Boost 2: Explaining code

Another benefit of AI coding tools is their ability to explain code. You can ask an AI coding tool to explain what a piece of code does and ask it to suggest improvements. This capability helps you get up to speed with an existing code base that you need to modify or fix.

The code snippet

void foo(int n)
{
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));
 
    for (int p = 2; p * p <= n; p++) {
 
        if (prime[p] == true) {
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
 
    for (int p = 2; p <= n; p++)
        if (prime[p])
            cout << p << " ";
}

The explanation

The code you provided defines a function named foo that takes an integer n
as a parameter.

Inside the function, an array prime of boolean values is declared
with a size of n + 1. The array is initialized with true values
using the memset function.

The code then proceeds to find all prime numbers up to n
using the Sieve of Eratosthenes algorithm. It iterates over each
number p starting from 2, and if prime[p] is true, it marks all
multiples of p as false in the prime array.

Finally, the code loops over the numbers from 2 to n and if prime[p]
is still true, it prints the number p to the console.

So, the foo function essentially finds and prints all prime numbers up to n.

Boost 3: Suggesting improvements

You can ask AI coding tools to suggest ways to improve a piece of code. These tools often provide code snippets along with the suggestions. This capability enhances code reviews and can catch implementation problems early in development.

Text suggestion

The provided implementation of the Sieve of Eratosthenes is already quite efficient.

However, if you want to further optimize it, here are a few suggestions:

Avoid marking even numbers:
Since all even numbers greater than 2 are not prime, you can skip marking
them as false in the prime array. You can modify the loop that initializes
prime to only mark odd numbers as true.

Optimize the inner loop:
The inner loop for (int i = p * p; i <= n; i += p) can be optimized by
starting from p * p instead of p. This is because all multiples of p less
than p * p would have already been marked as false by previous iterations.

Use a bitset instead of a boolean array:
A boolean array uses 1 byte per element, whereas a bitset uses only 1 bit
per element. This can significantly reduce memory consumption, especially
for large values of n. However, using a bitset may introduce some
additional complexity in the code.

Code suggestion

#include <iostream>
#include <vector>
#include <bitset>

void foo(int n)
{
  // Use a bitset instead of a boolean array
  std::bitset<1000000> prime;
  prime.set(); // Set all bits to 1 initially

  // Only mark odd numbers as true
  prime[0] = prime[1] = 0;
  for (int p = 3; p * p <= n; p += 2) {
    if (prime[p]) {
      // Start from p * p
      for (int i = p * p; i <= n; i += 2 * p) {
        prime[i] = 0; // Mark multiples of p as false
      }
    }
  }

  // Print prime numbers
  for (int p = 2; p <= n; p++) {
    if (prime[p]) {
      std::cout << p << " ";
    }
  }
}

Explanations and suggestions aren’t always correct, but they can go a long way toward helping you come to grips with an unfamiliar code base.

Boost 4: Refactoring

Refactoring can be time-consuming and error-prone. AI coding tools can help. Given a function and a text description of what changes you want to make, AI coding tools can provide a reasonable first attempt at a refactor. Inspecting the proposed changes closely and running unit tests after the refactor to test for regression is a good idea. This capability saves time when making simple changes to functions.

Prompt

Refactor foo to return a std::vector of the primes instead of printing them

Suggestion

#include <vector>

std::vector<int> foo(int n)
{
  std::vector<int> primes;
  std::vector<bool> is_prime(n + 1, true);

  for (int p = 2; p * p <= n; p++) {
    if (is_prime[p]) {
      for (int i = p * p; i <= n; i += p) {
        is_prime[i] = false;
      }
    }
  }

  for (int p = 2; p <= n; p++) {
    if (is_prime[p]) {
      primes.push_back(p);
    }
  }

  return primes;
}

Boost 5: Generating test code

Writing tests is essential, can be difficult, and is often uninteresting. AI coding tools speed up this process by generating test cases and laying the groundwork for you to implement more complex test logic.

Prompt

Generate test code for foo

Suggestion

#include <gtest/gtest.h>

// Include the foo function implementation here

TEST(FooFunctionTest, SmallInput) {
  int n = 10;
  std::vector<int> expected = {2, 3, 5, 7};
  EXPECT_EQ(foo(n), expected);
}

TEST(FooFunctionTest, LargeInput) {
  int n = 20;
  std::vector<int> expected = {2, 3, 5, 7, 11, 13, 17, 19};
  EXPECT_EQ(foo(n), expected);
}

// Add more test cases as needed

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

The AI coding tool understood the language, C++ in this case, and used a valid testing framework without additional prompting. The suggested code may need adjustments to be wholly usable, but the AI coding tools can save your time and mental energy in implementing the basics.

Example AI coding tools

There are many tools in this space. Here are a few examples to get started with:

Part 2: Atlassian Intelligence

Atlassian Intelligence provides various AI-powered features to accelerate individual work and improve teamwork across the Atlassian product suite.

In this section, we’re going to take a look at four boosts:

  1. Natural language to JQL search in Jira
  2. Define any term or acronym in Confluence
  3. Summarize a page in Confluence
  4. AI-assisted PR descriptions in Bitbucket

Boost 1: Natural language to JQL search in Jira

Spend less mental energy and find the issues you need faster. Enter a search using natural language, and Atlassian Intelligence will convert it to Jira Query Language (JQL). You don’t need to remember JQL syntax whenever you want to search the backlog for a subset of issues; you can un-bookmark those reference docs and free up time and energy to build excellent software.

To use natural language JQL search, enable Atlassian Intelligence and go to the Issues tab in Jira. Look for the AI prompt and enter a natural language search.

Atlassian Intelligence will convert the natural language search to JQL and find all matching Jira issues.

Natural language to JQL search is fast and requires less mental effort, saving you time and energy.

Some example searches could include:

  • “Issues in project XYZ that were created in the last 30 days”
  • “Unresolved issues in project XYZ with a due date, ordered by the due date”
  • “Issues in project XYZ due before 1st December 2023”
  • “Issues in Sprint Two reported in November 2023”
  • “Issues missing an assignee”

Boost 2: Define any term or acronym in Confluence

Confluence is a team workspace where you and your team can collaborate on design, documentation, and project plans, among other things. Atlassian AI provides the ability to get a definition for any term in any document in Confluence.

Did you stumble across an unknown acronym or a term being used in an unfamiliar way? Ask AI to provide a context-specific definition based on the documents in Confluence.

Highlight a word, right-click, then click Define to get a context-specific definition based on your organization’s documents in Confluence.

This saves time by removing the need to dig through the document for a definition — or worse, search multiple Confluence pages for more context.

Coming soon to Jira, too!

Boost 3: Summarize a page in Confluence

No one wants to read a massive document unless it’s relevant and valuable. Summarize can help you understand what a document is about without spending a lot of time or effort. Find the Summarize button at the top of any Confluence doc after Atlassian AI is enabled.

Boost 4: AI-assisted PR descriptions in Bitbucket

Bitbucket is Atlassian’s SCM and CI/CD product that integrates directly with Jira. Atlassian Intelligence is available in the Bitbucket Pull Request tab.

You can use the

/AI

prompt to access a variety of options to assist in writing PR descriptions.

The list of Atlassian Intelligence-powered features is growing rapidly. Visit the Atlassian Intelligence page for future updates and join us in the Atlassian Intelligence community group to stay up to date.

AI Productivity boosts to improve your developer experience