Learning to Program is not what it used to be

Wednesday May 9thSoftware Development Category

One of the most common questions asked by would-be coders is “which language should I learn first?“. The answer isn’t really straight forward. I think it varies depending on age, aptitude, how well you know computers, your passion and what you want to do with what you learn.

On hearing this question recently, I decided to avoid my usual response and actually put a bit of thought into how I learned to code, to see if the method is still feasible, then resopnd accordingly. I set about reading a few blogs, doing a few searches for bits and pieces that I used to play with, and playing with how easy it is to get a simple language/compiler fired up on the “latest ‘n’ greatest” PCs that we have available today. I was surprised to find that things really have changed. A lot.

The first time I ever dabbled in any form of coding (and in this case I’m using the word “coding” in its broadest possible sense) was when I peeked and poked on the second computer I ever owned - a Commodore 64. This was in the very early days for me, and I have to admit I didn’t really understand everything that was going on (arguably, I still don’t :D ), but it really gave me a taste of how things were, and what was required to make all those funky games that I used to play as a kid.

My lack of understanding was my motivation at this point. How did those guys manage to make such rich worlds and exciting games for these computers using such obscure codes and commands? A curiosity got hold of me, and I set about to learn how it was done. A few years flew by before I really started to grasp what was going on, this was partly because I wasn’t able to get my hands on a new machine until the early 90s. A few friends here and there had computers at home (usually an Amstrad) and at primary school we’d have time here and there for dabbling on the computers, but in general I failed to achieve anything substantial.

Well, perhaps I’m being too hard on myself. I guess I felt that what I was doing was fairly insignificant despite it being a bit more than what the other kids were doing, and it was a real point of frustration for me. I wanted to make the hard stuff like the big boys did, but with the tools and the time that I had, I never really managed to get anywhere near where I wanted to go.

Then things changed dramatically. In late 1990, my family and I moved from the sleepy town of Hayle in Cornwall, England to what was then a nice coastal town called Nowra on the South Coast of NSW, Australia. The move was fairly drastic, and to help with the transition, my parents bought me a new computer - an Intel-based 80286 IBM compatible! It came with MS-DOS (I think it was version 5.0) installed and a small selection of software (some games and a few little apps for admin stuff such as writing documents and dealing with spreadsheets).

As excited as I was about my new toy, I was partly torn between it and the new wonderful world that could be experienced outside. Australia really is an amazing place to be, especially when you’ve originally grown up in England, and the outside life really was fun… but I digress…

I utilised the hours of darkness to feed my need to learn how this magic box actually worked. After spending a fair bit of time mastering the basics (you wouldn’t believe how many times I managed to completely smash my autoexec.bat and/or config.sys files while trying new and wonderful ways to boot multiple configurations while minimising the amount of conventional memory being used), I somehow stumbled across a program that I didn’t know existed, but later found out that it (or a variation of it) had existed for a very long time.

This program was single-handedly responsible for many late nights and lots of abuse from my family to “get off that bloody computer”. I quickly developed a QBasic addiction.

This is where it all started to make sense. I spent hours and hours learning the fundamentals of the language. My parents bought me the official MS-DOS QBasic Programmers Reference so that I didn’t have to constantly switch to the help file to figure out what I should be doing! I ripped apart the source code or Gorrilas.bas and Nibbles.bas to see how the masters used the language, and over a fairly short time I managed to crank out quite a few cool applications and games.

It’s now many years since I last played with QBasic, but I have to say that if it wasn’t for this language, and the fact that it came for free with the computer, I possibly wouldn’t have got into software as a profession or perhaps even gained the level of experience that I have gained.

And finally we arrive at the key point! Back on those days, even though we didn’t have ready access to the web, we still had something like QBasic that shipped with the computer that could be used by those of us who wanted to learn. We had the means to learn to write code in a relatively complex yet simple language without really having to search far and wide for it. It was there, it was easy enough to pick up, and we even had a mini development environment there ready to be used to aid in our development. We didn’t have a plethora of opinions being thrown at us through forums and blogs telling us that C, C++, Lisp, Prolog, Miranda, Eiffel or Pascal are the languages to learn if you want to do something serious (I admit, I’ve been a culprit for this when I haven’t really thought much about the person who is looking to learn).

It seems that anyone who has an interest in the black arts of coding is now told to go and learn a high-level language with proper object-orientation with all the bells and whistles so that you don’t learn any bad habits. This recommendation might be a good option, but again this depends on the person.

In my exploration of this topic, I’ve come to the conclusion that there is no such thing as the ‘ideal’ language for everyone to learn first. But I do think that there are one or two that are stand-out contenders to get people off the ground.

I’ve decided to put together a small list of languages matched up with different types of people at different levels of ability, different ages and different goals. This list contains my view on which languages fit with those people, and why. I might be wrong, but hey, it’s my opinion that I’m expressing, so feel free to express yours too using the comment form. It’s not exhaustive, and isn’t designed to cover every language on the planet. I hope that this helps some of the budding developers choose a target language and make the most of the time that they spend learning.

QBasic
Download Link: http://www.qbasic.com/
Remarks: This is an excellent language to learn for almost anyone. It’s procedural which negates the need to have an understanding of object orientation, and is a language which gives results quickly. One thing that’s very disheartening for budding coders is when they feel they put in a lot of work without seeing a result. QBasic is easy enough to get results quickly, hence keeping up the motivation of the learner, but it still powerful enough to do some fun stuff with. One thing that I love about QBasic is that it has a mini development environment and debugger built in - which is something you don’t see in many languages!

C
Download Link: http://www.thefreecountry.com/compilers/cpp.shtml
Remarks: A very powerful procedural language which has been around for a very long time. The knowledge base for this language is immense, and hence there’s a stack of material to learn from. It can be quite difficult to grasp some of the concepts when using C, and the learner is forced to dabble with some things which may be confusing even from the word go (eg. passing the address of integer variables to scanf). It’s a great language, and definitely worth learning, but would be more suited to those people who have a decent grasp of programming concepts. If you have experience with another language, such as QBasic, then C would be a good next step. If you decide to take on C as a first language, expect to do a fair bit of work before you start to see the results. Setting an environment up for development can be a pain depending on the compiler and platform you’re using.

C++
Download Link: http://www.thefreecountry.com/compilers/cpp.shtml
Remarks: C++ was born from the lessons learned from C. It’s an object-oriented language that still lets you write procedural code (not a good thing IMHO), but that’s mainly due to the need for backwards compatilibity with C. C++ can be easy to learn for those with an idea of object orientation, or who have a good working knowledge of C. If you’re a first-timer then I wouldn’t necessarily consider using this language unless you have a strong grounding in maths and logic, or if you have a mentor to help you learn. Generally people who want to learn C++ intend to use it for more than just home projects, and hence it’s a good idea to have some form of tuition - mainly to help stomp out bad habits and to make sure you don’t write a stack of tightly-coupled and unmanagable procedural C-style code :) Take this on as a second or third language unless you’re feeling adventurous. Like C, this can be a pain to get working with, and generally isn’t as simple as “type and run”. If you’re looking to get going with a language quickly, again, go with QBasic. If you want to be a game developer, right now you’d be stupid not to learn C++ - it’s almost an industry “standard”.

PHP
Download Link: http://www.php.net/
Remarks: A cross-platform dynamic/scripting language. This language is a mix of procedural and object-oriented languages, and seems to be a mixture of a stack of other languages all in one (there are elements of C, C++, and even scripting thrown into it). It’s generally used for web-based applications, though it’s not the only thing it can be used for. I would recommend learning this as a first language in a web environment, but if you’re new to programming, stick with something that can run locally. Setting up PHP can be a pain regardless of the platform, and because it requires a webserver to be running as well as the interpreter there are more possible points of failure. Debugging can be a difficult and therefore a deterrant for people who get frustrated easily. This language is valuable, but take this on when you’ve got a good idea about programming in general and have an understanding of issues that are faced by applications in a web environment.

Ruby
Download Link: http://www.ruby-lang.org/
Remarks: Another cross-platform dynamic/scripting language. Still in it’s infancy, yet already very stable with a large user base. Fairly intuitive, but that might be just for those people with a programming background. Worth a look for anyone looking to find a good scripting language for menial tasks and for things such as build processes. Coupled with Rails (http://www.rubyonrails.org/) it becomes a powerful rapid applicaiton development framework for web-based applications. I wouldn’t recommend it as a starting language, primarily because of the toolset that has to be used.

Visual Basic
Download Link: http://msdn.microsoft.com/vstudio/express/vb/
Remarks: Worst language ever :) But I guess every language has its place. This is good for rapid prototyping, and is a good way for QBasic developers to get an idea of how to build Windows GUI applications. It’s not something I would recommend to anyone who is looking to get themselves into serious coding, as the language has so many flaws it makes doing things “properly” particularly difficult.
Disclaimer: I realise that the language has changed a bit since the early days, but I still think that learning something like C# would be a better option for Windows applications. I personally feel that VB no longer has a place. Again, that’s just me :)

C#
Download Link: http://msdn.microsoft.com/vstudio/express/visualcsharp/
Remarks: A better alternative to VB, and quite nice to use. Good for both web and windows applications, but again requires some background knowledge (particularly for web apps). It’s fully object-oriented and very well designed. Take this language on if you’re looking to move into a professional position building enterprise applications. It could be a good option as a first language, but I think there are easier options. Most people with a background in C, C++ or Java will find this language very easy to pick up. The development environment is nice, but not necessarily intuitive to new developers, so a few tutorials would need to be read to learn how to move around the IDE before any serious development work could be undertaken.

Java
Download Link: http://java.sun.com/
Remarks: Depending on who you speak to, this is the language that Microsoft ripped off when creating C# ;) I’m not sure if I agree or not. Either way, it’s a cross-platform language that can be used for web and GUI applications. The virtual machine runs on different platforms so you have the added benefit of having your app run on different platforms without the need to write extra code. It’s object-oriented, and has a very rich framework of tools and libraries. It’s quite intuitive, and has a large user base with a great deal of knowledge. The guys in the Java world, at least until now, have generally been leading the way in areas such as unit testing, mocking and other agile principles, and hence the community is fairly active. Finding information, tutorials and people to help you would be easy with this language, but be prepared for a little bit of a learning curve to get going. A good first language, but possibly not the best. Definitely worth learning if you want to build web applications, or even mobile phone games!

As a final note, I’d like to point out that I left functional languages (such as Miranda and Haskell) out because I think they’re too confusing for new developers :) That doesn’t mean I don’t think they’re valuable.

Please let me know your view, and feel free to give us a run down on how you started writing code.

10 Comments

  1. tom
    May 10, 2007

    “I’d like to point out that I left functional languages … out because I think they’re too confusing for new developers”

    s/new developers/old developers/

    In MIT’s intro to programming course, they teach you scheme in about 10 minutes of class time.

    to learn programming you want to learn concepts, not get wrapped up in any languages’ idiosyncrasies.

    joel (joelonsoftware.com) wrote a rather poignant blog post about languages and learning to program. I think he’s mostly spot on. something about java schools?

    I learned with C personally and I don’t regret it. I usually recommend scheme to people however.

  2. OJ
    May 10, 2007

    Hello Tom, thanks for your comment!

    You raise some interesting points here. I did fail to mention that lots of older programmers struggle to pick up functional languages, but I guess the main reason for that is that I was focussing on the new guys. It’s a good point though! The “old dog, new trick” saying rings true here.

    I completely agree that the point of the first language is to get you going with the principles and concepts instead of language-specifics. Again I feel that’s why some languages are better than others when it comes to the very first attempt to learn.

    I read Joel’s blog on a regular basis, and really respect his views. He’s an interesting read! I haven’t, however, read his comments on learning to code. I’ll make a point of checking it out later on, so thanks for the reference.

    Scheme is a language I haven’t had a play with at all, but I have heard good things about it. Since I am not really qualified to cast an opinion on it, would you mind giving us a brief opinion as to why you would recommend using it as a first/learning language?

    Thanks again for your comment Tom. Cheers.
    OJ

  3. tom
    May 10, 2007

    It takes an exceptionally short time to learn basic syntax and start playing is the main thing. you don’t have to know what a pointer is, don’t have to know what OOP is (shouldn’t either imo), etc.

    Scheme will take you through recursion and even lambda calculus if you want. I don’t think any of the above have any constructs for that even. I’m not familiar with ruby, they may have something.

    Most modern development langs just give you to much stuff to learn up front.

    I haven’t used scheme a lot myself either, more LISP. But I always recommend learning at least one functional language. It’s a real eye opener once it starts clicking. Not that I didn’t find it difficult to learn. Whats difficult I think is changing your method of thinking, new people don’t have that precondition.

    I think another thing that schools miss out on is showing people fun stuff that you can do with coding right from the start.

  4. OJ
    May 10, 2007

    I agree with you to a point as far as syntax goes. Some people find the syntax very hard to get familiar with, regardless of the language. Those of us who are akin to learning computer-related stuff, including languages, will find syntax very simple. I’ve spent a lot of time with people who have struggled to master the syntax. I guess this is part of what makes us all different :) Understanding pointers an OO are exactly the kind of prerequisites that a learning language should avoid.

    To my knowledge, lambda functions are generally not covered at all in basic programming courses, as they, for some reason, tend to be considered a more advanced topic - as are functional languages. I’m not sure if my post gave off the wrong impression here, so I should make myself clear. Like you, I think learning at least one functional language is imperative if you’re going to be a developer. However, I do feel that being exposed to a functional language early on in the piece presents a strong challenge to learners, and only those with a strong programming mind will be able to pick up the concepts easily.

    Learning recursive programming is best done through a functional language. FYI one my favourite quotes is “In order to understand recursion, one must first understand recursion” :) Functional languages basically ram that theory down your throat.

    I agree with your point regarding the fun side of coding. Initially, the newbies should be shown how much fun it can be to create software. On the flip side, I think that as time goes by and learning languages is something that’s easy for a person to do, they should then learn the programming can be a nightmare, and start being taught best practice, and methods in which to reduce the cost of maintenance - this is something that is really missing in all of the courses that I’ve seen.

    Thanks again :)
    OJ

  5. dan
    May 10, 2007

    As a designer who didn’t get any formal training in the dark arts, I agree with Tom’s sentiments… if I had been tought Scheme or something entry level like it, I think I would have quickly begun to understand what it means to make computers do things, instead of blundering around in the dark.

    Admittedly, when I began my design course I was not to know that I would be relying on things like Javascript and Actionscript as much as I do now… but even still, I think there is a big gap for learning methods that focus on the non-hard core of us.

    Now… as an untrained hack… I dont know if learning Scheme (or another language) would have helped me with my current issues (read: understanding Classes and true OOP in ActionScript 3.0), but I think that the more thought that goes into entry level programming basics (from an educational point of view) the more possibility there is for people like myself - who may not be developing C++ apps, but rely on technologies just as (if not more) abstract like Javascript, Ruby et al. And especially because the landscape is constantly changing.. the very rub that your original post is aimed at.

  6. OJ
    May 10, 2007

    That highlights an interesting point Dan. What about those people who take degrees that don’t necessarily involve “proper” programming, but over time get exposed to development through the job that they do?

    These are the people who I guess initially didn’t have an interest, or didn’t necessarily want to know the dark arts before they started their career, but have had it partly forced on them because the nature of their industry has shifted.

  7. Keef
    May 15, 2007

    My learning curve was similar to yours OJ. I started out with BBC Basic on my Acorn Electron, went up to BBC Basic 5 on an Archimedes and eventually ARM ASM.

    I didn’t write a line of C/C++ until I went to Uni, and only really learnt them properly when I had to use them for work.

    Back to the original question, I guess it depends on what people really want to do with a programming language. I’d suggest that something like getting the Visual C# Express Edition would be a good starting point these days if you want to get the buzz of getting something working quickly (which is what got me hooked on programming in the first place with BBC Basic). It’s also a very rich language with many modern concepts embedded, though as people have commented it takes effort to learn these concepts properly and to understand them outside the framework of the language.

    Another point is, how do you learn to progress from a coder who can (more or less) solve any problem with code using the same tricks (however bodgey)? I think a lot of coders are stuck in this rut. How does someone like this become someone who really thinks things through and codes for maintainability, debuggability, does proper requirements gathering, thinks of who will actually use it, etc.

  8. Vault-Co
    May 17, 2007

    QBasic was a serious language. I used it to do hardware intensive code using speech boards on a contract in New York. It was great for delivering things very quickly using a language built-in to the machine. Later the compilers for it built standalone EXEs so it was extremely effective for short jobs that required complex maintainable code without the overhead of C or Visual Basic.

  9. OJ
    May 18, 2007

    Hi Cleve,

    QBasic still has a place in my heart :) I had a great deal of fun with it and I still think that it has value - particularly to those people wanting to learn.

    Don’t get me started on the overheads of VB! :D

  10. RockThunder
    June 12, 2007

    Hi Mate,

    Nice post! I would have liked to have heard about your ideas on smalltalk and eiffel and where they sit in your programming world.

    I have been pairing a lot with Eastabrook recently and he has suggested a process he read here

    http://resharper.blogspot.com/2007/05/jedi-way-coding-in-reverse.html

    called ‘coding in reverse’. It is like a breath of fresh air and when you use this with Resharper it make it so easy. Have a go and let me know what you think.

    Cheers mate.

Leave a comment

Size

Colors