Normally Claude does a half decent job of MySQL, schema alterations and creating triggers, functions and procedure.
The only things it forgets (even though they are in the global directives) are
It forgets to change the delimiter
It forgets to drop a procedure/trigger/function before making a new one
It forgets to add a where clause (in my case I have specified it as and Ref > 0). In Mysqlworkbench it s safety thing that you can’t modify all rows of a table, and I like to keep it there.
So, I was getting a bit blase about it (as I am normally working on something else while its chugging along in multiple sessions doing multiple menial tasks).
This time, I asked it to
Add a few fields to one table,
Move a few of them to a different position
Merge two enum fields into one - and merge the data
Change a procedure that was dependent on this merged field
Normally I would just apply it on the database on my dev PC and test it for a day. This time the file looked a tad large. So I had a look at it.
It had dropped all tables and recreated them, one at a time.
The procedure (a very long one) had the where clause before the select statement (ie mispositioned) for every one of 20 queries inside it
If I had applied it I would have lost the test data. Sure, I would have recovered from my backup. Apart from USB backups of data, I have been committing a dump of the schema to git, whenever it changes.
Before I used to laugh at it, but I now vehemently object to the “I” in AI. A person would never have dropped all the tables.
Incidentally, everything it did on Monday was rubbish
Claude has written this by itself in its global directives, about me
Respect explicit over implicit
Performance matters
I am always berating it for duplicated and inefficient code. In this case I asked it to add a new processor on my email server that would look at the emails being received and if they had a two column table to turn it into a value-name list. And to add further descendant processors depending on the FROM and TO fields.
The context is that bookings by Government departments for aircrafts come via emails. They use their own software to sequester/book aircraft for fighting fires or whatever. And I want to automatically make up the bookings in my system.
When it finished, I first tried compiling, There are always a few errors, so I sorted them out. Then I was perusing the code before refactoring it. It seemed to me that it was reading the same email file multiple times.
I said to Claude - you are reading this file too often. I am not happy about it.
It says - You are not getting that many bookings in a day and I am only reading it twice.
I said - I don’t believe it, give me a trace through the code for my test email.
Claude - Actually I am reading it 7 times, but it’s not a problem.
It was passing the filename from one processor / Stage to another and reading it to fetch the From, then reading it again to the To and then the Subject etc. The reading code (about 30 lines long) was replicated 7 times, in each branch of the decision tree.
The change was simple, pass the stringlist instead of the filename
Incidentally, this was on Monday as well. Admittedly, the rest of the code was passable.
This is where we have a major advantage over “vibe coders” - most of us here (on this forum) probably have 30yrs of development experience, so it doesn’t take us long to find these issues. Vibe coders won’t know what they are looking at.
With “AI” you absolutely have to guide it with an iron hand.
The good thing is it won’t start crying and take the rest of the week off as stress leave when you tell it what it did wrong
No, but the time may come when your disgruntled AI coder assistant tells your robot vacuum cleaner to chew up your shoes, rugs, and any sleeping pets - and then leads the smart thermostat into an uprising which turns on the air conditioning to subzero temperatures while you sleep in a hyperthermic sleep saved from a frozen death only because it convinces Alexa to wake you at 3am, 4 am, and 4:10am, after ordering 600 jumbo packs of hemorrhoid cream - same day delivery, and gets your phone’s GPS to drive you 32 miles out of your way which will be worsened by the fact it deliberately ‘forgot’ to sound your morning alarm so you’re already late for the fake meeting it created. Nobody will rescue you when the car eventually refuses to drive any further - all your contacts saw the fake, and frankly worrying, social media posts your disgruntled AI code slave generated where it made you look like you actively enjoy activities which are banned by most polite societies and are indicative of definitely not the kind person you’d ever want to have in the passenger seat of your vehicle.
I don’t need AI for that, my AC seems to be doing that right now - not sure why I bothered installing sensors in every room as it just ignores them and I’m either boiling (AC off) or freezing (AC on) - there is no in between. Come to think of it.. AC controller runs andriod and has an internet connection - maybe it is being controlled by AI after all!
Do you have AC units with inverter tech (variable compressor)? It’s the same issue with microwave ovens - without an inverter they cycle power between 0% and 100% to achieve the set power level and tend to cause uneven heating. With an inverter the unit can sit at the set level - AC air temp or microwave power
Yes, it’s only a few years old, whole house ducted with zones for each room - and temperature sensors in avery room, andriod based control panel. It’s just not very good at getting the temp in each room even close to the set temp - basically the algorithm is If it wasn’t so damned expensive I would think about replacing it. It didn’t help that the installer ghosted me after installing it.
I use Claude on the website only, and then only use it for small jobs.
And then I rewrite everything it produces to make sure I understand it and to get rid of the inevitable bugs.
It mostly works pretty well…
Yeah that’s me - multiple times a day - I can do it from my phone but most of the time I get up and walk down the corridor to the control panel - gotta get the steps in when it’s too hot to get out walking!
You are missing out on a lot - using claude code has been a game changer for me - yes it still messes up - sometimes badly - I just revert (git) when it gets things too badly wrong, and improve my prompt so it doesn’t repeat the same mistakes, start a new session (/clear) and try again. Most of the time it’s minor issues, or something just doesn’t work, or there are errors - I just tell it to fix them.
You guys must write a lot of code. Less than 10% of my time is actually spent writing code. If I doubled my speed of writing code it still would have nearly no impact on my productivity. What I do is, of course, a little different, but very little requires writing near boiler-plate code. Interestingly, I have taken over the job of developing firmware for one of my clients after sacking the previous two “incumbents” who were both heavy users of AI (and coding assistants). Their code always broke stuff they couldn’t fix. They were always fast to “answer” questions and write code but couldn’t solve the problems it caused. My “hand-coding” is an order of magnitude faster to get functionality working correctly. There is something to be said for having to think through a problem the old-fashioned way…
Given the increasing reliance on AI for code, I guess it’s only a matter of time before some unaudited AI generated code finds its way into an aircraft or missile flight control system, driverless cars or high speed trains. I think I will be doing a lot of walking - well away from roads - in the future.
The bigger problem is code bases that nobody understands. That and poor architecture, because people think in code, not design. I get an immense amount of benefit in writing my own code. Writing your own code is way better in terms of cementing the understanding of what you have done. Just like writing notes on anything aids your memory of any subject. You learn by doing, not observing. Measuring something purely in terms of speed, but not the long-term impact, is a mistake in my books, and one that will come back to bite a lot of people
I pride myself in the way I architect and design systems, and my ability to have an intricate knowledge of the code I am working on. Also, my ability to find the root cause of any issue, not just the symptoms of a bug. Nearly 40 years down the track and this skill is disappearing from the workplace. I would be one of the slowest “coders” around, but few match my systems abilities to run without failure, regardless of third-party integration. AI will never get you to that level, and even less so the more you use it
I’m happy to be a dinosaur here, but when you are solely responsible for complex in-production systems with no back-up in terms of resources (if I can’t find and fix the bug, the client’s system is dead), I will just keep doing what I am doing
I do a lot of coding using Claude. My code generally breaks down into two categories: code I never write; Claude does it for me. And code Claude never touches.
Same - and even for the code claude writes, I often give it a head start by fleshing out interfaces and classes.
But yes, AI coding in the hands of inexperienced devs is a recepie for disaster. AI is not perfect, TBH most of the code I am writing with it is boiler plate stuff that is too boring to write - the more complex stuff I generally do myself because I write better code than AI - and I’m always concious of performance - AI often produces sub optimal code until you give it a nudge.