There has been some discussion on our forums about learning to program. More specifically, some readers have found it relatively easy to pick up the basics, but are struggling to advance beyond that into the world of Real Projects.
I want to answer some of the questions that were raised, drop in a few suggestions of my own, then offer a unique opportunity. Let's start with the questions...
< < How do you progress with programming? >>
Programming is no different than any other skill. I like to play the guitar (although right now my Guitar Hero toy guitar has pride of place - d'oh!), but I'm not too good. When I watch a video of a good guitarist playing, it's pretty clear to me that the difference between them and me is many, many hours of practice. If I spent less time programming, less time playing games, less time learning every foreign language that comes my way, and less time stalking Magibon, I could practise the guitar more and probably be quite good.
How do you learn to ride to bike? By riding a bike? How do you learn to knit? By knitting. Programming is no different. In fact, programming has advantages over most hobbies because it's completely free, which is what makes computers so horribly addictive - the only thing that limits what you can do is your time, patience and ability.
< < I've tried on and off over the years. I've tried PHP, Perl, Python, C++, Java with the Open Uni, Pascal for my Diploma in college and a few others. >>
Choose one that suits you. Choose one that gets you in your way the least so that you can focus on kicking ass with code. I've been through all those languages and more, and I've settled on two: PHP on the web, and C# for everything else. I'd say there are only a couple of important languages that do things so very different that you need to spend more than an hour figuring them out, but even those (Ruby and Objective C, if you were wondering) rely on the same fundamental principles.
< < The problems I'm having is I can't progress beyond the basics. I don't know how to impliment my ideas into code, plus my code is very messy apparently. >>
Yes, I can imagine that's a big problem. For me, and I imagine tens of thousands people like me, I just visualise algorithms in my head and out pops code. I don't think about it, I don't have to draw flowcharts or anything - I just jump in and start. It's not uncommon for me to write three or four hundred lines of PHP before running the script for the first time. I'm not saying that's smart; it's just the way I work.
< < I read in LXF114 in Hudzilla's article "Hack On Everything", that all he does is code. Is this the solution? >>
It's not all I do, but it is certainly the primary thing I do. 90% of my code never makes it beyond my source control system - I hack on things just for fun. I'm not saying it will work for you, but my brain works best when I am intensely focused; small distractions are big speed bumps in my world.
< < Paul and I are big exponents of the 'dive in and code' approach - find some source that interests you, try to do something different with it, and you'll learn along the way. You can use books for reference and explanation, but ultimately you want to be playing with code. >>
Mike's absolutely right. If I'm coding on a quad-core machine with 4GB of RAM, I rarely care whether my code could be written 5% faster or 500% faster, because any time spent tweaking/optimising my code could be better spent having fun elsewhere. Sure, when I *release* code I go over it carefully to spot bottlenecks, bugs, etc, but when I'm just hacking around I just jump in and have fun.
< < Say you mastered PyGame, would you be able to code an MMORPG? >>
Yes. You could make an MMORPG in Gambas if you really wanted to - the tools are just tools; you're the one in control. You're the programmer: the language is just there to make your demands happen.
So, those are the answers to the questions. Now for some suggestions:
And so onto the unique opportunity I mentioned at the beginning of the article: I want to help you learn to program. No, I really do - I enjoy it a lot, and I want you guys to enjoy it just as much. So, I'm pleased to announce the launch of the Hudzilla Coding Academy. That sounds grander than it really is, so let me break it down:
You're probably thinking, "wait... what's the catch?" Well, there are indeed some catches:
Let me explain some of those catches in more detail. The GPL clause is there because I insist on software freedom, and I think you should too. The public domain requirement means that every email you write to me and I write back to you can be printed, distributed, sold, edited, or whatever for any reason and by anyone. The reason for this is because I'd like to make a lot the information public somehow so that anyone can follow the projects, see where other folks went wrong, and try to learn from those experiences. Please be sure you understand what "public domain" means before signing up.
I'm using C# because it's my preferred language for programming - I can teach all sorts of things without much fuss. I know some people will complain because I'm using C# rather than Their Favourite Language, but I don't care - this is a free service, which means I get to dictate the terms. Neener. Other whingers will make up some fluff about how Microsoft invented C# and therefore it shouldn't be used on Linux. I really am not interested.
Some small print: I reserve the right to stop accepting applications if I get too many; I reserve the right to stop the academy entirely if I find it terrifically boring, if Linux Format starts going to the printers late, or for other as-yet-unknown reasons; you don't have to read Linux Format in order to sign up, but it'd be nice if you did given that I'm doing this for free; you're welcome to tell other people about this - the more the merrier; please understand that I am by nature rather blunt, so if I write something offensive in an email it's almost certainly not meant to be; you agree that you understand I'm doing this in my own free time, that it might take a little while for me to return your emails sometimes, and that I may be out of touch entirely at some times due to holidays, work commitments or other such distractions; if you have trouble installing the requirements for one of the projects, you'll need to find your solution elsewhere, such as on the LXF forums - I will assume that you've managed to get all required software installed and working correctly, and will only be answering problems related to coding; this offer should not be taken to be a general programming diagnostics session: I will help you write and fix the code required to get the example projects working, but I won't help you fix random bugs elsewhere - that would just take up too much of my time.
So, there you have it: if you want to learn to code, email me at firstname.lastname@example.org with the subject "Coding Academy: Sign me up!". Applications will be open until midnight on February 3rd 2009; if you don't agree to all the catches listed above, don't bother sending the email because they aren't up for discussion.