Drunken JavaScript

Posted on Wed, 8/2/2017
4 minutes read

This is also posted on Code Koalas's site.

Here in The Crossroads of Kansas City on the first Friday of every month people open their offices and art galleries to show off new art and have a party. It's called First Fridays. Not the most creative name, but at Code Koalas we wanted to do something a little more than just show off art and offer drinks and snacks. Since we're a development company, we figured we should teach people to code. I was the one tasked with figuring out what that would look like and ultimately the one teaching this class every month.

I ended up deciding to teach people JavaScript, but specifically using Canvas to make a ball bounce around the screen. I've already written the blog on the JavaScript teaching I give every First Friday, and I've taught Canvas at Texas Camp. This blog isn't a tutorial for how to write JavaScript, but more about what I've learned and experienced through teaching JavaScript to many people over the year, many of which were quite drunk.

Oh, the people you'll meet

Every First Friday I end up teaching 4-5 40-60 minute classes. Each one has around 5-7 people in it, and I've done it for at least a year. I've taught kids who were 6, and adults in their 40s who have no coding experience. I've also taught people who are JavaScript developers but don't know Canvas, so they still get something out of the class. I've also had people who have had too much to drink and sort of forgot how to type or even use a computer.

Common Errors

After all of the classes I've noticed some patterns of the issues that people seem to have. Not everyone has issues - a lot of people get it right on the first try - but when people get it wrong it's normally the same couple of things every time.

Spelling

Most people, I think even developers, just spell things wrong all the time or make typos. Most the time when someone says something doesn't work the answer is "background" isn't spelled "backgound", or something similar. Camel casing variables are also weird and hard for new people. They don't seem to understand that drawrect,DrawRect,drawRect, and drAwREct aren't actually the same thing. I always explain to people that spelling and capitalization are important, but this is still always where there are issues.

Putting Code in the wrong spot

People putting code in the wrong spot is one I knew would be an issue but it still surprises me how much of an issue is. I explain where we're putting code, including what function and around what line number that should be, but every time someone does it wrong. The best is when someone puts half of the code in one function then the other half in another, I haven't understood the thinking of that one yet. This seems to me to probably be because there's a lot going on and people don't understand how it all works together so don't understand why one line goes one place versus another.

Syntax errors

Syntax errors are almost a daily thing for me at work, whether me just making a mistake by deleting a closing tag on accident or me guessing how code should work so it's not surprising I see this a lot too. This sort of goes with putting code in the wrong spot, sometimes people will write if statements like this:

if (ball.x > c.width {
  ball.speedX = -ball.speedX;
})

If statements seem to be the hardest thing for people as far as syntax errors. Also in objects forgetting to put commas like so:

let ball = {
  color: 'white',
  x: 0
  y: 0
  radius: 10
}

Most of the time I see at least one comma, then they just leave the rest off. The biggest thing, when I actually watch people, is the editor's auto closing tags confuse people. When someone starts an object and they put { and the editor automatically puts } most of the time I see people delete it. Then their object is the whole function and the function never closes. I think for learning using something like notepad might actually be best since the hand holding IDEs do seem to confuse people.

What I've learned

From teaching all of these people, what I've learned the most is to have fun and be patient. People screwing up badly is often funny and perplexing, and it takes a lot of patience to teach a drunk person JavaScript...seriously, go try it! People like to learn new things - I figured this out shortly after graduating. I didn't like school but loved learning new challenging things. I've also learned programming isn't really that hard, and in teaching it I think I have made technology more approachable for people. Knowing how things go together and work is equal parts empowering and terrifying.

Teaching the classes on First Fridays at Code Koalas has been a lot of fun and a great choice. I've learned and grown a lot as a developer, leader and human in doing it - and maybe even am making the world a better place. If you have the chance you should give back and teach a kid or an adult how to do something you're passionate about.