Can we replace junior developers with ChatGPT?
Tags: career, motivation, beginners, developer
Published: 2023-03-20 08:07:13

ChatGPT-4 got released this week and a whole host of improvements come with it. The word limit on ChatGPT has now increased from 3,000 words to 25,000 and it can now handle photos and videos.

I tried [ChatGPT out in January](https://www.alexhyett.com/newsletter/gpt-3-threaten-your-job/) and wasn’t overly impressed with the results. 

When I asked it to write Python code to scrape a website it failed to write code that ran the first time. After several attempts, I managed to get it to fix its own code but it still didn’t give the correct result.

## Can GPT-4 do any better?
This is the code that ChatGPT-4 generated for my web scraping example using the same input as before:

```python
import requests
from bs4 import BeautifulSoup

# Send a GET request to the URL
url = "https://books.toscrape.com/catalogue/category/books/self-help_23/index.html"
response = requests.get(url)

# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(response.content, 'html.parser')

# Find all the book titles and their ratings
book_titles = soup.find_all('h3')
book_ratings = soup.find_all('p', class_='star-rating')

# Store the book titles and ratings in a list of tuples
books = []
for i in range(len(book_titles)):
    title = book_titles[i].find('a')['title']
    rating = book_ratings[i]['class'][1]
    books.append((title, rating))

# Sort the list of books by rating (highest to lowest)
books.sort(key=lambda x: x[1], reverse=True)

# Print the top 5 Self Help books to read
print("Top 5 Self Help books to read:")
for i in range(5):
    print(f"{i+1}. {books[i][0]} (rating: {books[i][1]})")
```

This code threw an error the first time I ran it, however, this is because the URL that they are using no longer exists. After a quick check on the website, I found the Self Help URL has changed slightly:

```
https://books.toscrape.com/catalogue/category/books/self-help_41/index.html
```

After updating the URL and running the program I get the following output:

```
1. Overload: How to Unplug, Unwind, and Unleash Yourself from the Pressure of Stress (rating: Three)
2. You Are a Badass: How to Stop Doubting Your Greatness and Start Living an Awesome Life (rating: Three)
3. Online Marketing for Busy Authors: A Step-By-Step Guide (rating: One)
4. How to Be Miserable: 40 Strategies You Already Use (rating: One)
5. How to Stop Worrying and Start Living (rating: Five)
```

ChatGPT has clearly improved compared to its previous version however it has outlined a glaring issue.

The fact that ChatGPT got the URL wrong means it isn’t looking at the website in real-time. It only has knowledge of the data it was fed during the training period.

I asked ChatGPT “Does ChatGPT have access to the internet or is it using a cached copy of data?”

> ChatGPT does not have direct access to the internet. It was trained on a large dataset of text from the internet, but once the training is complete, it operates as a standalone model without access to new data. So, it's not using a cached copy of data either. Instead, it uses the knowledge it has acquired during training to generate responses to user inputs.

This isn’t too much of a surprise, you don’t really want an evolving AI to have access to the internet however it does limit its capabilities to past events. At some point however they may start feeding ChatGPT up-to-date information and I assume it is also learning all the time from people using it as well.

ChatGPT has shown that with the correct inputs, it is already very capable of producing working code. Although at the moment it doesn’t always adhere to best practices.

## Can ChatGPT replace junior developers?
Junior developers need to be told what to build, need their code reviewed by more senior developers and don’t always follow best practices.

When starting a new job, developers lack sufficient domain knowledge to be able to solve business problems but are more than capable of adding code to a project. 

ChatGPT is currently equivalent to a junior developer starting on a new project. Except it also has knowledge of a wide variety of programming languages and can recite documentation from memory.

I asked ChatGPT to create an AWS lambda function in C# for an Amazon Alexa skill. It was able to create the boilerplate code for me and it looks correct.

I then asked it to change the code so that it would call the ChatGPT API and it successfully updated the code to do that as well. 

It was missing some best practices such as exception handling and using blocks, although when prompted it managed to add them as well!

What is interesting though is that the code is completely rewritten every time. It doesn’t just add to the previous example and in some cases, the new version is missing things that the previous version had.

Just for fun I even got it to write the same code in JavaScript and Python which it managed with ease. Then I got it to write the Terraform code to add it to AWS!

If I was a junior developer I would be quite worried right now, you have just been replaced.

If this is where we are at version 4 it is scary to think what it is going to be like when ChatGPT is on version 10 or more.

Finally, I asked ChatGPT: “What is the future of software engineering going to be like if all of the junior software developers are replaced by ChatGPT?”

>  It is highly unlikely that all junior software developers would be replaced by ChatGPT, as there will always be a need for human expertise and creativity in software engineering. However, assuming that ChatGPT did replace a significant portion of junior software developers, the future of software engineering could look quite different.
> 
> One possibility is that the role of software engineers would shift from writing code to working more closely with AI language models like ChatGPT to design and test software systems. Software engineers could use AI to automate many aspects of software development, such as testing, debugging, and optimization, which could lead to faster development cycles and more efficient software systems.
> 
> Another possibility is that the increased use of AI in software engineering could lead to greater standardization and less variability in the software development process. This could result in more consistent and reliable software systems, but it could also limit the ability of developers to create unique and innovative solutions.
> 
> Overall, the future of software engineering is likely to involve a mix of human and AI expertise, with each bringing its own unique strengths and capabilities to the development process.

At least ChatGPT doesn’t think it is going to replace junior developers anytime soon. Although that’s what the robots want us to think. 

## What can you do as a junior developer?
If your main benefit to society is how well you can write code then I am afraid your days are numbered.

In a few more years it will be AI writing the majority of the code for our applications. With prompting, the AI was able to write code that adheres to best practices and I am sure in a few versions’ time it won’t even need prompting.

We used to laugh that a developer’s job was copying and pasting solutions (from StackOverflow) but it seems we are getting closer to that reality.

It doesn’t seem much of a stretch to have ChatGPT embedded into IDEs and generate whole projects from a written specification. 

It will then just be up to senior developers to code review the output and have ChatGPT fix the code in real-time based on the feedback.

If we acknowledge that senior developers are necessary to write specifications and review code, it follows that there must be a continuous supply of junior developers being trained to eventually become senior developers. However, the job is going to look very different to what junior developers are doing now.

As a junior developer, I suggest focusing less on writing better code and prioritising these aspects instead:
- Understanding best practices, such as exception handling and design patterns.
- Software architecture. Understand how large-scale systems are built.
- Domain Knowledge. Build up in-depth knowledge of how your industry works and what problems it faces.

The future of software development is going to be more focused on problem-solving and using AI to help, rather than writing code.

## ❤️ Picks of the Week

**📝 Article** - [The Most Powerful Decision Making Razors](https://www.sahilbloom.com/newsletter/the-most-powerful-decision-making-razors). You have probably heard of Occam's Razor, whereby the simplest explanation is usually the correct one. There are actually many different "razors" that can help make better decisions.

## 👨‍💻 Latest from me

I have been thinking a lot lately about the direction I want to take with my [YouTube channel](https://youtube.com/@alexhyettdev) and [writing](https://www.alexhyett.com). In this new AI-driven world, the role of junior developers is changing but the foundational knowledge of building good software doesn't. 

My goal for my channel going forward is to help junior developers gain the knowledge that is going to serve them well in their careers. So there are going to be more videos on me explaining complex engineering topics as well as advice for junior developers working their way up the career ladder. 

I believe that the nuances of individual programming languages is going to become less important over time. It is more important to understand what you are trying to build and how everything fits together rather than whether you write it in Python or Javascript.

**🎬 YouTube** - [Monolithic vs Microservice Architecture: Which Should You Use?](https://www.youtube.com/watch?v=NdeTGlZ__Do) On that note, my latest video is on monolithic vs microservice architecture and which one you should use for your next project.

## 💬 Quote of the Week

> It is much more important to work on the right thing than it is to work many hours. Most people waste most of their time on stuff that doesn’t matter.

From [How To Be Successful](https://blog.samaltman.com/how-to-be-successful) by Sam Altman. Resurfaced with [Readwise](https://readwise.io/i/alex3139).

---

This post is from my weekly newsletter [The Curious Engineer](https://www.alexhyett.com/newsletter/) where I share my insights as an engineer turned entrepreneur and the lessons I am learning along the way.