May 15, 2024

With AI Writing Code, Will AI Replace Software Engineers?

Static Analysis

Software developers have plenty to keep them awake at night. Their top concern is no longer how to express the latest algorithm in their favorite language (C, C++, Erlang, Java, etc.). Instead, it’s being replaced by artificial intelligence (AI).

Here we take a look at the process for AI writing code and answer the question: Will AI replace programmers?

Read along or jump ahead to the section that interests you the most:

➡️ Start Your Free Static Analysis Trial

Back to top

What Is AI Code Generation?

The use of generative AI has exploded in recent years, largely due to there now being enough computational power to run the deep learning algorithms and an increase in massive amounts of data needed to train machine learning models. 

AI code generation is the process of writing computer code using generative artificial intelligence and machine learning.

Generative AI coding tools are changing the process of software development. But such advances bring uncertainty. With AI writing code, what will this mean for software developers? 

Back to top

The Future of AI Writing Code

The potential of generative AI is already taking shape. AI is transforming industries and is poised to accelerate innovation. A recent study conducted by OpenAI estimated that generative AI tools could impact 47% of all tasks, dramatically speeding up the software development process.

In a survey conducted by Evans Data Corp, 550 software developers were asked about the most worrying aspects in their career. “I and my development efforts are replaced by artificial intelligence,” said 29%.

A team of researchers at the U.S. Department of Energy's Oak Ridge National Laboratory agrees. By 2040, machine learning and natural language processing technologies will be so advanced that they will be capable of writing better software code. And they’ll do it faster than the best human developers. 

Oxford University’s "The Future of Employment" study warns that software engineers may become computerized as machine learning advances. And software design choices will be optimized by algorithms.

Software development, particularly in safety-critical industries, needs to ensure high code quality that delivers on functional requirements.

So, if AI is developing code, the code should be error- and issue-free. This also includes AI in software testing, as it should be able to detect coding errors “with a reliability that humans are unlikely to match.”

If you do have AI writing code, be sure to verify that it is safe, secure, and reliable by using a static code analyzer.

➡️ Start your free static code analyzer trial today and put your code to the test.

Back to top

Is AI Writing Code Possible? 

AI can write code.

As early as 2015, Andrej Karpathy ran a project that used Recurrent Neural Networks to generate code. He took GitHub’s Linux repository (all the source files and headers files), combined it into one giant document (it was more than 400 MB of C code), and trained the RNN with this code.

Here’s what it produced:


 * If this error is set, we will need anything right after that BSD.
static void action_new_function(struct s_stat_info *wb)
  unsigned long flags;
  int lel_idx_bit = e->edd, *sys & ~((unsigned long) *FIRST_COMPAT);
  buf[0] = 0xFFFFFFFF & (bit << 4);
  min(inc, slist->bytes);
  printk(KERN_WARNING "Memory allocated %02x/%02x, "
    "original MLL instead\n"),
    min(min(multi_run - s->len, max) * num_data_in),
    frame_pos, sz + first_seg);
  div_u64_w(val, inb_p);
  return disassemble(info->pending_bh);

static void num_serial_settings(struct tty_struct *tty)
  if (tty == tty)
  return 0;

static void do_command(struct seq_file *m, void *v)
  int column = 32 << (cmd[2] & 0x80);
  if (state)
    cmd = (int)(int_state ^ (in_8(&ch->ch_flags) & Cmd) ? 2 : 1);
    seq = 1;
  for (i = 0; i < 16; i++) {
    if (k & (1 << 1))
      pipe = (in_use & UMXTHREAD_UNCCA) +
        ((count & 0x00000000fffffff8) & 0x000000f) << 8;
    if (count == 0)
      sub(pid, ppc_md.kexec_handle, 0x20000000);
    pipe_set_bytes(i, 0);
  /* Free our user pages pointer to place camera if all dash */
  subsystem_info = &of_changes[PAGE_SIZE];
  rek_controls(offset, idx, &soffset);
  /* Now we want to deliberately put it to device */
  control_check_polarity(&context, val, 0);
  for (i = 0; i < COUNTER; i++)
    seq_puts(s, "policy ");


AI generated code — including functions and function declarations — overnight. It had parameters, variables, loops, and correct indents. Brackets were opened and later closed. It even had comments.

However, the AI produced code had syntactic errors. It didn’t keep track of variable names.  Sometimes variables were declared but never used. Other times variables were used but not defined. The second function in the code example compares tty == tty.

The project is available on GitHub. It uses the Torch7 deep learning library. Here is the whole output file produced by Karpathy’s exercise.

Back to top

Will Generative AI Replace Software Engineers?

AI won’t replace programmers. But AI is already helping developers to write code. AI-powered coding assistants like ChatGPT, Github, CoPilot, and OpenAI Codex are accessible tools that help embedded developers write better code faster. AI code generators can now quickly generate high-quality code snippets, identify issues and defects, and suggest improvements to code snippets. 

Of course, it will take time before AI will be able to create actual, production-worthy code that spans more than a few lines.

Here’s how AI will impact software development in the near future.

AI Will Improve

It will become effective at automating tasks and helping developers understand their options. And it will then let the human decide how to optimize for circumstances beyond AI’s understanding.

AI Will Become a Coding Partner

Software developers will use AI as a coding pair to write better software. This is already happening today and will continue to rise in popularity as AI learns to write more than a few lines of code at a time. Developers will include AI pair programmer tools within their IDEs. Similar to human paired programming, the AI tool will perform coding tasks based on prompts, and then the developer will review the code. In the past, this process was more labor intensive, but AI tools can perform certain parts of their SDLC faster than a human developer, freeing the developer to focus on more complex tasks. 

But Programmers Will Remain Important

The true value of a programmer is not knowing how to build it. The value is in knowing what to build.

It will take even longer before AI learns how to interpret the business value of each feature and advise you what to develop first. There will always be a role for the human programmer.

Back to top

What If AI Writes Reliable Code?

That’s a big if. Most humans can’t write reliable code. And AI is just an application that analyzes vast amounts of human-written code. So, it’s unlikely that AI will write reliable code.

Most programmers agree. In a recent survey by CodeSignal, 1,000 developers worldwide were asked about their use of AI coding assistant tools. While 81% of developers said that they use AI-powered coding assistants, 55% of software engineers surveyed said that they had concerns about the quality of the AI-generated code. 

So, AI isn’t the answer to improving code quality.

Back to top

How to Improve Code Quality Today

You can improve code quality today. But it’s not by replacing programmers with AI.

Code quality improves with static code analysis.

Here’s how.

📕 Related Resource: Machine Learning Uses to Improve Static Analysis Results

Programmers write the code. A static code analyzer ensures the code complies with coding rules. It also scans code to identify potential errors and security vulnerabilities. And it finds bugs that are commonly missed in code reviews and software testing. This improves overall code and software quality.

One of the simplest ways to improve code quality is to use a static code analysis tool. Start your free trial today.

➡️ register for a free static analysis trial

Back to top