I can relate to your position. Even after spending a considerable amount of time in coding, I still don't understand few things in code.
First of all, it is perfectly normal not to understand a few things, it is human. Two, read implement repeat usually works for majority of the complex things.
Keep coding!! Fire away more questions if needed :)
cool ting about coding coding is the very early stage of innovation, test and target and.. repeat :)
if you ask me a good trick is always to start with the design before droping any lines, yes i know i can sound very boring but having in your mind what you are expecting is the first step to a very good coding experience.
hope this helps you out
I believe you are not alone in this, coding itself can be straight forward but the logic within it is tricky and required huge amount of effort and time to figure it out.
My recommend is try to utilize Google on the question you have. There are many people asking the same questions in different forum through internet, you may leverage those questions and answers and this will help you to save a lot of time instead of trying it by yourself.
Besides, sometimes we couldn't understand things because we are lack of the fundamental knowledge. I would suggest you to take a step back to revise what have been missed. With a strong base, you can understand things better, include the solution provided.
Coding is quite difficult but being consistent and sticking with it, you can ultimately power through everything. I think the most difficult aspects of coding are in being able to first understand what you want the code to do and breaking things down from there. For me whenever I am coding something I always first hand write out what it is that I want the code to do and that helps me break down the code as a whole. I think a lot of times its easy to get stuck when trying to think about a code operation as a whole so by breaking each operation down into segments, getting it to work and then beginning to clean up the code is the best process that I have found.
Hopefully this helps. Good luck!