I struggled with learning to program for many, many years, until I finally made a certain decision; since then I have learned enough of several programming languages to be able to write useful code, and for C#, JavaScript/jQuery, and PHP I went beyond that cursory level of learning and went much deeper than with other languages. Here’s how I did it, with a little bit of prior history up front:
I have used computers since I was less than 18 months old, and I am now 25 years of age. Both of my parents work in computer-related fields: my father as a Linux sysadmin and my mother on the hardware end of things with network switches and that sort of kit.
I had always wanted to learn how to program, but I always ended up giving up in frustration before I could do much that was useful. In second grade I learned enough BASIC to be able to draw shapes with the ‘turtle’ in thee school computer lab, and in high school I tried out DarkBASIC, which is a 3d-capable game engine of sorts (neither object-oriented nor functional, though closer to functional than anything else. I managed to get a 3d model of a dude to be able to walk around on some random-height terrain using DarkBASIC, and that’s as far as I got.
So about four years ago I said ‘eff it, I;m gonna learn to make a game with the Unity game engine or die trying!’ And so I tried learning C3, but again I was unsuccessful. There seemed to be some sort of fundamental disconnect between code and my thoughts; I have always had a terrible time learning other languages (got furthest with German and Japanese, but failed miserably at the romance languages). I would have some idea of what I wanted to do in my mind, but by the time I had looked up how to do it in whatever programming language I was trying to learn, I had lost either the idea or the inspiration to implement that idea.
Everything changed three years ago. And here’s the part where I explain what I think you should do to gain a working knowledge of a language, ie. the ability to do useful things with it:
Take a language you want to learn, and recreate something that already exists with that language. When you feel frustrated, push through it; literally force yourself to not give up.
For Unity and C# specifically, I decided I would recreate an old PPC pre-OSX Mac game called Pegleg. I encourage you to find a mac, download an emulator for classic Mac PPC stuff, and play the game. It is the most fun spaceship arcade game I have ever played, and that’s not just nostalgia speaking from playing it in that same computer lab where I tried learning BASIC in grade school.
The idea here is that you don’t have to try and maintain your inspiration for making something up from scratch while going through the first few extremely frustrating and painful days; instead you will have a fully-finished idea of what you are trying to create right there in front of you. I could open up my classic Mac emulator and play Pegleg and see exactly what it was I was trying to create.
Naturally, the first few days - probably the first whole week - you’re gonna spend about 98% of your time scouring the web for information on how to do some totally trivial thing. Thankfully there’s a full reference guide for C# and the Unity APIs on the Unity web page, so I had a reference that was easy to find. It’s gonna be shitty, it’s gonna literally hurt; your brain is going to complain and be frustrated and want to give up. But if you power through it by sheer force of will, and keep your eyes focused on the end goal that you are trying to emulate or recreate, you can push through that first week, and it will become much easier. You will still spend time looking things up, but it’ll be closer to 10, 20, or 30% of your time, instead of 98%, with the rest of the time spent coding.
Around the third week or so I began to realize that I was thinking in code; this is the point that second-language teachers stress: you need to stop thinking in English and then translating to Spanish or whatever and just think in Spanish to begin with. Likewise, you will begin to be able to conceptualize what you want to do and the implementation will be fully-formed or at least mostly-formed in code, with no ‘thinking in English’ between those two steps.
Doing this I ended up getting good enough with C# and Unity’s various functions that I finished up my Pegleg clone and began a realtime with pausing for planing tactics game. I never finished that project, but I go back to it every month or two and continue to write more code, both to keep chipping away at it cause the task is so huge but also so as to keep the incredibly hard-won C# knowledge I gained fresh.
Now, I would say that learning through copying something that’s already extant might just be a fluke if I used that method once. But I also used it to learn HTML, CSS (now I use SASS, but I digress), JavaScript for the web (and jQuery as well, plus various jQuery-based extensions), and finally PHP. I will skip the details of learning HTML, CSS, and JS, because those weren’t so hard; PHP was the hard one.
And so I decided I would recreate Wordpress. Yes, that’s right: I picked the hardest task I could think of. And that’s the other key to my method: choose something to emulate, but also make that choice something that will be incredibly hard to do when starting with no knowledge of the language in question, provided that you’re seriously dedicated to just powering through whatever frustration you will feel (and you WILL feel frustrations!)
One and a half months later, starting from exactly 0 PHP knowledge, I had a fully-functional blog engine using MySQL and PHP, with comments, posts, pages, all the relevant display code, logins with reasonable security, etc etc. I had achieved my goal, and was now proficient in PHP and MySQL in addition to all the other web-related stuff like JS.
I do not claim to be an expert with C#, PHP, or anything else; that takes years if not decades. But I consider that I have learned more than I ever imagined that I could in a period of time that was so short it shocked me. I gained a newfound appreciation both for my determination to do something despite any unpleasantries as well as for my capacity to learn things I decide I want to learn.
Whether or not this method will work for you I cannot say, but I used it to learn C#, HTML, CSS, JS, jQuery, and PHP/MySQL in the course of a year and a half, when I had spent literally the entire prior portion of my life struggling to do even the most basic things with code. I hope it might be interesting you you and I hope that it works for you if you decide to try it!
In summary: dedicate yourself to recreating an already extant thing - whether game or blog framework or responsive web-designed website. Decide that you will simply not fail. And choose something that is hard to implement. Then just do it.
Cheers, and good luck!
EDIT: There's two things I realized might be good to mention. The first is that I learned enough HTML, CSS, JS, and especially PHP/MySQL that I am currently working a two-month contract job creating the online catalog for a small, local business using MySQL and PHP. So using the method of recreating something that already exists - preferably something that will be incredibly hard to implement with zero knowledge of whatever language you're aiming for - is actually capable of teaching you enough to be useful in 'real life', ie. not just as a hobby thing. I'm not suggesting you're gonna become the lead programmer in language XYZ for the Fortune 500 company ABC by recreating something that's already extant using that language, but it did teach me enough that I can make extra cash by answering Craigslist employment ads or ads on various job boards.
Second, when you've recreated whatever you were aiming for, come back six or nine months later and recreate the entire thing from scratch - NO reusing code. This does a few things: first, it's just a fun exercise to see how much better you are at the language and how much smaller and tidier the code is - I'm currently rewriting that blog engine from scratch with a code reduction of about 40%. Second, it will teach you things you didn't learn the first time around by being able to think 'gee, how can I do this better/easier/with less code?'. And finally it will produce a better end product, should you aim to use that end product for something, as is the case with using the end result from my current rewrite of my blog engine for the website of my music recording, mixing, and record producing business, which is my day-job. By redoing it (and specifically redoing it with a focus on building in security from the first line of code instead of tacking security on once I had the prior fully-functional blog engine) I will have a much more effective, better, cleaner, and more secure website in the end.