Frustration

Coding can be frustrating and rewarding, and today has been both for me on the same practice project.

One minutes I was rejoicing like a 7 year old discovering coding for the first time at drawing a ‘flower’ the next I was swearing like the 36 year old I am when I can’t get said flower draw in colour.

And I still can’t get it to draw fully in colour even after checking the code numerous times.

But then I have to see it as part of the game. If coding was easy then everyone would be doing it and it wouldn’t be fun.

So now I am taking a break, watching a bit of NCIS and hoping when I switch back over to the Raspberry Pi, whatever it is that is missing will be seen pretty quickly on starting up again.

In can but hope, I just want to get onto the really fun stuff of designing my own programmes now!

Sooner or later…

It was bound to happen, sooner or later I would get stuck, it’s just happened a little sooner than I thought. 

At the moment I am in the process of writing a ‘hangman’ type programme, it’s bringing together all the things I have learned so far, numbers, strings, variables, commands etc etc. 

But it isn’t working. I am doing as advised and testing at each stage and it’s point blank refusing to play ball….or hangman even! 

It was going to happen at some point, I would reach an impasse, it’s just happened sooner than I would have liked. However am I going to give up? For tonight yes, but not in the long run. I am going to go away, sleep on it and come back to it tomorrow with a nice fresh brain and see if I can spot my mistake. Failing that I will just start writing the whole thing again  and see if that works! 

Coding is supposed to be easy, it’s meant to be a challenge, but it’s meant to be a challenge which can be overcome with some logical thought and patience that’s half the fun I guess, but it also makes a working end result all the more satisfying and you can sit back and think ‘I did that’. Even at the age of 36 you can get a child like pleasure out of it.  

But dammit, I’m not going to stop tonight quite yet, just one more try….

Don’t Repeat Yourself

After a days break and a seriously rough day at work where whatever I did was wrong in one way or another I decided to gently get back into my coding practice this evening by finishing off chapter three of my Programing the Raspberry Pi book which I have been working from over the past few days.

this evening it was just simply a case of of taking the dice game further by learning about the ‘else’ and ‘while commands and what they are capable of.

To be honest at this very moment in time I can’t really remember exactly what they do, but be assured, give it a few hours and the logic will have set in and I will remember in my own way.

However I am growing to liking coding on he Pi more and more each time, especially in the Python language which is an ideal one for a starter like me, it’s fairly simple and it’s one in which you can code pretty much start straight away from the moment your Pi is up and running

But the best thing is the Pi itself makes it easy and with the IDLE software which comes with the Pi it will even point out your mistakes in nice big, bold letters, which on a 32 inch wall mounted LCD TV with he curtains open announces to the world that you are not only a geek, but a numpty too as it highlights your spelling mistakes!

But never mind, if you care what the street thinks you wouldn’t be coding anyway and you’d be sat watching some reality TV rubbish, and lets face it which is more fun…really which is more fun?

So to tomorrow, another day at work, one which I hope will be better, in fact it will be better dammit! and a little bit more coding in the evening.

Oh and yes, I did learn a little about DRY (Don’t Repeat Yourself). Hopefully I can follow that throw to blogging!

 

Time out, recharge…

Today has been a coding day off of a kind. Because of a busy day at work I haven’t actually got any hands on coding practice done, the Raspberry Pi and Chromebook have remained firmly switched off.

But that doesn’t mean I’ve been away from it completely, not at all. With an hour for lunch and nowhere to go in Dunkeswell I have one of two choices in how I will spend my time. 1, sat in the car reading or 2, sat at my desk reading. 

Today I decided to sit at my desk reading, mostly because I couldn’t be bothered to walk the 100 yards to my car in the rain! 

So I sat at my desk and did some revision from my current coding reading material. 

The problem is can I remember any of it right now? Can I heck! I just hope that tomorrow when I get around to switching the Pi on again that I will remember some of it and be able to put it into action and get some quality time in.

Coding is like a musical instrument, to be good at it you need to practice little and often and reading all the theory is all well and good but it doesn’t make up for actually getting hands on. 

So tomorrow evening will be spent, in part practicing…and hoping that some of it will stick to the aging brain cells! 

Throw of the dice

Most books on learning how to programme start with simple codes for you to try so you can get right into it and see the results pretty much immediately.

My first coding from the book, Programming the Raspberry Pi – Getting Stated with Python by Simon Monk, was a simple, but fun one, a simple dice game.

 

#3_1_dice

import random

for x in range(1,  11):

          random_number=random.randint(1, 6)

          print(random_number)

As simple as that (try it! you can give it a go on the internet through any good programme writing software like ShiftEdit)

For me starting out after nearly 25 years away from programming (in my day it was the BBC computer or the Commadore Plus 4!) it was a simple little programme that gave me a quick result and showed me that anyone can programme and that I can progress onto better things but that it will just take time and regular practice. But also for anyone who has never programmed before in their entire life it also gives a little encouragement to keep going when just a few simple lines can produce results!

The day I decided to code

When you hit your 30s you go through something of a strange period of change. You realise you are no longer young, but you hanker after the simpler, more innocent days of your childhood…a time before things became really complicated!

Saturday morning last week I woke up with a strange thought in my head. ‘You know what I haven’t done in a long time? computer programming! You know what I think I’m going to sit down and learn!’

And I did, there and then I got onto my Chromebook and started to research and found within minutes a whole load of websites and books from which I could learn how to code once more. I started that day with Code Academy and refreshing some of my very rusty knowledge of HTML. By Friday I had brought myself a Raspberry Pi on which to learn Python, a whole heap of books from which to read from and already written my first basic programme which I used to pick my lottery numbers from (you think I jest but this is sadly true!) In the meantime I had worked a 40 hour week as an engineer!

What it does show however, that while I may be a fool and rush into things, you can achieve a huge amount in just one week with a bit of single mindedness and the right equipment to hand.

For me it started with a simple £199 Chromebook for which I could do my research on and make a start in some basic programming with the help of some coding websites, which while designed for children are also an asset to any adult wanting to get started.

It doesn’t even have to cost that much. The Raspberry Pi itself costs just £25, although if you buy a starter kit, which I would personally recommend as it comes with all the cables and instructions you need to set up, it will set you back between £45 and £75 depending on where you shop. Still under 100 quid to get started in programming…you can’t say fairer than that!

Now that I’ve got started I don’t want to stop too soon, I’m enjoying the learning curve and exercising the ageing brain cells. Programming may come in useful in a wider context for me, but at the moment I am just happy with learning and having a bit of fun with the process and seeing how far I can push the limits of my own abilities in the area.

Programming isn’t the exclusive domain of the young, us 30 somethings and older can also gain something from it…and I’m intending on doing so!