<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ruben</title>
    <description>The latest articles on DEV Community by Ruben (@rgo).</description>
    <link>https://dev.to/rgo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F51796%2F6c7ba744-3ad5-4340-ae51-d5af170ffb08.jpeg</url>
      <title>DEV Community: Ruben</title>
      <link>https://dev.to/rgo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rgo"/>
    <language>en</language>
    <item>
      <title>Getting started with Apple's MapKit JS</title>
      <dc:creator>Ruben</dc:creator>
      <pubDate>Fri, 08 Jun 2018 19:48:15 +0000</pubDate>
      <link>https://dev.to/rgo/getting-started-with-apples-mapkit-js-15b8</link>
      <guid>https://dev.to/rgo/getting-started-with-apples-mapkit-js-15b8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Originally published at &lt;a href="https://blog.rubeng.nl/getting-started-with-apples-mapkit-js/"&gt;blog.rubeng.nl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article mainly explains how to easily get started with MapKit JS. If you already have it set up I'd advise you to check out &lt;a href="https://developer.apple.com/documentation/mapkitjs"&gt;Apple's excellent documentation on MapKitJS&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since I &lt;a href="http://www.idownloadblog.com/2016/04/19/unpublished-apple-maps-api/"&gt;first spotted&lt;/a&gt; Apple Maps on the web I loved it. You could - with a lot of hassle - run it on your own site (it involved proxying Apple endpoints 🧐).&lt;/p&gt;

&lt;p&gt;That's why I was quite happy when Apple announced their official MapKit JS library in beta last week!&lt;/p&gt;

&lt;p&gt;The new MapKit JS library will make adding Apple Maps to your site very easy - so I thought. In &lt;a href=""&gt;their product demo&lt;/a&gt; and on the Developer site Apple shows the following way to add an authentication token (JWT-token) to your embed code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mapkit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;authorizationCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;xhr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/services/jwt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;load&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="nx"&gt;xhr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just to be clear, you'll need to host this &lt;code&gt;/services/jwt/&lt;/code&gt; endpoint yourself. The endpoint should return a signed &lt;a href="https://jwt.io/"&gt;JWT-token&lt;/a&gt; which can then be used to authenticate against Apple endpoints.&lt;/p&gt;

&lt;p&gt;Using this configuration means that every single Map instantiation would cost one call to your own servers before you can initialise the map. Apart from the extra load you'll need to create an (API-)endpoint, configure JWT libraries, etc. Especially for static websites this is quite a problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's the alternative?
&lt;/h3&gt;

&lt;p&gt;Luckily, Apple probably realised this wouldn't work in every situation. So, hidden in the documentation they say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[..]. It can also be run on a development machine to generate a long-lived token to be checked directly into source-code. [...]&lt;br&gt;
&lt;small&gt;&lt;a href="https://developer.apple.com/documentation/mapkitjs/mapkit/2974045-init"&gt;Apple Developer documentation&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This JWT-token can be comitted into source control. No endpoints for JWT-signing required, hurray! Of course these tokens do have an expiry date, you are however free to set this expiry date to 10 years in the future.&lt;/p&gt;

&lt;p&gt;This is exactly what we (I, at least) want. Embedding a token in the code, without extra calls, without extra hassle.&lt;/p&gt;

&lt;p&gt;Also, comitting the token into source code doesn't mean you've lost all control. Using the Apple Developer portal you can revoke the private key you used to generate the JWT.&lt;/p&gt;

&lt;p&gt;We've just gone from the cumbersome authentication flow above to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mapkit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;authorizationCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Insert JWT-token here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But, first we'll need to generate a JWT-token.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you're not familiar with JWT's you might want to read &lt;a href="https://jwt.io/introduction/"&gt;this excellent article by Auth0&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Generating the JWT
&lt;/h3&gt;

&lt;p&gt;Before you can get started we'll need to gather some requirements. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You'll need to &lt;a href="https://help.apple.com/developer-account/#/dev4bb1cc12b"&gt;register a Maps ID&lt;/a&gt;. This is a unique identifier for your Map instance. Apple specifies that you'll want to use one Maps ID per environment (for example development and production).&lt;/li&gt;
&lt;li&gt;In order to sign the JWT's you'll also need &lt;a href="https://help.apple.com/developer-account/#/devcdfbb56a3"&gt;a private key&lt;/a&gt; with MapKit JS services enabled.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After creating a new private key you're provided with a &lt;a href="https://en.wikipedia.org/wiki/PKCS_8"&gt;PKCS #8&lt;/a&gt; private key. The private key does not require a password.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do make sure you save the key somewhere safe, Apple only provides the download once. 🔑&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now that we have all the requirements we're going to need to generate a JWT-token according to the &lt;a href="https://developer.apple.com/documentation/mapkitjs/mapkit/2974045-init"&gt;specifications on Apple's website&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Apple uses the &lt;code&gt;ES256&lt;/code&gt; algorithm using &lt;a href="https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/"&gt;Ecliptic Curve Cryptography&lt;/a&gt; so you'll want to have the JWT &lt;code&gt;algorithm&lt;/code&gt; header set to &lt;code&gt;ES256&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;You'll also need to add &lt;a href="https://help.apple.com/developer-account/#/dev646934554"&gt;your Key ID&lt;/a&gt; to the JWT header, using the &lt;code&gt;kid&lt;/code&gt; parameter. You'll find this ID in the Developer portal where you also created the key.&lt;/p&gt;

&lt;p&gt;And, as JWT specifies, you'll need to add the JWT type to the header. &lt;/p&gt;

&lt;p&gt;Putting it all together your JWT header now looks as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "alg": "ES256",
  "typ": "JWT",
  "kid": "Your Key ID"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next up; the JWT payload. Nothing fancy here.&lt;/p&gt;

&lt;p&gt;Apple specifies that the &lt;code&gt;iss&lt;/code&gt; (issuer) parameter should be set to the Team ID with which you have created the Maps ID &amp;amp; key.&lt;/p&gt;

&lt;p&gt;Apple recommends - but doesn't require - using the &lt;code&gt;origin&lt;/code&gt; parameter as well. You can specify the origin that is allowed to use the MapKit JS code. This can prevent unauthorised use of your token which would count towards your daily limit.&lt;/p&gt;

&lt;p&gt;Also, following JWT's specification you'll need to set the &lt;code&gt;exp&lt;/code&gt; (expiry) and &lt;code&gt;iat&lt;/code&gt; (issued at) parameters. These values are specified in seconds since &lt;a href="https://en.wikipedia.org/wiki/Unix_time"&gt;Epoch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'd advise you to use a long expiry time, once the token expires your map won't load anymore. You can use a value that best suits your needs.&lt;/p&gt;

&lt;p&gt;Our payload is now complete and looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "iss": "Your Team ID",
  "iat": 1528473755323,
  "exp": 1528476433723,
  "origin": "Your origin header" // Recommended, but not required.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Optionally, you can provide an &lt;code&gt;origin&lt;/code&gt; parameter to restrict on which domains the code can be used. This should match the &lt;code&gt;Origin&lt;/code&gt; header passed by your browser.&lt;/p&gt;

&lt;p&gt;The final step is signing the first two parts of the JWT token. As I'm not a cryptography export I won't go into detail on this. There are &lt;a href="https://jwt.io"&gt;loads of libraries&lt;/a&gt; that can do the signing for you.&lt;/p&gt;

&lt;p&gt;The signature is made up of the following parts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ECDSASHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  privateKey
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we put our JWT together we'll get something along the lines of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IllvdXIgS2V5IElEIn0.eyJpc3MiOiJZb3VyIFRlYW0gSUQiLCJpYXQiOjE1MTYyMzkwMjIsImV4cCI6MTUyODQ3NjQzMzcyMywiV2hlbiB5b3UiOiJyZWFkIHRoaXMsIiwieW91IHJlYWxseSB0aG9yb3VnaGx5IjoicmVhZCB5b3VyIGFydGljbGVzLiJ9.yGNubQUo6tzYsArulZgeNZxv7-6anvCC57tfTV0zqK2HN5HbmwLGesIA2nfXktD1UcN3mkGhTaUqxkEnIA5xuQ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now use this token to authenticate the Apple endpoints.&lt;/p&gt;

&lt;h3&gt;
  
  
  An easier way
&lt;/h3&gt;

&lt;p&gt;If you were just looking for a simple Map embed with an API-token this article might have shocked you a bit. Not to worry, there's an easier way.&lt;/p&gt;

&lt;p&gt;I created &lt;a href="https://mapkitjs.rubeng.nl"&gt;a tool&lt;/a&gt; which generates the embed code (and JWT token) for you. You'll still need the requirements as listed above (and on the tool), but the rest is easy as pie.&lt;/p&gt;

&lt;p&gt;You just enter your details and the embed code comes out, easy! Also, your details never leave your browser, so there's no compromise on security. 🔐&lt;/p&gt;

&lt;p&gt;Check it out at &lt;a href="https://mapkitjs.rubeng.nl"&gt;mapkitjs.rubeng.nl&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Issues, compliments, comments? Let me know at &lt;a href="https://twitter.com/rubengmrs"&gt;@rubengmrs&lt;/a&gt; or &lt;a href="//mailto:ruben@rubeng.nl"&gt;ruben@rubeng.nl&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Apple is a registered trademark of Apple, Inc. This article, tool and references are not owned by, or affiliated with, Apple Inc.&lt;/small&gt;&lt;br&gt;&lt;br&gt;
&lt;small&gt;Also, check out &lt;a href="https://blog.rubeng.nl/getting-started-with-apples-mapkit-js/"&gt;blog.rubeng.nl&lt;/a&gt; for my other posts if you haven't already.&lt;/small&gt;&lt;/p&gt;

</description>
      <category>mapkitjs</category>
      <category>javascript</category>
      <category>maps</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Teaching kids how to code</title>
      <dc:creator>Ruben</dc:creator>
      <pubDate>Sat, 28 Jan 2017 18:14:48 +0000</pubDate>
      <link>https://dev.to/rgo/teaching-kids-how-to-code-5cbb</link>
      <guid>https://dev.to/rgo/teaching-kids-how-to-code-5cbb</guid>
      <description>&lt;p&gt;&lt;a href="http://lifehacker.com/how-and-why-to-teach-your-kids-to-code-510588878" rel="noopener noreferrer"&gt;It's&lt;/a&gt; &lt;a href="http://www.apple.com/retail/code/" rel="noopener noreferrer"&gt;a&lt;/a&gt; &lt;a href="https://code.org/" rel="noopener noreferrer"&gt;huge&lt;/a&gt; &lt;a href="https://www.microsoft.com/en-us/education/students/code/default.aspx" rel="noopener noreferrer"&gt;hype&lt;/a&gt; to learn how to code these days. And whilst I don't think that _every_one should learn to code I do think it can help kids to think in a logical fashion.&lt;/p&gt;

&lt;p&gt;That's why when the &lt;a href="http://www.rietveldlyceum.nl/" rel="noopener noreferrer"&gt;Rietveld Lyceum&lt;/a&gt; asked me to give a guest lecture I happily said yes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beforehand
&lt;/h2&gt;

&lt;p&gt;The Rietveld Lyceum organises guest courses of all kinds for their students. The idea is that students can get an idea of the jobs and functions that exist all around them (I really appreciate this). The assortment of lessons is extremely diverse, one can choose to get a ride with an ambulance, learn how to act, how to farm, how to start a business and much much more. The lesson I added was "Programming". I did not yet know the full program for the lessons but I was planning on teaching them how to build a (very) simple website.&lt;/p&gt;

&lt;p&gt;I think the advantage I had with giving this course is that the students chose the subject themselves. If they weren't interested in learning how to code, they wouldn't choose to follow the course.&lt;/p&gt;

&lt;p&gt;The course featured a series of 4 lessons in a row, every Thursday from 14:45 till 16:15. There was room for 15 students.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first lesson
&lt;/h2&gt;

&lt;p&gt;Developing the first lesson was the hardest. I had no clue of the level of the students. I chose to allow any class (VMBO, HAVO, VWO) to apply for the lesson, but I did not know if there would be a difference in programming level (I've seen better MBO programmers than HBO programmers).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The VMBO (voorbereidend middelbaar beroepsonderwijs; literally, "preparatory middle-level applied education") education lasts four years, from the age of twelve to sixteen.[5] It combines vocational training with theoretical education in languages, mathematics, history, arts and sciences.&lt;/p&gt;

&lt;p&gt;Secondary education, which begins at the age of 12 and, as of 2008, is compulsory until the age of 18, is offered at several levels. The two programmes of general education that lead to higher education are HAVO (five years) and VWO (six years). Pupils are enrolled according to their ability, and although VWO is more rigorous, both HAVO and VWO can be characterized as selective types of secondary education.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I decided to let the first lesson be about learning a few basic HTML-tags, playing around with those and some extra material for students who picked up the simple material quicker.&lt;/p&gt;

&lt;p&gt;I first introduced myself, what I was studying, what I was working on (eventually forgot to tell my name) and what we we're going to do during the lessons. I explained that depending on how quickly the material was picked up by the students the course could change over time.&lt;/p&gt;

&lt;p&gt;After introducing myself briefly I started explaining why programming was important. I came up with three reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build anything you want&lt;/li&gt;
&lt;li&gt;Learn to think in a logical fashion&lt;/li&gt;
&lt;li&gt;Many career opportunities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;I know there are many, many more reasons as to why coding is important but have you ever met a student who likes to listen to the teacher rattle on about one subject?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What I found very difficult next was to translate my own knowledge about coding to students who had never programmed in their entire lives.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;How do I style a page? Just add a style-tag, create a class in CSS and append the class to the HTML-tag you want to style. Sorry. What? 🤔&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I wanted to prevent the above from happening.&lt;/p&gt;

&lt;p&gt;So, that's why I explained that HTML is nothing more than a file on your computer (or a server). This way I tried to make the, for the students vague, term "HTML" tangible. I showed an example of a very basic HTML-page and explained that when saving the file with the ".html"-extension you created your very first HTML-file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F11%2FLes-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F11%2FLes-1.png" alt="Teaching kids how to code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, after listing a few basic rules about HTML (closing tags, what tags are, about including the HTML, head and body tag) I decided to throw the students in the deep end.&lt;/p&gt;

&lt;p&gt;I created an empty JSFiddle where the basic rules were stated once again and asked the students to create their first HTML. My goal here was to get the students to interact with the code as soon as possible.&lt;/p&gt;

&lt;p&gt;Of course, I could first talk about each and every HTML-tag, show half a dozen examples and then let them do it themselves. I think what I would have accomplished then was very bored students.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results of the first lesson
&lt;/h2&gt;

&lt;p&gt;You might imagine that there were &lt;strong&gt;a lot&lt;/strong&gt; of questions. And this is what I really, really appreciated. The students were eager to learn how &lt;em&gt;to create the next thing&lt;/em&gt;. Further on during the lesson I explained how to use the heading-tags (h1, h2, h3, etc), how to add text to a page (p-tag), how to add links to a page (href) and how to add images (img-tag) to the page.&lt;/p&gt;

&lt;p&gt;What really struck me was the fact that I started the lesson with students who didn't even know what HTML was in the first place and ended the lesson with students who were Googling their way through new tags and some already started playing around with simple JavaScript-snippets.&lt;/p&gt;

&lt;p&gt;Interested in the presentation of the first lesson? &lt;a href="https://docs.google.com/presentation/d/e/2PACX-1vQtc2DnPdQLN9Iha0a25RqTXhuQLgW6iawlFtcOLNcYWXeDZjDinME1eHH-i952QYtxFo-c-z6tCA7M/pub?start=false&amp;amp;loop=true&amp;amp;delayms=60000&amp;amp;slide=id.p" rel="noopener noreferrer"&gt;View&lt;/a&gt; it here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F11%2FIMG_1752-kopie.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F11%2FIMG_1752-kopie.jpg" alt="Teaching kids how to code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Consecutive lessons
&lt;/h2&gt;

&lt;p&gt;The second lesson started with a short repetition of the first lesson. Though, not in depth. Then, I asked the students to perform a small "test". Six questions about HTML, a few were two examples of HTML-code were shown and the students had to choose between those and a few theoretical questions. All the questions were multiple choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The results:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The average rating was &lt;strong&gt;5/6&lt;/strong&gt; which translates to an &lt;strong&gt;8.3&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The question most people got wrong was a question asking how to make a link open in a new window. (target="_blank").&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reason I took the test was to see if people caught on to the matter. If everyone forgot how to create the page they were (a) not interested or (b) the explanation was lacking.&lt;/p&gt;

&lt;p&gt;Judging the from the results I can say the students &lt;em&gt;did&lt;/em&gt; catch on. The students learned something a week ago, in 1,5 hour and still remember (almost) everything correctly.&lt;/p&gt;

&lt;p&gt;In the third lesson I started with Bootstrap, the eventual goal of the course is to be able to create a simple website. Thus far they were able to create a simple &lt;em&gt;page&lt;/em&gt;, but that's not a &lt;em&gt;website&lt;/em&gt;. I chose Bootstrap because (again) it's accessible. I could have thought them how to use Flexbox but I think that would be very ambitious with 6 hours of hands-on time.&lt;/p&gt;

&lt;p&gt;Using Bootstrap also posed some challenges. The students would have to download the framework to their computers, create an HTML file and then they could use the framework.&lt;br&gt;&lt;br&gt;
For this particular reason I chose to first explain how external CSS could be linked to HTML (&lt;code&gt;&amp;lt;link href="" rel="stylesheet"&amp;gt;&lt;/code&gt;) and then to provide them with a hosted Bootstrap (thanks &lt;a href="https://www.bootstrapcdn.com/" rel="noopener noreferrer"&gt;BootstrapCDN&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;At this time the students were also making the switch from standalone JSFiddle's to using an editor. I chose Atom because the UI is very straightforward and installing it is very easy. Installing on school computers, however, wasn't as easy as I hoped it to be. The computers were so slow that installing Atom would sometimes take up to 10 minutes, or the computer would stop working and a reboot was required. Eventually we did succeed to install it on all the computers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The last lesson
&lt;/h2&gt;

&lt;p&gt;Sooner than I realised the course was already over. In the last lesson I wanted to take an exam, clarify a few things about HTML and learn them how to use the Bootstrap navigation bar.&lt;/p&gt;

&lt;h4&gt;
  
  
  The "exam"
&lt;/h4&gt;

&lt;p&gt;I decided that it would be fun for the students to have a reward for their hard work. That's why I designed an exam for the last lesson.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F12%2FIMG_1857.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2016%2F12%2FIMG_1857.JPG" alt="Teaching kids how to code"&gt;&lt;/a&gt;The exam consisted of 15 questions, the students had 15 minutes for the exam in total and the minimum score was 50%. Also, the exam was designed so that every student got a different exam. To take the exam I used &lt;a href="https://www.classmarker.com/" rel="noopener noreferrer"&gt;ClassMarker&lt;/a&gt;, one of the few exam software which met my requirements. There were ~40 questions, the software picked 15 random questions and presented them to the students. When a student passed the exam they received an e-mail with the score and a certificate. If they failed, they could take the exam again (since the questions would be different &lt;em&gt;and&lt;/em&gt; they could not see the correct answer of questions they made).&lt;/p&gt;

&lt;p&gt;The results of the exam were consistent with what I expected. Some students scored very, very high (💯%) and some a little less. One student failed the first time but passed the second time with a 7.5 (75%). Although I designed the questions so that there was no difference in difficulty level, of course some questions were tougher.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflection
&lt;/h2&gt;

&lt;p&gt;This was my first experience with teaching, ever. Also, it was my first experience ever with explaining HTML from start to end, I've helped other students out but they all already knew the basics. Sometimes it was difficult to talk (and keep talking) in layman's terms.&lt;/p&gt;

&lt;p&gt;I also tried to find a balance between explaining and asking students to Google things themselves. You catch on to the matter way more quickly if you are interacting with it, by Googling your way around for example. But sometimes students would just get stuck, they tried to find a solution and just could not. In that case I was more than happy to explain it again. You do not want to become the teacher who never explains anything.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2017%2F01%2F16122664_1332902800108645_7476974498202255360_n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.rubeng.nl%2Fcontent%2Fimages%2F2017%2F01%2F16122664_1332902800108645_7476974498202255360_n.jpg" alt="Teaching kids how to code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;center&gt;
&lt;em&gt;They exist&lt;/em&gt; 😉&lt;/center&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;p&gt;I designed the course to have a lot of hands-on time, you don't learn to code by watching endlessly at slides from the teacher but by doing and researching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reactions from students
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;I think the explanation was extensive.&amp;gt; Just great! &amp;lt;/answer&amp;gt; ;)&amp;gt; Would be great to have some more lessons so we could end with a real product.&amp;gt; I found it a very enjoyable course, it was well designed and I learned a lot.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Photos published with permission from the students.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Any remarks on this post? Please let me know! Drop me a line at &lt;a href="mailto:ruben@rubeng.nl"&gt;ruben@rubeng.nl&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Special thanks to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.classmarker.com/" rel="noopener noreferrer"&gt;ClassMarker&lt;/a&gt; for letting me use their great exam software 💯&lt;/li&gt;
&lt;li&gt;Afke for the great time 🤘&lt;/li&gt;
&lt;li&gt;The students for their commitment 🏃&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First published at &lt;a href="https://blog.rubeng.nl/teaching-kids-how-to-code/" rel="noopener noreferrer"&gt;blog.rubeng.nl&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
