A Geek Diary

Perhaps the glass is just twice as large as it needs to be?

Archive for the ‘Programming’ Category

Book review: Best Practices of Spell Design

Posted by Kate Glover on April 14, 2013

Cover of "Best Practices of Spell Design" by Jeremy Kubica

Cover of “Best Practices of Spell Design” by Jeremy Kubica

Today I read a book – cover to cover.  That’s not too strange for me, but it was a rather strange tale, or manual, or manual woven into a tale…

It was this book [Amazon Link – opens in new window]  Just £1.94 on Kindle (prices start at double that for physical copies – but I will be buying one!) it’s a bit of a bargain, and covers more than you might expect within its 138 pages.

It is a story of a court wizard and his apprentice, who are called in to reverse the damage to the castle caused by a wizard who did not properly design his spell.  All of this is a big, occasionally clunky, but nearly always entertaining metaphor for programming.  The “wizards” are programmers, the “spells” are computer programs, and so on.

The story goes through a number of chapters, each focusing on a different aspect of good code design, such as the story of the man who’s pass was changed by the guard who would then not let him enter the castle (a missing = from an equivalence test had caused the ID code to be set rather than tested against).  The importance of indentation, correct loop usage, and clear order of conditions on if-else statements are also among the topics covered.

While it is assumed that the reader has a basic knowledge of programming structures – it is not required that they are fluent in any given language.

Little Miss Geek followers will be pleased to hear that the apprentice wizard/programmer, who ends up playing a pivotal role (of course!) is a female and the baker and baker’s apprentice (who is decorating an impressively tall wedding cake) are male – which does go some way towards combating the gender stereotype thing.

While I wouldn’t necessarily recommend this for quite everyone on my course (some have a habit of taking metaphors rather literally!) I would certainly recommend it to those who’ve started coding independently, but who have got to the stage where they’d like some advice on “doing things properly”.   I would also recommend it to teachers who may be approaching coding for the first time, or returning after some time away from the art, and who’d therefore like some re-enforcement in their own minds regarding good practice.

Posted in Computers, Programming, Technology | Leave a Comment »

Why do I love programming?

Posted by Kate Glover on January 24, 2013

Imagine that you need a hammer.

You write down on a piece of paper, what a hammer is and how it is supposed to operate and behave.

VOOM!

Once you finish writing, you find that you have a hammer. You can copy that hammer as many times as you like, to give them to other people, keep backup hammers in the shed, modify copies to operate slightly differently etc.

That’s programming.

I feel like a wizard.

Posted in Computers, Programming, Technology, University | Leave a Comment »

Hand-written Programming Exam

Posted by Kate Glover on January 16, 2013

We’ve got an exam in which we’ve got to write a load of Perl script by hand… with a pen/pencil…

Student holding a biro saying "But it isn't giving me any error messages!"

Posted in Programming, University | Leave a Comment »

How I learned to stop worrying and love programming…

Posted by Kate Glover on January 11, 2013

18 months ago:  I wasn’t a programmer.  I started my degree course, terrified of programming.  I’d been rubbish at A-Level, and hadn’t got any better since.  If at enrolment you’d have offered me a D on a free-pass – I’d have bitten your hand off for it.

Now: It’s my favourite thing. I think about little else.  If I’m not coding, I’m thinking of coding, or planning coding.  At work, rest and play.  I wait for my train to Uni, eyeing up the flashy ticket machine.  I can “see through it” like a software x-ray. I look at the departure boards.  I’ve never seen the system, but I almost certainly know how they work.  What talks to what and how.

My lecturer still finds it amusing when I tell him that I was so rubbish at it.  I’m not sure he quite believes me. He asked what it was that made the difference.  I think it was the structure of his lectures.  The only way I can think to describe it follows (my thoughts at each stage in red):

  • Here is an example of a concept.
    Okay.
  • Play with it.
    I think I’m getting it.
  • Try breaking it a bit and putting it back again.
    What the..!? What does that error even mean?! AAAAAGH! Oh hold on, fixed it…
  • Add to it.
    Cautiously confident now.
  • Put it to one side and use it as a base to create your own example, based on something you personally already know about and understand.
    Wait a minute – it’s virtually the same thing but with parrot rather than dog words…
  • Make it a bit more interesting.
    Haha! Check this out!  This instance of a parrot now has eight legs and a small corner shop!
  • Recap questions.
    Got it!
  • Next week: a concept which usually utilises and builds on the one we did this week.
    GOTO 10…

I hope it makes sense.  The fact that he’s infinitely patient and always takes the extra time to provide a thorough explanation, even when a short one would have done. helps too.

I’m no longer terrified.  I’m excited.  I sometimes have so much stuff in my head when I’m thrashing something out that I end up with nose-bleeds.  I don’t even care…

Break over… back to my coding…

Posted in Programming, University | Leave a Comment »