It’s difficult to explain how to become a talented programmer.
Sure it helps to know some logic design, some common tricks and structures, and the theory behind what works well and why. Ultimately though, the ability to write elegant code, without making mistakes stems from the ability to write code for a non-production environment until you’ve made all the mistakes you can make.
For people who love coding, this is a non-issue really. We code in our sleep; we dream of data structures and clean algorithms. If you don’t code in your sleep, it can help to get some practice. That’s where Code Kata comes in. Practice KataOne in as many languages as you like, until you find the best and fastest way of solving the problem. Some tricks may reveal themselves that you haven’t yet thought of.
As you progress, try more advanced code and share your techniques. Without these, it could be possible to write only a few hundred lines of code before putting something to use into the real world. Why not use these and make it a few thousand? We can all use some practice now and then!