Tuesday, December 20, 2022

Will AI replace me? - I doubt it

Many times in my career a new technology has come along or an older technology has gone away and people who use the older technology have worried about their future.
What I've always pointed out to those people is that (hopefully) their knowledge goes beyond knowing a specific technology or set of APIs.

An example.
A few months ago I was at a hackathon and came up with the idea of creating a DSL (Domain Specific Language) for creating types/classes.
You write something in English and it generates the C#, Python, or TypeScript.
We got the basics working at the event but it's still an ongoing side project.
On the second (final) day, someone saw what we were doing and wondered if AI could do the same thing.
We gave them a copy of the language spec we'd written (including samples) and they fed it into GPT3.
They could then give it new input and the result was surprisingly accurate. I'd say about 80% of what it produced was correct.
Having already hand-coded an implementation, had I wasted several hours? Perhaps.

But it was only 80% accurate. That's not good enough.

Rather than GPT3, what if we asked ChatGPT to write the code to implement the spec?
That might do better. Also, rather than producing a black box algorithm we'd have some code that I could manually adjust to improve the accuracy.
So would it replace me?

No.


If all I could do was write code to meet a spec, I might be worried, but I can do much more than that.


It couldn't come up with the original idea. I can.

It couldn't write the spec for what it should do. I can.

It couldn't test the accuracy of the output (including knowing if it was correct) and adjust it accordingly. I can.


Yes, there's an argument for not adjusting the generated code but instead providing more input examples to improve the accuracy of what is produced.
But, will that always be the best option? Time will tell, but I can see lots of scenarios where it's much quicker and simpler to manually tweak a generated algorithm rather than write significantly more input examples.

Side thought: Could I create a method signature and multiple test case, then have AI generate an implementation that makes all the tests pass? - It might be a simpler way to write a complex algorithm....?


I try and remember that my ultimate goal is rarely to write code but to provide value as a result of what I create.
If I can create more value by not writing code, or I can create value faster by not writing code then that's a good thing.

I do, however, enjoy the creative act of writing code. I don't think I'll be stopping any time soon. I'm told there's something special about my code: it's easy to read. (I was recently approached about doing some work for someone because they appreciated the readability of my code!)

I've not studied code generated by any AI sufficiently enough to say how readable it is, but I do know that the readability (and therefore understandability) of code is probably the most important thing. Yes, readability is probably even more than being functionaly correct.
Code is read a lot more than it's written. Code also needs to be changed (as bugs are fixed, requirements change, and features are added.) If generated code can't easily be understood, and changed it's just going to produce more problems in the long term.

If you can't read (& understand) the code, it's much harder to know if it is correct. Or change it when you need to.

How often have you encountered systems that were originally built quickly but end up having to be rewritten to add a feature as that's going to be easier/quicker/cheaper than modifying what already exists? I imagine it's more than you want or expect.

I write code so that I can quickly and easily see what it does. I don't want to have to try and remember all the nuances and finer points (I couldn't even if I trie.) Nor do I want to have to repeatedly look at external documents.
When AI can write the code I need in a way that's just as easy to understand, I'll use it.


Ultimately, AI is a tool. Knowing about different tools, how to use them, and what they're good for can improve productivity and the quality of what is produced. You just can't rely on a single tool.

0 comments:

Post a Comment

I get a lot of comment spam :( - moderation may take a while.