How I actually use ChatGPT as a software engineer

Jordan Edmunds, PhD
5 min readJun 26, 2023

--

It’s probably not what you think…

Image generated by Midjourney

When I first started playing around with this new-fangled tool that had set the internet on fire, I of course used it to write me some code. And the results have been impressive.

sudo make-me-a-sandwich

For example, I recently asked GPT-4 to “write me a python code snippet that would download a google doc, modify it, and re-upload it, along with the dependencies I would need to install to make that script run”.

It worked the first time it ran.

And not only did the code work, but GPT-4 also gave me instructions for how to set up the necessary accounts, projects, and permissions to enable the APIs and access I would need to get the script working.

It was awesome.

sudo refactor-my-sandwich

The code was good enough, but it wasn’t that clean, re-usable, or importable. I asked it to refactor the code to use the strategy pattern to also support local file modification in addition to google docs, and it did it for me. That code, essentially unmodified, has become part of an open-source project which I now use every day.

This has been amazing for prototyping. Anytime I need to do something new, I know what needs to be done, but I just don’t know how to do it, ChatGPT (and in particular GPT-4) has become my go-to.

But code generation isn’t what this article is about. After using GPT-4 at or near its usage caps for the last few months, using it to generate code is still only something I do occasionally.

Learning on Steroids

What I do use ChatGPT for — which absolutely dwarfs how often I use it to generate code is as a tutor and pair programmer to help me understand the systems that I am working with.

And it has felt like getting hulk juice injected straight into my cortex.

Networking and TCP/IP

I recently got a new job, and one thing I’ve had to learn a *lot* more about recently is networking. When I don’t understand something, I first turn to ChatGPT. I’ll illustrate what my workflow looks like with a very simple example. I wanted to learn a little more about DHCP, how it is set up, and how it worked. So I asked GPT-4:

Me: “What the purpose of DHCP?”
GPT-4: “The main purpose of DHCP (Dynamic Host Configuration Protocol) is to simplify the management of IP addresses on a network. Without DHCP, network administrators would need to manually assign and track IP addresses for each device on the network, which can be a challenging task, especially in large networks …”

Me: Ah, I get it, so it makes things easier. Manually keeping track of IP addresses does sound like a lot of work. But what is the alternative to DHCP? Why might we want to use something else?
GPT-4: “The alternative to using DHCP is to manually assign IP addresses to each device on the network, a process known as static IP addressing. With static IP addressing, a network administrator assigns a specific IP address to each device. Once assigned, the device uses the same IP address every time it connects to the network. This method provides consistent and predictable IP addresses for all devices….”

Me (to myself): Ahhh, now I REALLY get it. Without DHCP, we would have to manually assign IP addresses each time a device joined a network. That sounds like a lot of work, a real pain, and unnecessary most of the time. But sometimes we do want to manually assign IP addresses — for example if we have a server on our network.
Me (to ChatGPT): So if I wanted to actually assign a static IP address, how would I do that?
GPT-4: “A static IP address is typically set up on the device itself that you want to have the static IP. The exact process depends on the operating system of the device. Here are general steps for some common operating systems:…”

Learning is a 90/10 process. 90% of a topic can be learned pretty quickly, but the missing 10% can often be extremely difficult to find, and can prevent the successful use of a particular concept or tool.

Like a thorn in the mind, these 10% of questions can go unanswered for months or even years if you can’t get ahold of the right human to answer them for you.

Through a 1-minute conversation, I was able to get the first 90%, and in another 30 seconds, I got the remaining 10%.

Magic. Absolutely magic.

The power of ChatGPT is that it enables you to do something that no search engine or book ever has — ask specific questions about which you are lacking understanding, and get a specific answer about that confusion.

Gone are the days of slogging through tutorials just to find a specific piece of information, only to be disappointed that this article still doesn’t have what I’m searching for.

It’s a practically infinitely knowledgeable, patient, and detailed teacher.

I have used it to explain the output of shell commands, write me shell commands, explain those command flags and why I might want to use them, and so on. I’ve become like a toddler — incessantly asking it questions.

But what about hallucination?

But isn’t this dangerous? Using a large language model as a learning tool? What if it gives you information that is just plain wrong?

You know who else gives you information that is just plain wrong?

Other humans.

Search engines.

Random websites written by random bootcamp grads.

In my experience and testing, the output produced by GPT-4 is more accurate on average than even myself in regards to answerable, technical questions that I think I understand.

When I gave GPT-4 100 questions that I knew the answer to, not only did it give all the answers I was looking for, but it also gave me additional context I didn’t already know, and identified ambiguities in the questions themselves.

In my experience, GPT-4 is more reliable for specific technical questions than any other single source, and it has become an indispensable tool in my day-to-day workflow.

I seriously doubt large language models will ever produce error-free output (I have noticed several errors even when using GPT-4). But they are the best tool available for this job, and a huge improvement on the search engines of yesteryear.

--

--

Jordan Edmunds, PhD

Software Engineer who writes about #software, #diversity, #health, and random musings. Reformed academic, Berkeley EECS PhD. Autistic self-advocate. He/Him.