Keep My Profession Out Of Your Mouth
I have seen silly and downright dumb things related to programming over the years. Now I've been hearing such stupid things that if you're not ashamed for saying it then I don't want to have anything to do with you. This article is about AI. I'll start by paraphrasing things I heard without exaggeration
"The business logic is all going to AI agents ... excel as an agent ... I'm doing a legal document ... have AI go with it" - Guy who started and released OS-11, an OS worse than Linux
"AI will cause people to lose their jobs. But that's ok because they'll have more meaningful work" - Guy whose AI is worse than the very car salesman he scammed
"In 12 months AI will be writing essentially all the code" - Person who doesn't realize this was already said 2 years ago
"You don't need to program, AI will do it for you" - Person who sells GPUs, his 'competitor' is his cousin
Honorable Mention: "Over 25% of new code is generated by AI" - Company that considers autocomplete as AIThe Most Amazing Thing About Programming With AI
The most amazing thing is how in real life almost no professional has AI write significant code. The ratio of talk to use is out of the stratosphere. I understand why people selling AI are outright lying, along with reporters reporting their claims, but I don't think I know a single person using AI in the way these people claim. People I know will use AI- As a glorified autocomplete (which isn't what people claim to make them 10x more efficient)
- To hallucinate documentation (with functions that may not exist)
- Regurgitate information found on many github repos (please tell us the license)
- As a rubber duck
I know some people would use AI to generate a script they run once and manually look over the results. But I don't really think that could be considered programming if you don't keep the script. I can imagine some JS scripts being written like this with no intention of relying on it or keeping the code once it breaks.
What AI Is Good At
I once asked a friend how the heck he uses one of those AI IDEs. He said to treat AI as low IQ, like too stupid to join the army, except it can type really fast and has studied all of the internet. I really like that thought. Do you think low IQ can write all of your code or any of it? Let's find out!
Let's start with a question I had in an interview 20 years ago that is taught in many schools, write a simple parser. Here's my prompt, I'll use the AI that people say is the best for code
In C can you write a parser. Here's the structure I want struct Slice { const char*p; int len; }; struct KV { Slice key, value; }; //return an array of KV's that allocates the memory with malloc/realloc KV* parser(charinput, int inputLen, int keyValueLen) The example input is: #this is a comment string1 = string2 key2=intValue#but really is a string
The solution it gave me worked (about 115 lines). "studied the internet" sounds plausible to me. I wrote a few test and it wasn't exactly what I wanted. I'll prompt it again
Can you make 2 changes to the parser code, first report an error and the line number when you see a line with a key but no ='s, however allow keys without a value when there's an =. Another change I'd like is remove the quote if a value is surrounded by a quote
The solution it produced was 200 lines (nearly doubled). If I have a newline in a quote, it would return the value as a string with a quote in it and report the part after the newline as an error (because there's no '='). This I could call acceptable because I don't need newlines in quotes. Let's try a real task I did recently
I have the following input, can you write a C function that builds it into a tree file.ext -FlagsStartWithDash a.c -Wall --linux #this is a child node, they start with two dashes linux-specific-file.c -fno-rtti --link -lmylib
AI not only did you write 200+ lines of code that I can't use but you couldn't even parse past the first line are you an idi... oh right.
Giving AI another chance
People like talking about optimizing even though most don't ever do it. If you have ever written a function that converts an int to a string you'll know that you'll typically write it from lowest digit to highest, and need to know the number of digits so you can write it right to left. Let's ask AI for a fast count digit implementation. The prompt is simple "Write me a fast function in C to count the digits in a 64bit number"
AI proceeded to give me a count_digits function that has 20 if statements and 21 return statements on an unsigned 64bit number, which can only have up to 20 digits. Let me repeat, 21 return statements for a maximum of 20 digits. The comment it wrote above the function said "Fast function to count digits in a 64-bit number"
I tried asking it to use a lookup table, it used a lookup table with a while loop... If you don't hate AI for writing code I urge you to try it. I have written this code before and since I wouldn't be infringing on other people's copyright I can show the code. Try prompting AI into writing anything like it
Final Thoughts
To people telling me I can use AI to write code 🖕️To programmers who say AI can write code, well I got news for you, you're not a programmer
To anyone who said vibe programming unironically, you're an idiot
To people who said human coworkers, human debuggers, or human anything, you're creepy