Are you referring to the concept of computers writing their own code? If so, then, in a limited sense, we are partially there. Programming is simply giving the computer a set of instructions to follow under different circumstances. AI research has done a lot of things related to computer learning. After it learns something, it modifies its behavior when it finds itself in identical circumstances. In other words, it chooses its own set of instructions.
If you are talking about writing the actual code, then, for simple things, we are already there. Tools exist that allow people to drag & drop objects on a screen that represents the programs 'logic'. The computer then generates code related to each object's purpose and position. That type of thing is usually limited in what it can do and can be very inefficient. However, it can work for things simple things or special types of programs that fit into a small niche.
However, if you are talking about writing complex software, then we are very far away. Machine learning only works when a program is set to run in a very specific set of parameters. Drag & Drop coding is very limited in its capabilities and features. Writing complex programs requires logic, but it requires a lot of creativity too. This is because some problems require developers to think outside the box. Computers can't do that.