Speed-running with The Chat

It's a rainy Sunday in Sydney.?I thought I'd see how me - ex programmer - can use Chat GPT to build some software.??

There's plenty of examples of these technologies generating dramatically different outcomes for writing software.?Writing software is finicky - most programming languages are terse subsets of English, with a few critically important verbs and some precise syntax.?Like a magic spell, one has to know the right sequence of phrases and steps for something to appear.??A misplaced comma, a minor spelling mistake or an illogical sequencing means the difference between a working program and a stubborn compiler failure: "Computer Says No".?

Tools have come a long way over the last few decades, but it's still a labour intensive exercise to turn a thought into an outcome.?We have the equivalent of spellchecker and grammar suggestions in code, linters that clean up common syntactic faults, and compilers that give more helpful explanations for failures.?But it's still complex.

So I thought - rainy day in Sydney, let's experience what it's like using ChatGPT. LLM solutions are supposed to be a giant leap for coding.?Let's see if it can help a rusty old ex-programmer.

I stopped writing code professionally around two decades ago.?I tinker every now and then - a Raspberry Pi project on the backburner, and every now and then I explore other concepts as a hobbyist.??I can write passable C#, Java, Python, and - rather embarrassingly these days - various VB derivatives.

?

But I've never coded in either C++, nor in Go.???


So, here's my challenge:?I want to write a program in a language I'm familiar with (C#), one I'm not (C++) with the help of Google, and one other (Go) but with ChatGPT.

The task is easy:?I have a file with all my credit card payments for the last 5 years.?I want to find the largest payment I've ever made to Woolworths.???The payment values though are expressed as negatives.

?The algorithm is pretty simple:

  • Open the payments file.?It's a comma-separated list, a CSV.
  • Read the lines in one by one.
  • Parse - split - the line into it's three values (Transaction Date, Amount, and Description)
  • Check if the Description contains the word "WOOLWORTHS"
  • If it does, take the Amount and Date, and remember it.
  • Go to the next payment record one and repeat the process.?If you find another one from WOOLWORTHS, and the amount is larger than the previous value, then save this transaction as the largest.
  • Once you get to the end, print out the amount, date and description of the largest transaction.

??

Part 1:?C#

Man, I am rusty.???It took me nearly 20 minutes to write this code - mostly because I haven't done this for years and there's dozens of different potential file-reading APIs, each with their own vagaries.??But, I got it done:?largest transaction was $621 in July 2020.

Not using Google or Stack Overflow - just my own memory and the tools in front of me.?


Part 2: C++,?with a little help from Google

OK, C++ looks pretty odd to start with.?The syntax has some weird conventions that threw me for a bit, and the naming consistency of the API is all over the place.??Took me quite a bit of tinkering but I got there in about 57 minutes and 51 seconds.

???

Part 3:?Go, with "The Chat"

As I said, I'd never written a line of Go, and I got the compiler working with a snippet of test code that I didn't write.?So not even a Hello World from me before starting.?

It took me a couple of minutes or so to write the prompt and wait for the output:

I'm writing a program in Go. I need to open a comma delimted file called "Payments.csv" that holds a list of payments. Each line in that file holds three values - a date, a transaction value, and a transaction description. The transaction values are negative values (the highest value payment is the largest negative number). The program needs to find the highest value payment made where the description contains the words "WOOLW"


3 minutes and 45 seconds later, I had the code generated, copy-pasted and run.?First attempt though choked on the first line of the Excel File as it had some column headings.?My bad.

That's great but the first record in the CSV file has some headings, which means the column for amount is not a numeric value. Can you you change the code to handle that?

?

5 minutes 40 seconds: I had a new code set generated and running. Unfortunately, there was a bug - the source file has the payment numbers in negative, so it found the smallest payment.??The error was obvious to me, but...it's not up to my GO skills!

The code is returning the smallest payment value, rather than the largest. Can you fix that error?

?

New version was done.?And it ran perfectly.??Total time was a shade over 9 minutes - and 80% of that time was waiting for The Chat to theatrically generate the response, and for me to copy-paste.


Now, I was pretty unhappy with my first time trial.??The Chat set the bar - now, I'm back in the zone, could I beat 9 minutes???I deleted my C# code and re-wrote it from scratch.???The logic streamed out of my brain, through my fingers and into the compiler with barely a mistake.???Compiled the second time (one typo).???End result: 9 minutes, 52 seconds.


Even when I knew the exact syntax, I couldn't beat The Chat.


And, given I got a do-over, I gave one to The Chat:

?Can you write that now in C#?


It's answer included instructions to install one additional helper library, but even including that step (which took several minutes), 3 minutes, 36 seconds.


Final score board

  • Rusty old C# coder, using recollection only:??19 minutes, 28 seconds.
  • C++ novice, using Google and Stack Overflow :??57 minutes, 51 seconds.
  • Go novice, using ChatGPT. 9 minutes, 21 seconds.
  • Round 2: C# coder, in the zone: 9 minutes, 52 seconds.
  • Round 2: ChatGPT, with a do-over prompt : 3 minutes, 36 seconds.

?

What does this mean?

Mostly this means....well, I had some fun on rainy Sunday.??And yes, the examples are contrived, and yes, there are many harder programming problems and more talented engineers than I.?

But the evidence has been growing for the last year that this technical breakthrough - the use of large language models - is going to be profound in the field of software development.???The potential for large language models to improve the hard challenge of converting human intent into machine code probably can't be overstated.??The innovations are appearing thick and fast and I think we're going to be seeing a dramatic increase in the efficiency, quality and....given how much I've learned in a few hours - accessibility of computer languages.

Does this mean we won't need coders anymore? Far from it - the fastest combination is going to the augmented model whereby an experienced coder uses the machine, but makes subtle tweaks. They might craft the best prompt, or stitch complex solutions together, or identified logical bugs between prompt and implementation. Throughput and efficiency is going to see a tremendous boost. Think of it as having a tireless assistant watching over your shoulder.

Mostly this means the process of crafting code gets way, way easier. For me it means - at the very least - an end to googling for complex nuanced ways to write what one needs for a specific problem. That alone is a tremendous leap forward and puts an end to a largely unsatisfying aspect of coding.

We would have had NetBank years before?

Simon Spencer (Actual)

CTO @ Trideca | Leadership, Growth, Product & Technology Strategy

1 年

I think we are on the way to seeing English become the No 1 software engineering language. Hybrid engineers will use both English and humanities skills along with more traditional software engineering skill sets to rapidly engineer and modify complex systems. Great postTim.

Varun Nayak

Accountant | Consultant | Delivering Data Driven Customer Success to Drive Rapid Business Growth

1 年

I could not agree anymore with this mentality. Chat GPT makes the process of learning programming significantly easier. In a solid weekend I managed to write up a simple Tax Calculator with a What-If scenario in python and load it online. If Chat GPT was not around, this process would no doubt have taken me a lot longer.

Roy D'Souza

Business Transformation Leader

1 年

Super interesting Tim. Looking forward to more rain in Sydney.

要查看或添加评论,请登录

Tim Hogarth的更多文章

  • Technology Optimism for 2022

    Technology Optimism for 2022

    As we return to the office, it can feel a bit like Groundhog Day with this (3rd? 4th? nth?) pandemic wave, weighing on…

    16 条评论
  • Tenacity

    Tenacity

    2020 has been exceptionally challenging; difficult for everyone, some far worse than others. Some of us know people…

    9 条评论
  • Get curious

    Get curious

    I was lucky enough to hear Bill Buxton talk some weeks ago. He’s a legend in the tech industry and I was pleased to…

    7 条评论
  • You can't be good at everything.

    You can't be good at everything.

    Just finished reading Frances Frei's book Uncommon Service. It's an older book, but I was lucky enough to see her talk…

    1 条评论
  • Women in technology & maybe how to fix the gap. It starts at home.

    Women in technology & maybe how to fix the gap. It starts at home.

    I entered the workforce at a time when many gender stereotypes had already started to change. I completed a business…

    24 条评论
  • Zone to Win: responding to disruption

    Zone to Win: responding to disruption

    I recently had the privilege of hearing Geoffrey Moore speak about the struggles incumbent organisations face in…

    2 条评论
  • Holoportation

    Holoportation

    There's always news tech stories in the media, but this one really caught my attention. Wired recently profiled…

    5 条评论

社区洞察

其他会员也浏览了