AI can indeed write code.
AI can copy other people snippets of code and paste them together with some tweaking. AI is not capable of original creative thought. It can regurgitate some blended together chunks of other humans code and try and duct tape it together.
It sometimes works if the domain and question is very narrow or an extremely common task. It is very often wrong. Sometimes is subtle ways that debugging the broken code might take longer than having just written it yourself. But it will confidently serve up garbage and pretend it is sure this is the answer.
Either way, you can't just blindly trust it, so you end up carefully analyzing it line by line and test and trying to figure out what it screwed up. That can be very time consuming and harder because that is not your code so you it's not always clear what the intent was. If he copied code off the web from someone who didn't know what they were doing, that gets thrown it too.
I use it to just throw out a first guess. At least shows me snippets of possibility and what objects and functions and modules might be involved. I then have to manually research and learn about those to the point that I understand it, then go back write my own code completely separately that I know is correct.
It's a slight more advanced Google search at the moment, but not a software engineer. If he finds code on the net from a junior programmer who unwisely uses a bubble sort where he shouldn't, AI will happily slap that code in not realizing that is very poor practice and will lead to scalability issues down the road.
AI currently is like hiring a really bad Bangladeshi outsourced coder who just complete a 6 week coding camp and was rickshaw driver before that. So sure. Just take his code and paste it into the Space Shuttle software. It'll be fine.
I would never use AI code directly. I use it to give me a list of concepts and keywords to go research, learn, and then write my own code.
On very common, simple, straightforward stuff where all the snippets on the web are probably correct, it can be a useful tool to augment the productivity of a skilled, experienced engineer, but the code will have to be written, or debugged and rewritten by someone who has figured it out anyway.
Glad I'm retiring. In my experience one bad coder can cause more problems, that are more expensive to clean up than they you save on not hiring a better coder to start with. But it will take management a decade to figure that out. They just think they are going to save a ton of money on live software engineers. And it is completely derivative. It can only massage code others have written for the most part. It has no creativity and can not innovate something clever and new and ground breaking.
But like script-kiddie web development laying stuff out on web pages and pulling data in from a db call? Sure. A lot of those jobs will get replaced by AI fairly successfully.