The basics of learning programming, from when I learned way way back, for me is first learning the constructs of data types, logic structures and syntax. Just like learning any language you need to understand those basic concepts. Next is learning how to hand-write the pseudo-code (human readable) of the action you are trying to perform. Doing this first gives you the skeleton of logic of the actual code. It helps to formulate the algorithm (pattern) of actions you need to take. It also helps you play computer and see quickly any mistakes/missteps you may be making before you get into the IDE/Compiler and start cranking out real code. This is an old trick/method that still has application today.
Also, you can Google code samples for your language and see how it has been done. This will help you to learn how the code is constructed.
]]>