Gareth’s Diary: LearnToCode

Gareth’s Diary: LearnToCode

 22nd May 2019

Learning to code with Gareth Stirling. Belfast's coding course for beginners. | webtalksni

Gareth’s Diary: LearnToCode

 

Background

 

I’ve started my journey learning to code in a course called ‘LearnToCode’ which is for beginners in software development. 

 

For those of you that don’t know, ‘LearnTo’ was set up last year by Kris Jones and Ryan Beckett from Secure Broadcast.  The first course they ran last year was called ‘LearnToiOS’ which was a free eight-week training course hosted by Charged, Secure Broadcast & NSBelfast.

 

I interviewed Kris and Ryan last year on my podcast, WebTalksNI.  I was interested to know more about this initiative as it is a great example of the grassroots community in Belfast coming together around a shared interest to support, learn and develop. 

 

Kris and Ryan give up their own time to run these courses as they have an infectious passion to give back to the web community in Belfast.  These courses are not a promotional or recruitment tool for Secure Broadcast, more a community project as they involve other local business like The App Builder, Salt DNA and Danske Bank.

 

It was during the podcast that I learned about their latest course, LearnToCode. I was keen to get involved as I wanted to help promote the initiative as much as possible.  Which has led me throwing myself into the LearnToCode course (or the deep end) and learning how to code myself.  I’m hoping this will give me a deeper understanding of the people and jobs I recruit for.

 

 

This could be a roller-coaster of a journey between not having a clue what I’m doing to hopefully building something in the end. I hope you enjoy my insight over the next 8 weeks!

 

                - Gareth, host of @WebTalksNI

 

 

Week 1 – Writing my first piece of code

 

 

The course began on Wednesday 15th May.  Unfortunately, it coincided with one of the sunniest days of the year so far, but it didn’t have any effect on the attendance of the class; it was full.

 

Over the next 8 weeks, we will be learning the fundamentals of Python programming.  We will then have to present a project that we have put together with our newfound skills.

 

This week we familiarised ourselves with the python application called PyCharm.  We had to set this up before the class but, of course, I hadn’t done this properly but the mentors on hand quickly got me sorted.

 

Ryan was teaching the first class and we covered off the basics which included the basis syntax used in Python (quotations etc) Variables, If and Else statements, For Loops and a short introduction into Array’s.  We also learned how to create comments in your code and the importance of indents.

 

Ryan has only been working as a full-time developer since 2017 but his knowledge far outweighs his experience.  He was confident in his approach and ensured everyone was keeping pace.  It is clear he wants to understand what’s happening and that you’re not just following instructions.  To help with this, random people were picked from the class to explain what’s happening in a specific piece of code.  It sounds scary but it does help focus the mind.

Gareth's journey learning to code | WebTalksNI | LearnTo | Belfast Coding course

 

 

here were four mentors in the class that also helped ensure everyone understood what’s going on.  Paul McBride, Phil Hutchinson, Paddy Carey as well as Kris Jones were all close at hand to help.  These guys are freely giving over their own time to help on the course so a big shout out to those guys.  Paul and Phil in particular might get a lot of emails from me over the coming weeks.

 

Gareth's journey learning how to code | WebTalksNI | Learning how to code in Belfast

 

I must admit that I was a bit daunted at the thought of attending this class, but I was buzzing afterwards.  I was happy that I grasped the basics and was able to complete the first task set for our homework.  Imagine still getting homework twenty years after leaving school.

 

Hopefully, I can continue to keep up with everyone over the following 7 weeks!  I should be okay if I use the main tip that came out of the class…Google is my friend an ally!

                                -  Gareth

 

Week 2 - It's getting slightly more complicated

 

This week the class was led by Phil Hutchinson.  Phil is the DevOps manager for Anomali and would use python daily and therefore highly knowledgeable in this area.  Again, Phil is giving his free time to teach this class as well as the prep time required.

 

He started off with a recap of the first week.  Since it had been a while since most of us had looked at the material, it was needed.

 

The new topics that we covered this week included:

  • While Loops
  • Functions
  • Recursion
  • Debugging - breakpoints, step into, step over, continue

 

While Loops were easy enough to get my head around and they are similar to For Loops:

‘for’ iterates through a collection or iterable object

‘while’ loops based on a termination condition, or infinitely if no termination condition is met

 

What this basically means is that, unlike a For Loop, the while loop will not run indefinitely, but until a defined condition is no longer met.  I hope I explained this properly!

 

We were able to test out While Loops with a challenge and what struck me was the many ways that people solved the problem.  Also, nearly everyone ran into the same issues with the challenge.  As always, there were plenty of mentors on hand to talk through issues.

 

We then went on to Functions and I quite enjoyed this part of the class.  Mainly because I understood it quickly which came as a surprise to me:

 

“A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.”

 

What I really struggled with was Recursion.  Phil did well to explain this as best he could.  It’s Functions calling functions calling functions calling functions.

Gareth's learning to code| Functions, Recursion, while loops and debugging

  Phil used a metaphor to explain this:

 

Imagine placing two parallel mirrors facing each other. Any object in between them would be reflected recursively.  Functions which recursively call themselves.

 

I wish I could go into more detail but, to be honest, I am still struggling with the concept.  Kris Jones reassured me that they are rarely used in daily software development which gave me some comfort.

 

In conclusion, I am still really enjoying the course.  You do need to spend some time going over the notes in your spare time.  I found YouTube very beneficial when going over some of the concepts that were discussed in both classes.  That’s the great thing about learning to code in any language; there is plenty of resources online to help you.  You can’t beat the help of a mentor though which is why this classroom-based learning is so important.  Thanks again for the mentors and instructors to give up their spare time each week.  It’s much appreciated!

 

Week 3 - Classes

 

Tonight, Kris Jones led the class to discuss a fundamental building block in Python; Classes.  Python is an object-oriented language and, until this evening, I wasn’t 100% sure what that meant!  I had studied Java at university but that is nearly 20 years ago now. 

 

Yes, I am old now.

 

Gareth Stirling learning to code | WebTalksNI | LearnToCode

 

Simply put, a ‘Class’ is logical grouping of data and functions.  These can be defined as ‘methods’ when they are put in a Class.  While ‘Def’ is used to define a Function, Class is used to define a Class.  But the catch is we can’t just throw random Functions into the Class, there must be a logical connection between them. So, when you are implementing the system in this way, you are actually performing object-oriented programming.  An age-old question has been answered for me!  LearnPython.org explains it perfectly:

 

“Objects are an encapsulation of variables and functions into a single entity. Objects get their variables and functions from classes. Classes are essentially a template to create your objects”

 

It is still a lot to get your head around so most of this evening’s class was based around challenges so you can really understand what’s happening.  I still don’t have a complete picture of what’s happening, but Kris assured us that everything will become clear by the end of the course.  I am hoping that everything will just ‘click’ at some point.

 

Developers face issues everyday - Learn to Code | WebTalksNI podcast

 

Not knowing what you’re exactly doing is normal at this stage.  Even Senior Developers who have been programming for years still run into things that haven’t seen before on a daily basis.  It is now clear why the web development community in Belfast is so important.  Developers need to be able to learn and help each other.  I have often said to candidates that it is essential that they find jobs that have a collaborative working environment and doing this course makes me realise how true this is.

 

Critical thinking is essential to be a developer | LearnToCode | WebTalksNI

 

The most important thing I have learned so far is your technical knowledge isn’t the most important thing, but rather your approach to critical thinking.  When presented with a problem it is best not to just jump in and start writing lines of code but take a step back, break the problem down into sections and plan the best approach to solving the problem.

 

I have found that I tend to over think the issue and then try to fix the problem with an elaborate solution. The simplest approach is the best way in most cases so far.

 

Thanks again to Kris for leading the class and to all the mentors that gave up there spare time to help us get our heads around the fundamentals.

 

 

Week 4 

 

Dictionaries

 

Phil Hutchinson was back teaching this week and the main topic was Dictionaries. We also covered functions and classes again as its important that we understand what they do to properly understand Dictionaries.

 

Dictionaries are best described as the implementation of a data structure that can be known as an associative array in other languages.

 

Here is what a Dictionary looks like in Python:

d = {

    <key>: <value>,

    <key>: <value>,

      .

      .

      .

    <key>: <value>

}

 

It’s basically a sequence of key-value pairs; each key-value pair maps the key to its associated value. For example, here is a dictionary that maps a phone number to a name:

 

people_and_numbers = {
    'David': '020_7946_0569',
    'Kris': '028_9002_2388',
    'Katie': '0770_090_0077',
    'Lucy': '0715_551_6047',
    'James': '0788885565945',

 

This is the example we used in the class.  There is no problem calling the values that are in the dictionary.  An issue arises when you try to call a value that is not in the dictionary.  To stop the program from crashing we have to create an additional function:

def get_hometown(person):

  return people_and_places.get(person, 'Unknown!')

 

This simply means that if we tried to print a value that wasn’t there, like ‘Gareth’, it will simply come back saying ‘Unknown’.

 

The whole point of using Dictionaries at all is that once you create them you can easily access elements, update values, delete elements etc.  This means that the code you write is more concise.    

 

This week we also covered what the input() or raw_input() functions didBasically, when one of these built-in functions are called, the program stops until the user enters the input via the command line.  The difference when using these functions only depends on the version of Python you are using.  It looks something like this:

 

# Python 2
txt = raw_input("Type something to test this out: "
print "Is this what you just said?", txt  

 

Output

Type something to test this out: Let the Code be with you!

 
Is this what you just said? Let the Code be with you! 

4 weeks into learn to code course Belfast

It’s hard to believe that we are already halfway through the course!  Only 4-weeks to go!

 

Week 5 -

 

Learning to code | Gareth Stirling | WebTalksNI

 

Things got real this week and we had a go at creating our first application in Python.  It was tough to get your head around, but I am starting to see how everything we learned over the past few weeks coming together.

 

We started off with a recap of last week’s class which included Dictionaries, Stacks, Functions and Classes.  It was important that we understood how these work for this week’s lesson.  Classes are important for building this week’s application.

 

A Class is a logical grouping of data and functions.  Sometimes classes can be based on objects in the real world like a Customer, or Person, or Place.

 

Phil gave us a good analogy on how to understand classes.  If you think of a Class as a recipe to build a cake.  The recipe is the Class and the Cake is the object.  A recipe is needed to bake a cake.  A cake can be eaten when it is baked but you can’t eat the recipe.

 

So, like baking a cake, a class-based program creates objects according to the class definitions of the program.  A Class contains variables and methods.  So, if you bake a cake you need ingredients and instructions to bake the cake and it’s the same for Classes.  A Class needs variables and functions.

 

This description did makes things a bit easier to understand.  Phil then went through a Bank application built in Python which holds basic information on customers like first name, surname and bank balance.  We had to create two classes; a Bank class which stores a name and a list of customers and then a Customer classes which stored the first name, surname and bank balance.  These are two separate python files.  To put these together we must create a separate python file which imports both the Bank and Customer files or classes.  We have now created a simple Bank application which allows you to add customers to the bank.

 

Believe it or not….that was the ‘easy’ part! 

 

We now had a series of challenges to complete now that this basic application has been created.  We had to create functions to allow a customer to add and withdraw money and find a way to find out a customer’s details when given an account number. 

 

Gareth learning to code | week 5 | Learning to code in Belfast

Help!

 

The big challenge is the ATM application we need to complete for next week.  This is important as the code we write for this will be similar in nature to the project we will be working on for the last couple of weeks of the course.

 

Although I did struggle this week, I am starting to appreciate how everything we learned over the last few weeks ties in together to create these applications.  It is a lot to take it when we just get 2 hours a week.  You do need to make time to go over the notes in your spare time.  I also found a good channel on YouTube called The Net Ninja that breaks down the basics of Python.

 

The mentors were excellent again this week and they do take the time to ensure that no one gets left behind.  Hopefully, I can make some headway on the challenge in time for week 6!

 

Week 6 & 7

 

The Learn To Code course is nearly over – hard to believe!

 

The past seven weeks have flown by and the guys have managed to pack a lot of material into those short weeks.  So much, that we took the class in week six to recap on a lot of the stuff we had learned.  Kris and Ryan were away in London for work, so Phil went through some challenges to see what we had learned.

 

Personally, I really needed a week to take stock and go through previous lessons and challenges.  With work commitments along with a hectic social life, it can be difficult finding time to go over things.  If you are considering doing a similar course in the future, I would recommend spending an hour or so most evenings going through the lesson notes and setting yourself challenges so that you can really embed what you have learned.

 

There is a wealth of material online from tutorials to unique problems and solutions.  It would also be a good idea to purchase a book to help you.  If I was able to go back to week one, I think I would buy python for dummies!

 

Think it would be a fitting match for me.

In the Learn to code course we covered more in 8 weeks than most students would in a year | Belfast

 

At the start of week seven, Ryan explained that we have probably covered more in 8 weeks than most students would over a course of a year.  Of course, they would be covering many more subjects and aspects of software development, but I thought that was an interesting statement.  Again, major kudos to the instructors and mentors who freely give up their time week in and week out.

 

Ryan spent a bit of time recapping Classes to make sure everyone was on the same page but the majority of week seven focused on building a menu system using Python.  This is going to be very important for the project we all must complete so I really need to understand this fully. 

 

We also went through the ‘Try’ and ‘Except’ block which handles exceptions in Python.  The ‘Try’ block allows you to test a block of code for errors then the ‘Except’ block allows you to handle the error.  Again, we needed to be familiar with this concept for the menu system we were about to build.

 

Ryan talked through the solution via a number of slides and then switched off the screen so that we can recreate the menu.

 

I was able to get a general structure in place and then a mentor sat with me and we worked out the more complex parts of the problem.  When I say ‘we’ to be fair the mentor helped a lot here!  I didn’t get away with it either as Ryan spotted this just by looking at the code as he had mentored the mentor in the past. 

 

The fact, I couldn’t explain some of the code didn’t help! 

 

So, my homework is to go and redo the task without relying on the help of a mentor! 

 

Gareth trying to explain the code his mentor help write meme | LearnToCode Belfast

 

Hard but fair.

 

That is all we will be covering regarding Python. 

 

We have learned all we need to for us to complete the project that we will be set over the summer.  Week eight will concentrate on describing the project and what we need to do to complete it.  Kris and Ryan will still make themselves available each Wednesday evening so we can go through any issues we are experiencing.  I have a feeling I will need to make use of their time.

Javascript jobs / vacancies Belfast, Northern Ireland | Coding

Paul McBride will be teaching us a bit about HTML, CSS and JavaScript next week which will be interesting.  Since I have a lot of JavaScript positions that need to be filled, it will be interesting to gain some insight into what a JavaScript Developer actually does.

 

 

Week 8 - to be continued..

 

View all jobs  | WebTalksNI; Career podcast | Connect with Gareth

Comments

Currently there are no comments. Be the first to post one!

Post Comment

*
*
*