I think the idea that programmers will be replaced by software-writing AI programs is silly and unrealistic, but that isn't to say that programmer jobs are secure. What's really going on is that developer's tools are getting better.
Languages, debugging tools, version control systems and bug trackers are all rapidly reducing the number of developer-hours required to implement a given program, which we should expect to reduce the size of the programmer workforce eventually if we can't find new things for them to do.
It is possible that we will find enough new problems for programmers to solve to counteract increased productivity, but for many applications, most of the general problems that one would hire a programmer to do already have reasonable-quality solutions. I think we'll see smaller and smaller teams of hyper-productive developers working on a shrinking set of increasingly esoteric projects, or things with a single specialized use (like calculating taxes for that particular year).
Languages, debugging tools, version control systems and bug trackers are all rapidly reducing the number of developer-hours required to implement a given program, which we should expect to reduce the size of the programmer workforce eventually if we can't find new things for them to do.
It is possible that we will find enough new problems for programmers to solve to counteract increased productivity, but for many applications, most of the general problems that one would hire a programmer to do already have reasonable-quality solutions. I think we'll see smaller and smaller teams of hyper-productive developers working on a shrinking set of increasingly esoteric projects, or things with a single specialized use (like calculating taxes for that particular year).