Can ChatGPT Replace Developers?

This post is arriving a bit late, as I've had it in mind for several weeks now, basically since ChatGPT hit the market. 

 

In this post, we’re going to look at what ChatGPT is and whether, as many predict, it could take developers’ jobs. 

 

 

1 - What is ChatGPT?

ChatGPT is a language model developed by OpenAI. It’s a “Transformer” type language model trained on a huge amount of text so it can generate coherent and natural responses in a variety of contexts. It’s commonly used for natural language processing tasks, like text generation, machine translation, and question answering.

 

1.1 - What is ChatGPT used for?

ChatGPT is mainly used for natural language processing tasks, such as text generation, machine translation, and question answering. Some examples of how you can use ChatGPT include:

  • Automatic generation of coherent and natural responses in a conversation: ChatGPT can generate coherent and natural responses in a conversation, making it useful for applications such as chatbots and virtual assistants.
  • Content generation: ChatGPT can automatically generate text in a variety of styles and subjects, which makes it useful for applications like news generation, fiction writing, and creating product descriptions.
  • Question processing: ChatGPT can answer questions in a coherent and natural way, making it useful for search engines and virtual assistants.
  • Machine translation: ChatGPT can be trained to automatically translate text from one language to another.

 

Both of these answers came from ChatGPT itself; I just copied and pasted them. 

 

Now in my own words: ChatGPT is an AI you ask questions and it gives you answers that could easily pass as human. 

The answers are pretty coherent, and if you don't ask for anything outlandish, they're usually correct. Although sometimes it can be a bit long-winded or say the same thing in three different paragraphs (like for the question “what is ChatGPT used for?”). 

 

By the way, the current version is ChatGPT3, rumor has it that ChatGPT4 is a thousand times more powerful.

chatgpt 3 vs chatgpt4

Before we continue, keep in mind that ChatGPT3 was trained on a dataset from 2021, which means it doesn’t know anything that happened after that point.

For example, you can ask it who won the 2010 football world cup, but not the 2022 cup:

chatgpt on world cup

 

2 - Can ChatGPT replace developers?

The main reason for this post is to see if this AI, ChatGPT, is capable of taking our jobs. 

 

To do this, let’s set up a scenario. Imagine we’re a car repair shop specializing in car tires. We change them, calibrate them, etc., but if someone crashes and wrecks their car, ours isn’t the shop you go to. 

 

Now, let’s say you have a friend who also owns a shop. Because you’re friends, he decides to buy tires from you. Both your shop and his use an order management CRM, but this CRM can’t check each other’s data, so you decide to ask your nephew to create something to let his shop connect and check in real time whether you have tires of a certain size in stock. 

  • As you can see, this is a pretty simple example, but even something this simple, in terms of development, would cost thousands of euros if you hired a consulting company to do it. Deploying it online could easily cost 5 to 10 thousand euros, which is unthinkable for a small business owner. 

 

2.1 - Implementing the ChatGPT solution in C#

This blog is focused on C#, so let’s assume the nephew is starting to study C# or is a junior developer who knows C#. 

 

Obviously, you can't just tell ChatGPT to directly create a C# application that does all that, at least not in one go. For example, if we ask it to make a C# API for us, it gives us the following:

using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;

[Route("api/[controller]")]
public class InventoryController : Controller
{
    private readonly InventoryContext _context;

    public InventoryController(InventoryContext context)
    {
        _context = context;
    }

    [HttpGet("{id}")]
    public ActionResult<int> GetAvailable(int id)
    {
        var inventory = _context.Inventories.Find(id);
        if (inventory == null)
        {
            return NotFound();
        }
        return inventory.Available;
    }
}

And although this code works, you need to know what context and dependency injection are, which is not something someone just starting out would know. 

What you can do, if you have technical knowledge, is ask it for specific things. For example:

"can you create an endpoint on a C# web API controller called WheelsController that Queries a mysql database table called inventory that contains a column called available and the relation between inventory and product is done by the product.id column in the product table.

the endpoint should be called available and receive a parameter called wheeld which references to the product ID, and the return will be an int which is the available column."

And here’s what it gives us:

using System.Linq;
using Microsoft.AspNetCore.Mvc;
using MySql.Data.MySqlClient;

[Route("api/[controller]")]
[ApiController]
public class WheelsController : ControllerBase
{
    private readonly string _connectionString = "Server=localhost;Database=mydb;Uid=user;Pwd=password;";

    [HttpGet("available/{wheeld}")]
    public ActionResult<int> GetAvailability(int wheeld)
    {
        using (var connection = new MySqlConnection(_connectionString))
        {
            connection.Open();
            var query = $"SELECT available FROM inventory WHERE product_id = {wheeld}";
            using (var command = new MySqlCommand(query, connection))
            {
                var reader = command.ExecuteReader();
                if (reader.Read())
                {
                    return reader.GetInt32(0);
                }
                else
                {
                    return NotFound();
                }
            }
        }
    }
}

As you can see, this gives us a working solution that is good for our current use case. 

 

But of course, once you’re a bit more experienced as a programmer, you start seeing the flaws, like the database connection being in the controller itself, or how the query is written.

 

So, let's now ask it to use Entity Framework instead:

using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

[Route("api/[controller]")]
[ApiController]
public class WheelsController : ControllerBase
{
    private readonly MyDbContext _context;

    public WheelsController(MyDbContext context)
    {
        _context = context;
    }

    [HttpGet("available/{wheeld}")]
    public ActionResult<int> GetAvailability(int wheeld)
    {
        var inventory = _context.Inventories
            .Where(i => i.ProductId == wheeld)
            .FirstOrDefault();

        if (inventory != null)
        {
            return inventory.Available;
        }
        else
        {
            return NotFound();
        }
    }
}

The code comes with an explanation of which libraries to install and that you have to configure the DbContext.

 

The code is almost there, good enough for a simple use case, but not for a more enterprise-grade application (well, technically it could be). But let's make it better and now ask it to modify the code to use the repository pattern.

 

Here’s the result, which is quite surprising. First, the controller code:

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

[Route("api/[controller]")]
[ApiController]
public class WheelsController : ControllerBase
{
    private readonly IInventoryRepository _inventoryRepository;

    public WheelsController(IInventoryRepository inventoryRepository)
    {
        _inventoryRepository = inventoryRepository;
    }

    [HttpGet("available/{wheeld}")]
    public ActionResult<int> GetAvailability(int wheeld)
    {
        var inventory = _inventoryRepository.GetByProductId(wheeld);

        if (inventory != null)
        {
            return inventory.Available;
        }
        else
        {
            return NotFound();
        }
    }
}

Then, the interface:

public interface IInventoryRepository
{
    Inventory GetByProductId(int productId);
}

The repository implementation using EF:

public class InventoryRepository : IInventoryRepository
{
    private readonly MyDbContext _context;

    public InventoryRepository(MyDbContext context)
    {
        _context = context;
    }

    public Inventory GetByProductId(int productId)
    {
        return _context.Inventories
            .Where(i => i.ProductId == productId)
            .FirstOrDefault();
    }
}

 

Finally, ChatGPT’s answer ends with an explanation of the benefits of separation of responsibility and, of course, a reminder not to forget to add the interface and implementation to the dependency container using dependency injection

services.AddScoped<IInventoryRepository, InventoryRepository>();

As you can see, ChatGPT works better if you ask for small things one at a time, but as we’ve seen, it works doing everything at once too.

 

2.2 - ChatGPT in other languages

First off, ChatGPT is trained in English, but it “speaks” any language, so you can ask it in Spanish, and it knows any programming language too; 

 

For example, here’s the first use case we saw but in Ruby:

require 'sinatra'
require 'sequel'

DB = Sequel.connect('sqlite://db/inventory.db')

get '/api/inventory/:id' do
  inventory = DB[:inventories].where(id: params[:id]).first
  if inventory.nil?
    status 404
    return 'Inventory not found'
  end
  inventory[:available].to_s
end

 

 

3 - My opinion about ChatGPT

For me, ChatGPT is another tool to work with day to day. In this very post, we’ve seen how it can make life so much easier, but not everything it says is true, and this is where you have to be careful. 

When it comes to programming, most of what it provides is good, let’s say 80% of the content is correct, but there’s still about 20% that you, the developer, need to spot and fix yourself.

 

If you explain things to the AI, it “realizes” and changes them, but it won’t do this on its own. As we saw in the example, its abilities are still pretty limited. It only sees and does what’s in front of it, and it’s not able to think on a bigger scale or about the future.

 

And regarding the question I raised earlier about whether AI can take our jobs: the answer is no. AI is going to make our lives easier, that’s all, for now at least.

 

Of course, its power isn’t just limited to code, I can ask it to create posts with pros and cons on complex topics, which I can use for both the website and YouTube. But that 20% that isn’t accurate requires a human’s knowledge to do things right.

 

That said, seeing its power makes you want to stop writing posts and investing time, because in the not-so-distant future, we might ask ChatGPT instead of a search engine for information, which is fine. But don’t forget that ChatGPT was trained on information from blogs like this one, and if we stop writing, ChatGPT won’t have material to train on and its quality will drop, a bit of a vicious cycle. 

 

 

By the way, this kind of technology isn’t currently being used for malicious purposes, but nothing prevents it, nothing will stop all those phishing emails we get from being written by an AI that can chat with us until it convinces us to give up our money. So, be careful.

 

Finally, there are rumors that the final version of ChatGPT might cost up to $42 per month. It’s expensive, but probably something we should all pay for. 

 

This post was translated from Spanish. You can see the original one here.
If there is any problem you can add a comment bellow or contact me in the website's contact form

Uso del bloqueador de anuncios adblock

Hola!

Primero de todo bienvenido a la web de NetMentor donde podrás aprender programación en C# y .NET desde un nivel de principiante hasta más avanzado.


Yo entiendo que utilices un bloqueador de anuncios como AdBlock, Ublock o el propio navegador Brave. Pero te tengo que pedir por favor que desactives el bloqueador para esta web.


Intento personalmente no poner mucha publicidad, la justa para pagar el servidor y por supuesto que no sea intrusiva; Si pese a ello piensas que es intrusiva siempre me puedes escribir por privado o por Twitter a @NetMentorTW.


Si ya lo has desactivado, por favor recarga la página.


Un saludo y muchas gracias por tu colaboración

© copyright 2025 NetMentor | Todos los derechos reservados | RSS Feed

Buy me a coffee Invitame a un café