<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jonathan Hewer on Medium]]></title>
        <description><![CDATA[Stories by Jonathan Hewer on Medium]]></description>
        <link>https://medium.com/@jonhewer?source=rss-3e438b8bcc6b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Jonathan Hewer on Medium</title>
            <link>https://medium.com/@jonhewer?source=rss-3e438b8bcc6b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:15:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jonhewer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Coding dojos]]></title>
            <link>https://medium.com/travelex-digital/coding-dojos-8f2a0ea73004?source=rss-3e438b8bcc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f2a0ea73004</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[engineering-culture]]></category>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Jonathan Hewer]]></dc:creator>
            <pubDate>Mon, 16 Apr 2018 10:16:36 GMT</pubDate>
            <atom:updated>2018-04-16T10:16:36.829Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the things that I love the most about working at Travelex is the culture of continuous improvement, knowledge sharing and learning.</p><p>In addition to <a href="https://blog.travelex.io/my-hack-day-learnings-f9f18fb93018">Hack Days</a>, regular tech talks and this blog, we recently tried our first coding dojo so I thought I’d share a little about how it went.</p><h3>What is a coding dojo?</h3><p>A coding dojo is where a number of engineers come together to collectively solve a programming challenge. The goal is that the participants improve their skills by engaging in deliberate practice — seeking out different experiences to those encountered in your day-to-day work that stretch you and provide feedback. It’s also quite a lot of fun!</p><h3>The format</h3><p>The dojo should last in the region of 2 hours depending on the complexity of the challenge.</p><p>The engineers are grouped into teams of around 4. The leader of the session introduces the challenge to the participants, and provides any necessary tools or materials (e.g. a starter project or language/framework cheat sheets).</p><p>Each team shares a single computer and works on the challenge as follows:</p><ul><li>At any one time, there are two people pairing on the exercise.</li><li>Every 5–7 minutes, the team members rotate by one — one of the pair steps down and one of the other team members takes their place.</li></ul><p>After about about 90 minutes, the teams then share their solutions with each other and then discuss how they compare and what was learnt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fs-ZdIs9AVIr8HD56e_BWA.jpeg" /></figure><h3>The challenge</h3><p>For our first dojo we selected the following challenge, courtesy of <a href="http://codekata.com/">codekata.com</a>:</p><blockquote>Given a file containing one word per line, print out all the combinations of words that are anagrams; each line in the output contains all the words from the input that are anagrams of each other. For example, your program might include in its output:</blockquote><blockquote>kinship pinkish<br>enlist inlets listen silent<br>boaster boaters borates<br>fresher refresh<br>sinks skins<br>knits stink<br>rots sort</blockquote><blockquote>If you run this on the provided <a href="http://codekata.com/data/wordlist.txt">word list</a> you should find 20683 sets of anagrams (a total of 48162 words), including all-time favorites such as</blockquote><blockquote>crepitus cuprites pictures piecrust<br>paste pates peats septa spate tapes tepas<br>punctilio unpolitic<br>sunders undress</blockquote><blockquote>For added programming pleasure, find the longest words that are anagrams, and find the set of anagrams containing the most words (so “parsley players replays sparely” would not win, having only four words in the set).</blockquote><p>We also decided to give each team a new programming language to try out — Scala, Kotlin and Go respectively.</p><h3>The solutions</h3><p><strong>Team Go</strong> got the furthest and completed the main part of the challenge. Unfortunately, they were so excited that their code worked that they forgot about the extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*nmXNoFeJX9hW_OvNHVf36Q.gif" /></figure><p>Their complete solution is as follows:</p><pre>package main</pre><pre>import (<br>    &quot;bufio&quot;<br>    &quot;fmt&quot;<br>    &quot;os&quot;<br>    &quot;sort&quot;<br>    &quot;strings&quot;<br>)</pre><pre>// Sort a string in ascending character order<br>func SortStringByCharacter(s string) string {<br>    rs := []rune(s)<br>    sort.Slice(rs, func(i, j int) bool {<br>        return rs[i] &lt; rs[j]<br>    })<br>    return string(rs)<br>}</pre><pre>// Pretty print a slice of strings<br>func PrintSlice(s []string) string {<br>    return strings.Trim(fmt.Sprint(s), &quot;[]&quot;)<br>}</pre><pre>func main() {<br>    // Open file<br>    fileHandle, err := os.Open(“wordlist.txt”)<br>    if err != nil {<br>        fmt.Println(err.Error())<br>        return<br>    }<br>    defer fileHandle.Close()<br>    fileScanner := bufio.NewScanner(fileHandle)</pre><pre>    // Insert words into map, using the keys to group anagrams<br>    m := make(map[string][]string)for fileScanner.Scan() {<br>        var word = fileScanner.Text()<br>        var sorted = SortStringByCharacter(word)<br>        m[sorted] = append(m[sorted], word)<br>    }</pre><pre>    // Print out anagrams and find longest words<br>    var longest string<br>    var most string<br>    for k, v := range m {<br>        if len(v) &gt; 1 {<br>            fmt.Println(PrintSlice(v))</pre><pre>            // Track whether this is the longest anagram we&#39;ve seen<br>            if len(k) &gt; len(longest) {<br>                longest = k<br>            }</pre><pre>            // Track whether this is the most anagrams we&#39;ve seen<br>            if len(v) &gt; len(m[most]) {<br>                most = k<br>            }<br>        }<br>    }</pre><pre>    fmt.Println(&quot;Longest anagrams: &quot; + PrintSlice(m[longest]))<br>    fmt.Println(&quot;Most anagrams: &quot; + PrintSlice(m[most]))<br>}</pre><p><strong>Team Kotlin</strong> originally took a procedural approach to solving the problem and were minutes away of a working solution. The next day they came up with the following functional approach:</p><pre>fun main(args: Array&lt;String&gt;) {</pre><pre>    val anagrams = File(“wordlist.txt”)<br>        .readLines()<br>        .map {<br>            word -&gt; word to String(word.toCharArray().sortedArray())<br>        }<br>        .groupBy { it.second }<br>        .filter {entry -&gt; entry.value.size &gt; 1 }<br>        .mapValues { pairValue -&gt; pairValue.value.map { it.first } }</pre><pre>    val mostAnagrams = anagrams.entries.reduce {<br>        first, second -&gt;<br>            if (first.value.size &gt; second.value.size) first<br>            else second<br>    }</pre><pre>    val longestAnagram = anagrams.entries.reduce {<br>        first, second -&gt;<br>            if (first.key.length &gt; second.key.length) first<br>            else second<br>    }</pre><pre>    anagrams.forEach {<br>        entry -&gt; println(entry.value.joinToString(“, ”))<br>    }</pre><pre>    println(“Most anagrams: ” + mostAnagrams.value<br>        .joinToString(“, “))<br>   <br>    println(“Longest anagrams: ” + longestAnagram.value<br>        .joinToString(“, “))<br>}</pre><p>Lastly, <strong>Team Scala</strong> had a few issues with their development environment and then, being software engineers, thoroughly debated the different approaches they could take. With their approach decided, they were well on their way to solving the problem however needed a bit more time. A solution in Scala is given below:</p><pre>object Anagrams {<br>  def main(args: Array[String]): Unit = {<br>    val wordMap = Source.fromInputStream(<br>      getClass.getResourceAsStream(&quot;/anagrams&quot;))<br>      .getLines().toList<br>      .map(word =&gt; word.toCharArray.sorted.mkString -&gt; word)<br>      .groupBy(_._1)<br>    val anagrams = wordMap mapValues (_.size) filter (_._2 &gt; 1)</pre><pre>    val most = anagrams.maxBy(_._2)<br>    val longest = anagrams<br>      .reduceLeft((x, y) =&gt; if (x._1.length &gt; y._1.length) x else y)<br>    <br>    println(&quot;Anagrams = &quot;)<br>    anagrams.keysIterator<br>      .foreach(anagram =&gt; println(wordMap(anagram) map (_._2)))</pre><pre>    println(&quot;Longest anagrams:&quot; + wordMap(longest._1) map (_._2))<br>    println(&quot;Most anagrams:&quot; + wordMap(most._1) map (_._2))<br>  }<br>}</pre><h3>Lessons learnt</h3><p><strong>Allow plenty of time.</strong> Things take longer when you’re working with engineers who you don’t work with on a regular basis, or if you’re using an unfamiliar language, framework or another engineer’s computer.</p><p><strong>Don’t underestimate the difficulty of the challenge.</strong> Make sure the main part of the challenge is achievable, and provide a few follow up extensions in case the teams finish in good time.</p><p><strong>It’s not a competition. </strong>The purpose is to learn something new, not to see who can get the furthest in the shortest space of time. If there has to be a winner, then it is the team that comes away having learnt the most.</p><p><strong>Preparation is key.</strong> Provide the teams with whatever resources would enable them to get the most from the exercise. Make sure that any tools or development environments are tested and working.</p><p><strong>Use the language in the way it is intended to be used.</strong> The primary insight that came from trying some different languages in this dojo was that you should embrace the different paradigms and features that each language brings. The Kotlin solution was so much more simple and elegant when written using the language’s functional programming constructs.</p><p>Will we run another coding dojo at Travelex? Absolutely! In fact, planning for it is already well under way.</p><h3>Further reading</h3><p>If you’re thinking about running a coding dojo at your company or amongst friends, then the following links may be useful:</p><ul><li><a href="http://codingdojo.org/kata/">codingdojo.org/kata</a></li><li><a href="http://codekata.com/">codekata.com</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f2a0ea73004" width="1" height="1" alt=""><hr><p><a href="https://medium.com/travelex-digital/coding-dojos-8f2a0ea73004">Coding dojos</a> was originally published in <a href="https://medium.com/travelex-digital">Travelex Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>