My 10 Favourite Blogposts of 2016

goodbye-2016

I think that most people would agree that we are all happy to see the back of 2016…

Good Morning People!

I hope that you all had a very safe, fun and fulfilling Christmas! I just wanted to say a massive thank you to all you guys that have read, shared, retweeted and liked my blog. This is my 30th blogpost and my blog has been read by people in over 40 countries – its amazing and I really appreciate all the love and support!

I just wanted to leave you with my 10 favourite blogposts so far. Most of these blogposts struck a cord with you guys and I also despite the down days enjoyed writing them! As always, thank you for journeying with me as I get into the world of tech and self-development and please share this post far and wide and hopefully it can help someone else!

1) The Simple Idea That Helped Me Learn To Code Better 

My most popular post to date – I’m so happy it could help people!

2) It’s Good To Dream…

Given the current social climate right now, we must still believe that things can get better and everyone can get a fair shake in life. Glad it resonated with people…

3) The One Hour Study Method That Drastically Improved My Coding

4) Book review of “The Dip” by Seth Godin

An absolutely brilliant book by Seth Godin and I talk about “The Dip” a lot in my blog – a game changer!

5) BOOK REVIEW of “The Slight Edge”

For me, this is the greatest Personal Development book I’ve ever read and started me on my new coding journey! Please read!

6) 3 Subjects You Hated In School But Will Make You A Better Person. Period.

7) Techdegree Journal 5: How JavaScript Functions Are Like the Marvel Cinematic Universe

I’m really proud of this blogpost. I was very shy of writing a ‘technical’ blogpost as I am still learning the ropes but the support I got really gave me the confidence that I wasn’t writing gobbledegook – cheers!

8) Book Review “Show Your Work”  by Austin Kleon

This book inspired me to write this blog. Another life changing book – a must read!

9) Code like A Rockstar: How Programming A Website Is Like Producing A Killer Song

I am a music teacher by trade so as I was learning to code, I started seeing a similar pattern when I created a professional quality song to writing a successful program. Any guys that are interested in music production, this blog will give you an insight of what happens in a music studio.

10) How To Stay Motivated When Coding Gets Hard

This is how I handle my ‘Dip’

If you have any questions or you wanna say something, please leave your comments below or tweet at me @karlwebdev.

Well this is the last blogpost of 2016! Have a great NYE and see you next year!

I am taking a short break so I will be back on Thursday 12th January!

Take Care!

Karlwebdev

Advertisements

4 Ways That Blogging Will Help You Code Better

Reading time: 4 minutes
shakespeare-blog

“A blog by any other name is still a blog”

Good Afternoon People!
I hope that this blogpost finds you well! Phew! It’s been 18 months since I took the ‘red pill’ and jumped into the world of programming and 6 months since I started to blog my journey!
Before I forget, I just want to say a massive thank you to everyone that has read my blog, retweeted, commented and if I was lucky, subscribed to the blog. Blogging has been real adventure, fun most of the time but sometimes scary, but your comments, tweets and feedback have given me the strength to pull up my socks and keep moving!
Here are 4 ways that blogging has helped me become a better developer:

1) Blogging forces you to teach what you know – which helps you teach yourself

There have been many times where I thought that I knew a coding concept well – in fact I was so confident that I would try to write a blog post about it. Piece of cake right? Not. On. Your. Life. Technical blogs for me have been been the most difficult to write and have often had me tagging on my invisible hair.
Technical blogs have often done 2 things to me:
A) Expose the gaps in my knowledge – More often than not, in the process of writing, I find that there are things that I didn’t quite understand and it exposes my assumptions around the subject. Writing forces me to break things down into small understandable chunks to explain to the reader – which in turn helps cement the concept in my head. This has done wonders for confidence and self esteem.
B) Research – This forced me to read up on the things that I didn’t know and track down the answers that I sought. This sharpened my fact finding skills and introduced me to resources like Stack Overflow and the Mozilla Developer Network (MDN) which has helped me massively.

2) Blogging keeps you disciplined

People say that learning to code is like a marathon, but I disagree – marathons are boring. I would it’s more like the Tough Mudder – it will sometimes bring you to you knees and you will have to get your hands dirty!
I have written many times how in the beginning, coding seemed so easy but then I went into ‘The Dip’ and I went through the same process as blogging. Although it was easy in the beginning, there have been times where I got frustrated, was tired and wanted to give up. But blogging keep me honest. Delivering a post every week helped me develop patience and perseverance to keep on going. Writing about my struggles and connecting with other helped me to learn that these feelings were normal and keep me going. Willpower is like a ‘muscle’ that you can work on to make stronger – blogging has definitely helped work it out and this has helped me stay focused in my coding journey.

3) Blogging helps you make connections

Not all of my blogs have been about tech and I have spoken bout a range of subjects from my childhood, teaching and wider culture.

Through my adventures in social media, I have spoken with many interesting people and if they were discussing a topic that I was passionate about, I would point them to one of my blogposts and would use it a springboard for further discussion – this helped me foster deeper connections than I would get just typing 140 characters!

At an event a while back, I spoke to a tech recruiter about my career change plans and she helpfully suggested that I blog about tech because

a) It will show that you have interest in the subject

b) Your blog can be evidence of your learning and can help you eventually get jobs in the field.

The recruiter then said something that blew my mind away – She said that:

“blogs are the new CVs as rather than get a bland two page document listing your grades, your blog will tell what projects that you are working on, what are you truly passionate about and what you personality is like. Basically your blog will tell me whether you will fit in our organisation”

Wow. Your blog can help you land a job before you even send an application.

4) Blogging teaches you to give back

Huh? But you have just started I hear you cry! what can I possibly give? Well a lot actually. As a teacher, sometimes I will be teaching a large class of students who are not getting the concept that I am trying to teach them. Nothing that I explain is working. But just when I want to give up, a plucky young student will stand up and explain it to the class in terms that only they will understand and voila! The whole class is cooking with gas.

Never underestimate the power of peer-to-peer learning.

Also I wouldn’t be pursuing this dream if it wasn’t for all the teachers, volunteers and mentors who took the time to help me on my way. Don’t wait to be Mark Zuckerberg: start sharing what you know because the way that may explain it could help more people than you realise!

Thank you for reading and as always leave your comments below or tweet me @karlwebdev to let me know what you think!

This is the last blog before Christmas so thank you for reading and please have a very cheerful, relaxing and merry Christmas!

I have one more blog to drop before 2017 meet me here next Thursday!

Sayonara

Karlwebdev

 

 

 

Is Mark Carney Right?

Reading time: 7 mins

carney-portrait

Introduction

The Governor of The Bank of England, Mark Carney claimed that up to 15 million jobs in the UK (which is just under half the UK workforce at the time of writing) will be replaced by machines in the coming decades. And it’s not just the menial, low skilled jobs either. Carney warned that “safe”, well paying jobs like accountants, auditors, copywriters and salespeople could all go as well.

Although some believed that his views were ‘alarmist’ and ‘extreme’, I wrote a blog post a while ago saying that the 40-40 plan (40 hours a week, for 40 years) had vanished and was not coming back.

The major anti-establishment backlash that we saw in the Brexit vote and the shock 2016 US Election victory of Donald Trump were as research shown were made caused by disenfranchised workers, who made have lost livelihoods to machines and companies taking their jobs overseas.

But this is not something that any leader or politician can fix nor turn back the clock. As Mark Carney said… we are living through technologically and economically a massive time in human history and our old way of thinking just won’t cut it. The genie’s out of the bottle Aladdin and it won’t go back in.

I have discussed these themes before but with this blog post I wanted to make it more personal. I have personally seen what technology can do to a whole industry… Let’s talk about music…

CDs

A month ago, my wife and I went to watch the fantastic Jazz Saxophonist Soweto Kinch at the Roundhouse for his new album launch – seriously guys check him out!

As were waiting in line, this young, very eager guy approached us telling us to buy his new album on special offer for only £5. He spoke about the production, his dreams, the artwork and everything in between without catching a breath. When he finally stopped, I told him that I loved every word he said & I would have bought his album but there was major problem:

I don’t have a CD player.

In fact I haven’t bought a physical CD in 5 years. I mainly stream music or watch it on YouTube. But what made me sad was his reaction to what I said – rather than understand my point, he took it as an excuse and personal insult from me not buying his music. This guy did not realise that the music industry has moved on and he didn’t want to go with it.

When I got into the music industry in the mid 90s (I know I’m old right?!?), cassette tapes and CDs were still the rage and if people wanted to know what the hottest tunes were, they would listen to DJs like John Peel and Trevor Nelson and watch programs like Top of The Pops and CD:UK. To buy an albums, you had to physically go to the shops, listen to the album of your choice and then pay anything from £10 – £30 (especially if the album was an import!) To listen to our CD, we would use a portable CD player called a ‘Discman’ which was huge! When you clipped it on your jeans it was like having a small dinner plate stuck to your hip – but it was cool!

eminem-discman

Even Eminem can’t make discman’s look cool!

Record labels because they relied mainly on physical sales, had a lot more money to throw around and could afford to take more risks on up coming talent and give them “development deals” – where they would help them develop their artistry. It wasn’t perfect but it was easily understood…

But as the Internet Age came so did file sharing services like Napster and LimeWire, then platforms like iTunes and YouTube – and when Steve Jobs created the iPod and said those legendary words “it’s like having 1000 songs in your pocket”, it was last grenade that blew the Music Industry Business Model wide open and it has never fully recovered ever since.

Internet Killed The Radio Star

A good friend of mine works in a publishing agency, which as a company that collects the ‘royalties’ on behalf of record labels and artists and when we sat down to chat, he told me that “most of these artists that you see on TV don’t actually make a lot of money off their music anymore.” Seeing my puzzled face he said “mate, I am responsible for signing these guys royalty checks off – unless you are Beyoncé or U2 you’re not making big money. The days of living off one album for the rest of your life is dead”.

Whoa. I wasn’t ready to hear that – I spent at the time, the best part of my life preparing to enter the industry, but as the years rolled on, I realised that my friend was right. Labels merged or went under, studios closed and people that were making good livings making and performing music started to lose their jobs. The Titanic sunk. With luck on my side, I got a teaching position in a wonderful music college which I cherish dearly.

But as time went on, something started to worry me. Time and time again, I taught these wonderful young people who with their music, wanted to change the world. Their tunes were brilliant – but they were completely ignorant to how the music industry works and the gigantic changes that were happening. The still believed in “burning their CDs and getting it to the right A&R guy”, totally unaware that social media and YouTube has made the traditional A&R redundant and labels will be more interested in your Twitter following than what instruments you used in your 4 minute masterpiece. Technology has changed the whole game & they didn’t get the memo.

So Was Mark Carney Right?

Is this the end as we know it? No, it won’t hit us like a meteorite – but that’s the point.

In the music industry, these innovations didn’t happen all at once but they rolled at gradually over the years and decades. Likewise we talk about the future like it’s some far away place but it’s here. We have self driving cars and planes, cashless banks, 3D printers, cashier-less shops and Artificial Intelligence becoming more and central to our daily lives. Humans no matter how we measure things, have a very poor relationship with time – we are always on the look at for the for the sudden, explosive changes but more often than not it’s the gradual and slow changes that hurt us the most.

Mark Carney’s words were frank and grave but I feel that they were right. Although technology is a major part of the puzzle, I feel that we have to rethink ALL parts of our culture to face the massive challenges that humans face in the 21st Century.

Thank you for reading! What do you think? Do you think Mark Carney was right or wrong? Leave your comments below or tweet me @karlwebdev.

Thank you for reading and see you next Thursday!

Karlwebdev

 

Techdegree Journal 6: An Easy Way To Remember How Functions, Arguments and Parameters Work Together

love-vs-hate-clinton-vs-trump-4aec5d0779eb57b5a491565e0b25fdf0

Unlike these two, this is the only time an ‘argument’ is good…

Functions

Last week, I spoke about how I was learning how local and function scopes effected functions and how they could be accessed by different parts of the program. But after reflecting and looking through my notes, I realised that I put the “horse before the cart” and should have spoke more about what a function actually does so here goes…

A JavaScript function is a group of statements (lines of code) that when activated, will perform a particular action. In my last blog post, I gave the example of telling my nephew that when I text him from work, that he would need to go to the store and bring me eggs, bacon and milk so that we could have a good breakfast the next morning.

To declare a function, all you need is:
* The keyword ‘function’
* A name goToStore
* A pair of parenthesis ()
* A pair of curly braces which will contain the task that needs to be completed {}

So if I were to write my nephew’s task in pseudo-code, it would look something like this:

function goToStore() {
drive to store;
buy eggs, bacon & milk;
return home;
}

goToStore();

The beautiful thing about functions is that if we can set up a task and when we call it, it will execute the whole thing without me having to write the whole task again. That what keeps the code “DRY”.

The DRY Principle

So I’ve mentioned the term “DRY” in previous posts but what does it actually mean? “DRY” means “Don’t Repeat Yourself” and this basically means that programmers should write the most efficient code possible with the least amount of lines. “DRY” code is:

  • Easier to read by other humans
  • Less bug (error) prone

Along with clear and concise documentation, DRY code makes our life easier!

Arguments and Parameters 

Take a look at this code:

function goToCoffeeShop() {
alert(“Coffee is on the way!”)
}

Now this is similar to the errand that I made my nephew do earlier but this time I asked him to go to the Coffee Shop and grab me a coffee and let me know that it’s coming. That function works perfectly fine but what if instead of a coffee, I wanted some flexibility and wanted to change my drink? Now we would have to do the code to do something slightly different…

function goToCoffeeShop(drink) {
alert(drink + ” is on the way!”)
}
goToCoffeeShop(“Espresso”)

Notice that when I declared (created) the function, the word “drink” is in the first set of parentheses? And when we ‘call’ the function, the word “Espresso” is in the second set? These are examples of parameters and arguments respectively.

In the simplest possible terms, an “argument” is a real value that can be passed to a function that, when the function is called, change the way that the function works.

A “parameter” behaves like a ‘container’ which holds the argument just like a variable will hold a value.

To a novice programmer like me, terms like ‘passing the argument to a function’ were baffling at first and I just couldn’t get my head around it. But being the super creative genius that I am (lol!), I created a mental image that helped me get my head around around it…

Going back to the coffee shop example, I told my nephew that when I contact him, he needs to go the Coffee Shop and grab me a coffee (declaring the function). But while I was at work I had a change of heart and wanted an “Expresso” (the argument). But I need to find a way to pass that information to my nephew.

real-prince-coffee

Sorry I just had to add this in… Too funny!

So after much heavy thinking, I send him a text message with the word “Expresso” – that text message acts as the parameter that ‘holds’ the instruction of what I want. The text message via the phone allows me to pass the instruction to my nephew to change my drinks order, the same way that I can pass a value to a function to change how it works.

Here is another example from my Techdegree:

170-parameter-assistant-2

If only getting your nephew to get things for you on time were this easy…

In this stage of my learning, I find functions fascinating and their applications so useful!
I know that you can only stretch an analogy so far but that mental picture really helped me get a grasp of the concept!

What do you guys think? Is there anything you wish to add? Leave your comments below or tweet at me @karlwebdev.

As always, I really appreciate your time & I will see you next Thursday!

Karlwebdev

Techdegree Journal 5: How JavaScript Functions Are Like the Marvel Cinematic Universe

Reading Time: 5 mins

mcu2

Functions… Assemble!

 

What has the snark of Tony Stark, rage of Bruce banner and the mystery of Black Widow got to do with an object orientated language like JavaScript? A lot more than you think…

As part of studying my FrontEnd Techdegree with Teamtreehouse, I’ve been looking at JavaScript (JS) functions over the last couple of weeks…

Now a ‘function’ is a set of statements (instructions which the browser will follow), which is designed to perform a particular task.

simple-function

The beauty of a function is that once we have written it once, then all we have to do is ‘call’ the function, (activate it by using the function name) and it will do everything that you have to ask it to do without writing it all again which saves tons of time and avoids you repeating yourself loads and loads of time.

simple-call-function

By just typing “sayHello()”, the whole function can executed without typing any additional code…

The best analogy that I can give is sending my nephew to buy groceries: Imagine that my 17 year-old nephew is staying with me over the Summer holidays and before I go to work, I tell him that he will need to buy eggs, bacon and milk from the local supermarket when I text him later in the day. I tell him the directions and how much each item will cost. My nephew memorises the instructions and waits for my text. Later in the day, all I would have to do is send a text saying “buy groceries” and my nephew grudgingly will get up, to the store and get the items that I requested. I wouldn’t have to ring him and repeat all the instructions again and we can enjoy a lovely english breakfast tomorrow morning!

Sweet. All was going well until my Techdegree threw me for a loop with this challenge…

172-lilah-george-lilah

Now this section of code will hen executed, will make the browser pop up either the name ‘Lilah’ or ‘George’ The 1st part of the code is a function that has a variable (which is a container) for the name ‘Lilah’. The next line creates an alert box which will display whatever is in that container (which is ‘Lilah’).

But outside that function we also have a variable called ‘person’ but this one contains the name ‘George’. So pop quiz hotshot, when the code runs, what names will appear and in what order?

You guessed it?

It would be Lilah, George and Lilah and here’s why:

1) “greeting();” jumps into the ‘function greeting’ and looks for the variable inside that function and creates a pop-up bar with the name ‘Lilah’.

2) On the next line, “alert(person)” can’t access that function (I’ll explain later) so it looks elsewhere for “var person” and finds one that contains “George”

3) Repeats Step 1.

It may seem easy now but when I first encountered this problem it was driving me crazy as I couldn’t figure it out. Shouldn’t it be all ‘Lilah’ or all ‘George?’

But Treehouse didn’t leave me hanging as they explained a little thing called ‘JavaScript Scopes’.

JavaScript Scopes

In JavaScript, a scope defines what a variables that you have access to and this has massive effect on how your programs run. They come in 2 basic flavours: The ‘Lilah’ variable is an example of a ‘Local Scope’ and ‘George’ variable is an example of a ‘Global’ scope.

Local Scopes

173-local-function

Variables that created within a JS function, become ‘local’ to that function. What that means is that local scopes can only be accessed within that function – basically a local function lives in it’s own universe as it may. You can only change anything in that function when you jump into that ‘universe’. Because it lives in its own ‘universe’, you can use variables with the same names in different functions.

Global Scopes

174-global-function

A variable declared outside of a function becomes global. That means that all the scripts and functions on a web page can access it. This is a much wider ‘universe’ and many more factors can affect it.

Now there’s a very special condition to this: If within a function, the ‘var’ keyword has not been added to the variable, it automatically becomes ‘global’.

i.e if our function was written like this:

function greeting() {

person = ‘Lilah’;

alert(person);

}

it would no longer be a ‘local’ function and this will completely change the result of our programs.

Anyway back to our example.

It was really tough to get my head around this until I had the genius idea to relate it to movie universes… Now we all know that Spiderman belongs to Marvel Comics which is also the home of The Avengers, Doctor Strange, Ant-Man and Guardians of The Galaxy. But why was it only in 2015, did we see Spiderman join the The Avengers in 2016’s “Captain America: Civil War?”

This was because SONY studios owned the Spidey’s movie rights from 2001 to 2016 when they did a co-licensing deal with Marvel. SONY’s spiderman movies are an example of a ‘local scope’ and the Marvel Cinematic Universe (MCU) is an example of a ‘global scope’.

Local Spiderman

spider-man-trilogy-the-amazing-spider-man-original-imadg7dwcjwhgzgc

Although Spidey operated in New York like The Avengers, he could never rub shoudlers with any of them because they could never step into his ‘world’. Any of Spidey’s city destroying battles did not have an effect on any of the comics nor the MCU films.

Like a local variable, Spiderman could only deal with the characters related directly to him and thus did not have the chance to crossover.

Global Avengers

mcu-time

Whereas like a global variable, the MCU holds most of the film rights to it’s most iconic characters which means they exist in a bigger ‘universe’. The MCU not only ties into the movies, but the TV shows, comics and games meaning that what happens in one medium has a direct effect in what happens in another.

A great example is after The Avengers defeated Loki and his alien army in the first Avengers film in New York, TV shows like ‘Agents of Shield’, ‘Daredevil’ and ‘Luke Cage’ showed the aftermath of the battle and how city was permanently changed.

And to take it even deeper, when Spiderman crossed over into the MCU universe is an example of how when the ‘var’ keyword is not declared in a local function, it can become ‘global’ and be accessed by all. In “Captain America: Civil War”, Spidey was a pivotal player in the battle and was a firm fan favourite!

This is all a bit of fun but it really helped me get my head around scopes and I hope that it helps you too!

What do you think? Can you you think of any better examples? As always, leave your comments below or tweet me @karlwebdev!

See you next Thursday!