Thanks to a well researched web article http://norvig.com/21-days.html to become a proficient programmer may take 10 years or more.
Even for those most proficient and talented need to prep before writing a single line of code. Specially when working in a team environment.
Maybe you watched a documentary about shapes and numbers in nature (http://www.imdb.com/title/tt2060305/)or another doc.
Preparing to code
Obviously programs are made to serve other people and coded by other people like you. A thought out diagram and thinking about what this program will do, not only helps your colleagues but the end users as well.
Let's say you were making a web application allowing a user to enter a number and print a hexagon.
At first maybe it's best to open a plain text document and type out a few hexagons using Asterisk (*).
Next you may decide to do a architectural diagram (e.g. program flow chart) such as this.
Finally after much trial and error you will have something very simple like this:Print hexagon on a html page.
Code needs hosting
Code on it's own is useless. Code needs to be hosted and interact with people it serves. This hexagon repo will need to be downloaded and index file opened on a browser by a user for this simple app to function.
This repo may also be served by a web server when a link is opened on a browser. Since code needs to be served, one needs to choose an applicable language to write code in. In this example the need was for web browser to interpret code directly.The above is an example of a methodical approach further explained in a publication by APRESS Software Engineering . Some individuals avoid this type of methodical approach by having lengthy text chat meetings.