Linux Format logo

Learning to code

UPDATE: No more entries are being accepted for the Coding Academy - we're full! If you've already emailed me to sign up, you should hear from me soon.

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. >>

Those are all excellent languages, and it's great to have a range of experience on them all. But I'd rather know one language very well than 10 languages poorly. Sure, it means if that language goes out of favour then you're in a small amount of trouble, but it really is very small - any C++ person can pick up Java, JavaScript, PHP or C# in a few hours at most, because once you understand the principles the language isn't that important.

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:

  1. Pick a small project and dive in with any language. It doesn't matter which one* - Python is easy enough to learn.
  2. Start small - don't think up some grand plan, because it'll just overwhelm you. Pick something that's really easy and make it. Then add a feature. Then add another feature, etc.
  3. Don't go for C or C++. When I said "it doesn't matter" which language you choose, I put an asterisk next to it because I really don't recommend C or C++ to new programmers, or indeed anyone. The reason is that modern languages, such as Java, Python and C#, do a lot of the hardest and most boring work for you in exchange for a tiny slither of performance. Use a modern language and save yourself time and hassle.
  4. Ask for help whenever you get stuck. If you have a question about programming, someone on our forums can answer it very quickly, or you could spend hours screaming at your text editor wondering why something doesn't work as you expected. As with learning most things, there's nothing as good as having a mentor helping you when you get stuck.

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:

  • I will teach you to program.
  • It will cost you nothing except your time.
  • I will set simple projects for you to do.
  • I'll provide guidance on how to solve the problem as well as a reference solution.
  • All my code will be licensed under the GNU GPL v3 or later so you can do as you please with it.
  • I'll also provide suggestions for things you could try yourself to take the project further.
  • If you have problems, you email me directly and I'll help you solve the problem.
  • As you proceed, the projects will get more difficult to force you to learn more.
  • All being well, it'll give you enough of a kick start to get you going.

You're probably thinking, "wait... what's the catch?" Well, there are indeed some catches:

  • You agree that all code you write as part of the Coding Academy project will be licensed under the GNU GPL v3 or later. This doesn't affect any other code you write, just your implementations of the projects I set you.
  • You agree to release all correspondence between you and me into the public domain.
  • You don't have to have any coding skills, but you do have to really want to learn; I haven't the patience for time wasters. If you can already code but just want some experience with C# or some projects to hack on, you're just as welcome as the newbies.
  • I'll be using C#, Mono and MonoDevelop for all the projects. You'll need to have these on your system - any recent Linux distro should be fine.

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 paul.hudson@futurenet.com 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.


Your comments

Hey Paul, When I made the

Hey Paul,

When I made the forum post, I never expected this would be the result!
I'm extremely excited about this, and thanks for the reply! :D

Emailing now.

Dave.

P.S. Tom Morello rocks!

P.S.
Tom Morello rocks! Loving that vid.

Hi Paul, How long do you

Hi Paul,

How long do you anticipate 'Coding Academy' to run?

Will the projects involved be posted on here, or printed in LXF afterwards?

Lol @ everyone wishing for

Lol @ everyone wishing for their 5 minutes of fame! :P

I've signed up, hope there

I've signed up, hope there are spaces left.

I think an article on how it went once its finished is a must for the magazine, just a round-up of the goals and what was accomplished, and what would be changed if you had to do it again.

Personally I can't wait to start. :D

Neener?! Too funny... This

Neener?! Too funny...

This is great of you, Paul... many, many thanks!

Really generous of you,

Really generous of you, Paul. I don't know whether or not to sign up because I can't honestly say I'll be able to make the time commitment, but it's incredibly good of you to do this!

"How long do you anticipate

"How long do you anticipate ‘Coding Academy’ to run?"

That depends on how fast each student is. Everyone will be able to progress at their own pace; if someone is very fast, I should expect they'll be able to get through it in a month.

"Will the projects involved be posted on here, or printed in LXF afterwards?"

I may make them available online as part of a write-up, but I doubt the code will appear in LXF.

"I think an article on how it went once its finished is a must for the magazine, just a round-up of the goals and what was accomplished, and what would be changed if you had to do it again."

Yes, I am certainly intending something like that. I'd like to find some way to put all the projects, questions, answers and code online in a sensible way.

"I don’t know whether or not to sign up because I can’t honestly say I’ll be able to make the time commitment"

You'll be able to follow bits and pieces online, but you won't quite get the full experience because I won't be around answering your questions.

Rats! missed it. Are you

Rats! missed it.

Are you going to be running another one soon? I'm struggling to learn PHP so I can work more flexibly with Wordpress and Drupal on the web.

Cheers,
Karl

Will we be hearing from you

Will we be hearing from you soon Paul?

Tomorrow or Wednesday perhaps? Just a guess since you said the closing date is 3rd of feb!
Thanks!

Tomorrow you'll be hearing a

Tomorrow you'll be hearing a *lot* from me. Literally.

Aint heard anything... :(

Aint heard anything... :(

Dave, don't forget the apple

Dave, don't forget the apple for teacher :)

I would if I had a teacher,

I would if I had a teacher, Still heard nothing :(

Dave, have you heard

Dave, have you heard anything yet?

Had my 'Welcome' email this evening. :D

Good luck with it, everyone. :)



Web hosting by UKFast