As others state, the best way to think like a programmer is to program, but also seeking a senior programmer as a mentor helps. Also, browsing code on sites like StackOverflow and Github but you kind of need to develop a quick sense of good vs bad code. There is a lot of both on those sites.