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

 

 

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 - to be continued...

 

 

 

Comments

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

Post Comment

*
*
*