In my last blog post, I talked about what I was trying to teach at the Uruguayan JSConf - diving in to the statistical side of things. However, mine wasnât the only talk (what a boring conference that wouldâve been!). There were a wide range of talks on the schedule over the couple of days.
I have to say, I was really excited by the whole schedule. Every speaker was amazing, and the variety was really exciting. There were some deep dives into technology, but others that touched on a non-technical subject and began to tease you into how this affects your thinking about JavaScript.Â
There were more talks that I could mention - my mind was overloaded by the end of day one - but Iâve tried to list some of the talks that captured my imagination (and thought would be interested to share) below.
Electron.js (@reverentgeek)
Electron is a framework that creates desktop applications by running an embedded browser. David Neal rightly pointed out the advantages - you get to write your familiar HTML/CSS/JS - and the disadvantages - being forced to write in your familiar HTML/CSS/JS. Electron looks very powerful and very cool, especially because it means that it means that your desktop applications can be written cross-platform. Such successful tools at githubâs text editor Atom have already been written on this and it looks like a cool tool that anyone likely to write desktop apps should add to their arsenal.
Graphical CLIs (@patrickkettner)
Patrick is a Product Manager at Microsoft Edge, but was talking about his experience migrating pet project Modernizr from a web app to a command line app. Not just any command line app, though, one that masquerades as a desktop app, and one that was written in node. Honestly? Iâm very unlikely to ever use this but itâs amazing to see just how prevalent node can be these days.
Cellular Automata (@_Irina)
Irina had an infectious enthusiasm for analysing the complexity that can quickly arrive from very simple rules. The most famous cellular automaton is Conwayâs Game of Life: you put live and dead cells (or koala and turtles) and based on how they appear near each other, they evolve into future generations. Visualising these patterns in JavaScript looks amazing, and made me want think about where else something like this could be relevant.
Debugging with Chrome Debug Tools (@MattZeunert)
Matt gave one of the most practical talks of the weekend. I donât think itâs unfair to say there was a little skepticism going into this talk in the form of âOh, weâre JS developers, we know how to debug.â However, Matt dived down a massive rabbithole to show off a really rich well of tools that many of us didnât know where there. Did you know you could blacklist files from third party libraries? Disable âdebuggerâ commands from the console? Replay history once youâve identified the method that throws the exception? I definitely did not and have a much more cool arsenal of JS debugging techniques now. His demos and tips are on his website here.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
â Live Streamingâ Interactive Chatâ Private Showsâ HD Quality
Anya is LIVE right now
FREE
Free to watch ⢠No registration required ⢠HD streaming
So, I was in Uruguay a little while back. It wasnât particularly high on my to-visit list, but when JSConf accepts your talk around statistics in JavaScript, itâs not the sort of thing you turn down!
I had a great time there, and met a lot of inspirational programmers. Thereâs a lot of stuff that made me excited to play when I got home - though thatâs a topic for another time! Today, I want to run through my talk, which I tried to frame as a âZero to Hero of Statisticsâ for JavaScript programmers. This may not be the most technical or hardcore of talks, but trying to have a good knowledge of statistics is important for developers!
The reason I gave this talk is because thereâs a lot of misunderstanding in the wider community about what statisticians actually do. Fundamentally, they look at data - which is fundamentally any piece of information. That said, the kind of data that capture statisticians attention is data that comes in large amounts. By looking at data that comes in regularly from the same place we can start talking about trends and patterns rather than wondering if an abnormally high amount was a one-off occurrence.
I looked at Montevideo climate data for the talk itself, but this was to add a bit of local flavour. Thereâs probably a lot of data on your project you can - and should! - be analysing. As well as the data that appears functionally in your app (price, object counts, large text ripe for NLP pickings), thereâs also non-functional data such as page load times and performance. Even if youâre unaware of it, there will be something for you to analyse.
Once youâve got a lot of data from the same source, you may be wondering what to do with it? These days, the automated manner of data collection means that thereâs just too much to try and pick through it by hand, which is why we try and summarise our data at a higher level.Â
Averages such as the mean, median and mode give us a sense of where our data is likely to lie, but two data sets having the same average doesnât mean we expect them to behave the same. If we had two sets of page load times such as {100, 100, 100, 100, 100} then the âlocationâ statistic is the same as a set of load times {50, 50, 50, 50, 300} - but the latter clearly represents a different performance profile, suggesting perhaps poor performance when the site is uncached or a particularly poorly performant query. If we rely purely on simply location statistics, we may bury these sorts of discoveries.
This is why we need to start thinking about statistical distributions. These are âshapesâ of graphs that random variables will expose if sampled often enough. These vary from the simple (a coin toss will elicit a graph with two columns of equal size), to the more complex (heights follow a symmetric âbellâ curve) to the downright fancy (wages follow a âParetoâ distribution due to the existence of a minimum wage.)
At this point, weâve descended deeply into the mathematical so itâs right to start thinking about why weâre talking about this again. There are a number of functional use cases in my career where Iâve looked heavily into statistics, including analysing financial stability. However, there have also been more surprising areas where stats played a role:
We reworked some UI âsliderâ inputs to follow distributions instead of linearly increasing, which gave people a more intuitive experience
We could analyse user account ledgers to see whether their first digit violated the expected (logarithmic) distribution and hence suggested higher likelihood of fraud (e.g. caused by people submitting more fraudulent expenses that they would expect to be more uniformly distributed within an order of magnitude)
We were able to create more realistic stubbed network data to ensure performance tests worked as expected
I went deeper in my talk to look into how we can actually accomplish a lot of this in the browser with JavaScript - and there are a great range of libraries including D3, Chart.js and jStat that allow users access to play with these ideas fastly and easily. So, break out those data sets and see what you can find!
A long time ago, I got a message from one of our clients asking if I wanted to go to the Mastercard hackathon: I definitely did, and it finally happened last weekend.
Hackathons are times where people from all across the development life cycle get together to make something solving a problem. The catch? It's in 24 hours. I really enjoy coding and getting something in your hands at the end of it. Hackathons are also a great place to learn loads of different skills (coding, and otherwise) from the wide range of people that attend.
Despite grand plans from a lot of people, we ended up with a target crack team of 2 people. We were challenged to make the day-to-day lives of London Mastercard easier by integrating with a combination of the TfL and Mastercard developer APIs. These are sources of some really interesting data and abilities - letting you plan routes, see the city and make payments with vendors.
24 hours is not a lot of time, and so we set to work straight away on working out what to build. We settled fairly early on using Mastercard's loyalty offers API, allowing us access to personalised offers of the user that will use the app. All too often, people get these offers but don't take advantage of them. A higher take-up rate on these offers will benefit both Mastercard and the end-user. The user gets savings, and Mastercard get people using these offers and - in turn - spending more on their card. Win-win.
We used TfL's journey planner app to help users plan their journey and get advice as to the best route from A to B in London. However, when users change lines or transport routes at various stations, we looked out for opportunities for users to stop off if they had things to do at these interchange points. We went further and advised people how much would be added to their journey if they went out of their way to tick items off their to-do list. If it's only 10 minutes, then why not make the extra hop and avoid a 2-hour round trip at the weekend?
In terms of the technical nature, we decided to write the application in NodeJS, serving a web interface written using KnockoutJS and Bootstrap. It was the technical framework with which we had the most experience - and with only two of us we were working solidly throughout the 24 hours as it was! When we added persistence, I got the chance to play with a new tech I'd been meaning to checkout - Firebase, Google's distributed Database as a Service platform. It's lightweight but first to set up and was perfect for our needs!
We were happy with our end product - an MVP and even some of the nice-to-have features that were a pipedream just 24 hours earlier!
Other applications including a gamified social-media charity app ("Give to charity or I'll shame you on Facebook"), an app that encourages you to walk by secretly saving the money you would've spent on your train fare and eventual winners "All of Us," - a Night Out as a Service application, that integrates events, journey and tabs across a range friends.
Our product actually came second in the end - which we were happy about (not least because of the $1,000 prize!), but the whole weekend was amazing to learn a lot about APIs and other developers' mindsets. The clarity of the idea was praised. We're proud of what we made. We're going to give the app a bit of distance for a week or so, but we're excited about the potential of it - we even used it to plan our journey from the venue back home!
A little while back, I was in charge of training our new batch of software developers. Our company takes graduates that may have had little to no coding experience and aims to get them productive as soon as possible. Although we have real-world projects for them to contribute to as they learn, many of them benefit from introduction to theory that they may lack from a formal coding or computer science education.
When I introduced such concepts, I did so in two ways - firstly, through a presentation, discussion or live-coding example. But, more importantly, I had to allow them space to play with and make mistakes with the new ideas, languages and frameworks with support and direction - and thatâs where the coding challenges come in to play.
Hereâs what I considered when designing such training challenges.
What am I trying to teach?
The main reason I set training exercises was to isolate the one item I wanted the trainees to focus on. Every other aspect of the challenge should be something they are already familiar with, or otherwise given to them so they donât get distracted. This is true both during their coding and during the feedback you give them during and after.
For example, if you are teaching JavaScript, then donât fuss over perfect styling. And if you are setting a styling challenge, then donât require knowledge of JavaScript to fulfil it.
Itâs the single responsibility principle for challenges.
There has to be enough support to make progress and learn.
When you first start to learn coding, it can be frustrating, because of the high barrier to entry. You need to know a lot of boilerplate and syntax before you can start making good on the promises to make something impressive and interactive.
Coding challenges need to be interesting and compelling, but take users across stepping stones to ensure they are always aware of what to do next. The first few steps should involve understanding and manipulating existing code, and slowly the scaffolding should fall away to give coders more control and flexibility over what they do.
There has to be enough room to experiment and fail.
Despite the support and scaffolding providing a trail through the problem, there has to be enough breathing room to learn.
You donât learn by ruthlessly copying, and though some people take to concepts like a duck to water, more frequently people may know what theyâre using without knowing why theyâre doing it. One of the best ways of showing a coder why a concept is helpful is to let them realise their own mistakes - and a challenge too simple or too guided creates a superficial knowledge of the topic, rather than an appreciation of the meat of it.
One of the concepts I aimed to teach the new starters is browser-side interaction, and I did this by challenging the graduates to make a game. They already had cursory JavaScript knowledge, but this challenge was designed to start introducing modular JavaScript through RequireJS. Free free to use the challenge (PDF version here) for your purposes.