Diving Deeper

Makers Week 7: Vanilla JavaScript, Machine Learning, Bots and Goats

Naz M
8 min readApr 30, 2017
Stanley Donwood

Welcome to my blog about learning to code at Makers Academy. If you missed the last post, you can find it here.

Bread

There’s been a spate of bread emojis infesting the March cohort’s slack channel. It’s an epidemic. No-one knows why, how, or where it started, but it doesn’t seem to be showing any signs of slowing down.

I’ll keep you updated if I’m still alive next week.

Vanilla JavaScript

Idea of the week: code is not magic.

The last 7 days have been an exercise in realising that anything is possible — that all these frameworks are just code, with functionality that any developer is capable of replicating if they just invest the time to learn how.

We were challenged to create a single-page note-taking app using only vanilla JavaScript.

Vanilla JavaScript means JavaScript without any frameworks. No jQuery for event-handling, no Jasmine for testing. Hardcore. One member of the cohort mentioned this on Wednesday at Codebar and the other developers didn’t believe her. Rock ’n’ roll.

So, upon implementing our first feature, before writing our first test, we had to write the code to enable us to code the test to test our code.

This seemed daunting, but we quickly realised that it wasn’t as crazy as it seemed. Or maybe it was, and I’m crazy. ZANG. Either way, the code below provided all the testing functionality we needed for the whole week in a slender 20 lines.

the tiniest testing framework in the world

Tomorrow I’m hoping to extract it as a standalone testing library and publish it to NPM (essentially bundler for JavaScript) so that anyone can use it.

Sure there’s a load of sophisticated testing frameworks already out there, but it’ll be a cool exercise in publishing my own work and eventually managing updates etc. Who knows, maybe there’s a demand for something featherweight and easy to learn.

The unexpectedly difficult part of this week was working in a group, especially as last week’s AirBnB project had been such a fun ride. I was put in a group of 5, which was inherently awkward. Four members pair programming and then what?

We devised a solution of having a ‘floater’: a member of the group who floated between the pairs, contributing when extra brain-power was needed and keeping an overview of the project.

Our group was great. We named ourselves ‘the Goats’. This was because our challenge was to make a note taking app, and we envisaged branding our creation as ‘NoteGoat’. Or ‘NoatGote’. Or ‘Noats4Goats’. Or ‘Gotes4Notes’. Or simply ‘Gote’. How about ‘Noat’? Goat.

Before you ask, of course there’s a subreddit for goats.

Despite our initial optimism, managing a group of 5 was hard. I had a couple of pretty frustrating days. Often I was working in a group of 3 (known as ‘mob programming’), and finding that, when not typing, I was either doing all of the talking or none of it. We seemed to be trying to force the driver/navigator style of pair programming with a third member who was all too often sidelined, not wanting to break the flow of the other two and getting left behind. Our floater was sinking.

On reflection, this could have been channelled into more positive energy with a little more mind management. We had a great retro at the end of the week where I felt that we really nailed a lot of the issues and came up with some intelligent solutions for working in groups. It’s worth mentioning the lack of ego everyone here at Makers seems to have. No one was precious about their ideas and we were able to have open, constructive sessions every time we had a stand-up.

a mob of goats

I’m personally going to make an effort to be much more mindful of the rest of the group when mob programming. I’ve also got to start researching things more thoroughly before diving into them with half-baked ideas.

Our stand-in coach on Monday, Mary, gave the brilliant analogy of a monkey repeatedly throwing itself against a glass box, trying to get a banana. If I’d only take a step back and figure out how to make a hammer.

One example was Friday morning when I ‘spiked’ (i.e. didn’t test-drive) a whole load of code to access the Guardian’s API. I’m confident with API’s and felt it could have made the group some quick gains, but my partner and I ended up spending the whole morning trying to debug it. Instead, we should have been assembling our mental toolbox by reading up and writing tests.

NazBot

It’s about time I introduced you to NazBot.

Friday afternoon and Saturday morning were spent creating a Twitter Bot and figuring out how to deploy it to Heroku. It’s a bit different to how I’ve been using Heroku in the past, as a bot doesn’t need a web page, it just needs to do its thing. I found out I had to deploy it as a ‘worker’ (instead of a web app).

I learnt how to create it using the excellent tutorials by Daniel Shiffman, who’s enthusiasm for coding borders on insanity. His YouTube channel ‘The Coding Train’ is a super accessible goldmine. I’ll definitely be plundering it more and more in the future.

Right now NazBot replies, but I’m hoping to use various APIs to make him do cooler stuff over the next few weeks.

Send the guy a tweet if you’re feeling lonely. Lord knows he is. Maybe I’ll find him a wife.

Machine Learning is fun and some people are not

A bunch of us attended an eye-wateringly dull talk on machine learning on Wednesday night. It actually really pissed me off and encapsulated a lot of what I’ve learnt that programming should not be.

It was intimidating, self-congratulatory, and completely inaccessible to the beginner, despite being marketed as an introduction to the topic. I didn’t sense any empathy from the speaker towards his audience. He spent the first 15 minutes essentially bragging.

Still, free pizza.

The talk reminded me of an episode of the CodeNewbie podcast with Sandi Metz. She spoke about how when she knows she’s going to give a talk, she prepares for the amount of time the audience has invested in her. So that if 100 people are going to attend a 1-hour speech, she’ll put in 100 hours of preparation. For her, it’s a matter of respect.

It’s a great attitude to have towards any endeavour in which people are giving up their time for you. Same goes for putting on a gig, hosting a dinner party, and writing a blog. You owe it to your audience.

I’ve been trying dip my toes into the hot bath of machine learning in my own time. The article below is hands-down the best introduction to ML I’ve encountered and does a great job of demystifying some of the core concepts.

Additionally, the aforementioned Daniel Shiffman has some really cool videos on evolutionary algorithms, in which the kind-of-incredible website Boxcar2d was mentioned.

It randomly generates cars over and over with a random body shape and a random number of wheels. The most successful ones get to pass on their data to the next generations and the program figures out a way to build something that works all by itself.

I find the topic absolutely fascinating and cannot wait to stick my face deeper into the evolutionary pie.

Relaxation

For those who aren’t familiar with Information is Beautiful, it pretty much does what it says on the tin: delicious dataviz on a huge range of topics (if you have any geek friends with upcoming birthdays, their books are beautiful).

I was browsing through their posts on gender yesterday and learnt some stuff:

  • Social networking sites have 99million more monthly female visitors.
  • Pinterest have 44% female employees (not at all bad in the context of the tech world), but their audience is 72% female.
  • Reddit is a 74% male sausage party.

Few shout outs to my homies:

You might have noticed I changed my profile icon. It was taken on one of those original grey Gameboys by one of the members of my cohort at Makers. He’s secretly a superstar photographer alias ‘The Gameboy Cameraman’. Check out his Instagram below.

Finally, fellow maker Alice Cheung wrote a great post last week about her experiences of the intro to JavaScript and AirBnB weeks, and Man Vs Code (Nick Rupp) is still churning out the best metaphors on Medium on a daily basis.

Stuff I learnt:

  • Managing larger teams is harder.
  • Strategies to deal with big groups.
  • Building a single-page web app in JavaScript.
  • More sophisticated ways of using APIs.
  • How to create a bot and deploy it on Heroku.
  • How not to give a presentation.

Stuff that hasn’t clicked yet:

  • The asynchronous nature of JavaScript has been giving me headaches when making API calls.
  • I still need to consolidate our conclusions about working in larger groups.
  • More time spent playing with evolutionary algorithms

TODAY’S JAM

I just love this so much it’s all so weird and beautiful.

If you read past the tapir, chances are you read the whole thing. If you enjoyed it, please click the little heart below. It’ll help others find this and enjoy it too.

Next post, On Rails

--

--