Will AI Replace Programmers? The Future of Coding in the Age of AI
Are Programming Jobs a thing of the past? Is there Value in knowing how to code anymore?
Is the rise of AI signalling the end of programming as a skill and a job? There has been significant discussion in the media about how AI might replace programming jobs, with some experts predicting that it will become a thing of the past. The lay-offs occurring across the board in the tech industry (with some being attributed to AI) has added to these concerns. Tech has been a lucrative industry for the past few decades, and many people have even switched careers from being a lawyer or doctor to a full-time coder. But does it make sense anymore? Should someone invest time to learn coding?
This article will explore the capabilities of AI in programming, its limitations, and why it's unlikely to replace programmers entirely.
Thanks for reading Confessions of a Code Addict! Subscribe for free to receive new posts and support my work.
The Rising Capabilities of AI in Programming
Let us first explore the areas where AI is currently excelling in programming tasks.
Generating Repetitive Code
AI excels at generating boilerplate code and code that is repetitive in nature, such as iterating through a list of items or serializing/deserializing JSON data. Most programmers spend half of their time copy-pasting code from places like StackOverflow. AI can do this very well because it has been trained on vast amounts of data from the internet, effectively "memorizing" many code patterns.
Generating Documentation and Comments
AI can also help write documentation for code. It can analyze your code and generate documentation for each method, along with example code on how to use it.
Generating Test Cases and Test Data
Similar to documentation, AI can assist with writing test cases for your code. If testing your code requires generating test data, AI can deduce the format of the data and generate it accordingly.
Suggesting Improvements to Code
You can also ask AI if there are any improvements that can be made to your code, and it might suggest ways to optimize performance or readability.
AI's ability to help explain code line by line is phenomenal. When working with an unfamiliar codebase, this feature is incredibly handy.
Data Analysis and SQL Query Generation
AI models are adept at understanding data. If you provide a dataset, AI can analyze its structure and, based on the columns, understand the kind of data it represents. You can ask AI various questions about the data and request different analyses. AI can even generate code for you to run and visualize the data.
If you provide AI with your database schema, it can help you generate SQL queries for various tasks, such as data analysis or report generation.
AI in Action
Challenges and Limitations of AI in Programming
AI models work by processing a task, such as rewriting a piece of code, and producing new code as output. Three components are involved: your instruction in natural language, the accompanying piece of code you want it to rewrite, and the model’s output. These three elements form the model’s context window, which allows a limited number of tokens (a token is equivalent to one word, but sometimes one word might result in multiple tokens). This means that these models can process a limited amount of information.
The GPT-3.5 model has a context window size of 4,000 tokens (around 3,125 words), and the GPT-4 model has two variations: one with a limit of 8,000 tokens and a larger version with a size of 32,000 tokens (which is around 25,000 words).
This limitation presents a challenge for AI in working with large code bases. Almost all the capabilities listed above are possible in relatively small pieces of code. For example, if you have a single file of 2,000 lines of code, assuming 5 tokens per line on average, you have a total of 10,000 tokens. This already exceeds the limits of the GPT-4 8k model. If you have a couple more files like this, even the GPT-4 32k model will not be able to handle that codebase.1
What AI Cannot Replace
AI is undoubtedly capable of handling some low-level tasks, and it will continue to improve over time. However, real-world software engineering is much more complex than these tasks. Engineers deal with various challenges on a day-to-day basis, such as:
Understanding the organization and abstraction of complex codebases with hundreds to thousands of files and millions of lines of code.
Innovating and coming up with novel solutions to unseen problems, which requires a deep understanding of data structures and algorithms, and ability to extrapolate that knowledge to solve unseen problems.
Collaborating with others to understand business requirements and designing scalable solutions with maintainability and extensibility in mind.
Working on mission-critical projects like the Linux kernel, web browsers, compilers, graphics engines, game engines, databases, and security software, which require specialized skill sets and years of experience. These software are so critical that a small bug can cause massive damage, imagine a file system bug causing loss or corruption of data. These cannot be left to AI.
Conclusion and Final Thoughts
While AI is undeniably powerful and rapidly improving, it is unlikely to replace programmers entirely. Instead, AI will likely complement programmers' work, helping them become more productive and allowing them to focus on more challenging and creative tasks. High-value and creative jobs will still be in demand, and AI may even drive the growth of coding jobs in the market rather than eliminate them.
The history of programming has seen a continuous evolution of abstraction layers, allowing programmers to solve ever more complex problems. In the early days of programming, people used punch cards to write code. Later, assembly language allowed programmers to work at a higher level, leading to the creation of compilers for even higher-level languages such as COBOL and C. This trend of increasing abstraction has continued through the years, and AI is poised to be the next layer of abstraction, enabling programmers to tackle even bigger and more complex challenges.
So, to answer the question raised at the beginning of this article: no, AI is not going to kill the programming industry. It will empower programmers to tackle more complex challenges and help take humanity to the next level. Now is the best time to be in this industry.
Share your thoughts on the impact of AI on programming in the comments below, and don't forget to subscribe for more insights and tips on coding and technology.
There are ways to work around this limitation. For instance, you could use a vector database to store embeddings of the code and only use relevant parts of the code. But that will not be very effective for complex projects.