Learning To Program: How Does It Affect You Now?

January 14th, 2008


closeThis post was published 4 years 4 months 6 days ago and as such probably does not reflect my current opinions, knowledge or ability.

Baby Steps by Radhika Bhagwat

Baby Steps by Radhika Bhagwat

I can’t remember how old I was when my parents first introduced me to programming in BASIC on what I believe was a Sharp PC1211. I learned how variables work and made a simple story telling game, but never really got much further than that. Later on, I experimented with QBasic (when I decided I wanted to be a 1337 w3b h4x0r), Dark Basic (destroying Space Invaders and attempting to create an epic RPG) and Not Quite C (replacing the drag-and-drop programming interface for Lego MindStorms). It wasn’t until part of the way through high school however that anyone mentioned good programming practices. This post considers how much the way you start programming effects you later on.

It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration. — Dijkstra

I think in general my programs are pretty readable – variables given sensible names, lines of code indented clearly and so on. At least, I know to do these things well enough that I feel guilty when I don’t. I don’t think I really considered things like that at all when I was mashing away with BASIC and JavaScript, but at high school it was completely expected of us.

I guess I was lucky to be taught in Pascal rather than Visual Basic (like when I did a computing course at college) – it reinforced good programming technique rather than drag and drop coding, but more importantly than that I think was that I had a good teacher (Thank you Ms King
*waves*). I remember going over the importance of maintainable, readable code almost as much as we went over the difference between RAM and ROM (and trust me that was one hell of a lot), and as a result, I’ve carried a lot of that over to planning and writing programs more than 30 lines long. Conversely, I’m not sure I could write something in BASIC or Pascal right now.

In the end, I don’t think anyone could be less well off having this information drummed into them – but it’s something that a lot of people never seemed to be taught. When I ended up doing computing at college it meant I was placed with students from a lot of different schools – there was a huge difference between the few that emphasized the importance of good programming practice, and the majority who almost certainly hadn’t.

What I really wonder is though, would I ever have picked up on it with no formal programming education at all?

So my questions to you:
What was your first programming experience? Did you teach yourself, or receive a more formal education? How important is writing readable code, and was it taught to you?



Related Posts


Comments

  1. Nistur says:

    My first experience at programming was in QBASIC during primary school, I taught myself a basic (no pun intended, honest) and used it to skive work :P I managed to let the teacher let me make a text adventure (loosely based on Roman Britain) instead of learning about the Romans for the 1,000,000,000th time.
    Since that I’ve looked at PHP and made the beginnings of a web based RPG, then I had a brief look at Java (made battleships!) and then finally in university I’ve now done a bit of Actionscript and C/C++.
    My code is nowhere near as neat as Hazel’s and comments, well, if you had a [insert local currency here] for every comment I write you would have… enough to buy a penny sweet if you’re lucky.
    However I am now learning to correct my mistakes. My code is as well set out as I can and (partly/mostly due to Hazel’s influence) other programming practices seem to be ok.
    Moral of my tale: What is learned can always be fixed :P

  2. Nistur says:

    *basic understanding… gah

  3. Hazel says:

    I don’t think you can blame me for that given how much it was stressed in the C++ lectures last year :/

  4. Mike says:
    if ( readible < efficient ) {
      $good = "Programs work faster";
      return echo "megabucks";
    }
    elseif (readible > efficient) {
      $good = "easier for others to understand";
      return echo "more help";
    }
    else { // readible == efficient
      $good = "best of both";
      return echo "clever";
    }
  5. Nistur says:

    *corrects both of them on their spelling of readable*

  6. Hazel says:

    @Mike *fixed* – if you want to post code <pre lang=”a programming language”>code</pre> gives you some nice syntax highlighting. Using <code></code> should be formatted the same though, so I guess it was just WordPress messing up the formatting. I’ll look into that – being able to post code in comments seems pretty important here.
    Good point well made though.

    @Nistur – Be nice. It’s not like you don’t make mistakes *cough*format of 16 bit colours*cough* :P

    EDIT: Ok that comment just messed up for me too, I guess posting code is going to be awkward.

  7. Nistur says:

    hey hey hey… it’s not my fault that SDL uses 565 RGB rather than 555… Nowhere seemed to want to tell me and everywhere said 555 was more common. Ah well, it’s sorted now and if I ever work in 16 bit colour again I can always recognise it :P

  8. Hazel says:

    Wait I figured out what went wrong both times… if you want to post *any* greater than or equal than signs, even within code tags, you need to use the html entity codes – &lt; and &gt;

    Oops.

  9. ym says:

    I’m a mature programmer who first learned to program in COBOL 30 years ago (yes, that mature). I was taught the rudiments of the language and then let loose on my first program. My first code was a masterpiece of spaghetti code : unstructured, with random variable names, few comments and a liberal use of GO TOs.

    I spent days trying to debug it before my mentor finally took pity on me, showed me what a good program looked like and told me to throw my manure away and start again, this time thinking about structure and variables before I put a pencil near a coding sheet (yes, really that mature). It was a valuable early lesson in how not to program and had more impact than just being told how to write decent code.

  10. Hazel says:

    Hi mum!

    I just remember you shouting at me because I wrote witty, useless comments on my Virtual Pet project thing…

  11. ym says:

    Too many comments can obscure the code and you’ve no idea how irritating it is to try and maintain code where the programmer clearly spent more effort on the witty comments than on the actual code.

    I’m sure I was the very model of patience.

  12. Hazel says:

    Haha don’t worry I stopped after that, I promise.
    I thought you might like (or at least sympathise with) this though: Codulate.

  13. pjgat09 says:

    I started out on QBasic back in 4th grade (I’m a college freshman now). I learned mainly from a book my dad had since he used to program as well. I mostly made small games, and on occasion a program to run some long algorithm (I wrote a program to find all combinations of coins totalling to $2). I messed with QBasic, until later on I started frequenting a chatroom which had automated scripts running with mIRC. I learned to program in that language, and helped build better scripts for the room. At some point i picked up perl, and re-wrote all of the same scripts in perl.

    As for school, I took a VB class (which wasn’t very helpful), and last semester a C class. I definitely don’t think having an educational side to programming was my main reason, I think I just liked to program. I do think having a place to really show off what I’ve made, and the need to keep it running smoothly for months at a time pushed me to learn more, but my first class on a programming language wasn’t until my last year of high school.

    As for having readable code, I’m not sure if I really taught myself or not. I do put more effort into making it readable when others will be reading it though.

  14. Copey says:

    I’m very much self taught at programming, and to be perfectly honest it has been both a massive help and a hinderance. Started off at 10-11 with alittle Visual Basic – hacking Baldur’s gate gate to peices ofc :P moved on then to YaBasic when i got my PS2(yes, i actually wrote a 8000 line game in yabasic on the ps2 WITH A PS2 CONTROLLER! lol. game was awesome tho, a cool wee rpg thing :P ). after that i discovered Game Maker, which is more or less the sole reason i’m studying programming now lol. it was nice and simple, but could do fairly awesome things, and its language GML was perfect for learning all the basics of programming, and was very very loosely based on C.

    In school however we did some really horrible variation of Basic where parameter passing didnt even work. Dispite allowing for parameters in function declarations, everything was considered global regardless.

    So school didnt help much upon startin this course, but i already had a good understanding of programming from using Game Maker alot a couple of years before. And more importantly, i *thought* in programmers terms about tasks which helped massively, even now :)

    However, the downfall is i had no concept of neat/tidy code until very late on in my “Game Maker” career, and didnt really impliment much like that. So when i came to uni, dispite managing all the tasks with realative ease, my code was horrible. Fair enough, still nicely indented, and good variable names(unlike my game in ps2 yabasic, i’m fairly certain variable names were a-z, then a1-z1 etc rofl xD) there were alot of things that were just nasty, like repeated use of globals.

    Nonetheless, i defo wouldnt be here today without my prior knowledge of programming, so its all good really ^^

    -Ian

Leave a Reply