<?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 Jasper Lyons on Medium]]></title>
        <description><![CDATA[Stories by Jasper Lyons on Medium]]></description>
        <link>https://medium.com/@ioverthoughtthis?source=rss-b7e4861f45ae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Mx6u7hUOLgYzsOjWkSzWcg.jpeg</url>
            <title>Stories by Jasper Lyons on Medium</title>
            <link>https://medium.com/@ioverthoughtthis?source=rss-b7e4861f45ae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:55:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ioverthoughtthis/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[A Lua testing framework in 31 lines]]></title>
            <link>https://medium.com/@ioverthoughtthis/a-lua-testing-framework-in-31-lines-2f6cfd067126?source=rss-b7e4861f45ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f6cfd067126</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[lua]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[luajit]]></category>
            <dc:creator><![CDATA[Jasper Lyons]]></dc:creator>
            <pubDate>Thu, 22 Feb 2018 12:38:01 GMT</pubDate>
            <atom:updated>2018-02-22T13:04:18.843Z</atom:updated>
            <content:encoded><![CDATA[<p>30 lines would have been snazzier but I like blank line separators.</p><p>So, I’m working on a web framework in Lua (yes there are loads but this is a learning exercise). While writing my string templating library I discovered some issues that made me wish I had unit tests. I looked at the existing Lua test frameworks but since this is a learning exercise and <a href="https://en.wikipedia.org/wiki/Not_invented_here">I am feeling allergic to dependencies</a>, I thought Id write my own.</p><p>Turns out it only takes ~ 1 hour to do! I’ll pop the code below and walk through it section by section and then show you how I’ve used it and what it prints out. Sound good? Cool.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/894fcbce70360db34ff21e8d04329278/href">https://medium.com/media/894fcbce70360db34ff21e8d04329278/href</a></iframe><p>Lets break this down.</p><pre>local function describe(name, descriptor)<br>  local errors = {}<br>  local successes = {}</pre><p>Here we’re defining a local function called describe that takes a name and a descriptor . name is just a string that identifies the suite of tests, in my case something like &quot;Parser&quot; . descriptor is a function that the end user will write their tests in! You’ll get to see how this is used later.</p><pre>  function it(spec_line, spec)<br>    local status = xpcall(spec, function (err)<br>      table.insert(<br>        errors,<br>        string.format(&quot;\t%s\n\t\t%s\n&quot;, spec_line, err)<br>      )<br>    end)</pre><p>Next we define another function inside of describe called it . it is hidden to the outside world which means that only things inside of describe can use it. We’re going to use it to allow me to write my individual unit tests.</p><p>it takes a spec_line and a spec . spec_line is just a string that identified the unit test, I might use something like &quot;should return total new lines in a file&quot; as the spec_line. spec is a function within which our unit test will be written!</p><p>Lets focus on the next part a little. <a href="https://www.lua.org/manual/5.3/manual.html#pdf-xpcall">xpcall</a> is a function that takes another function and runs it in “protected mode”. This means that errors that are thrown inside of the function do not kill the program, instead they are passed into a message handler. You see the anonymous function above, the second parameter to xpcall ? That’s our error handler. Inside of that, we capture any errors and table.insert them into our errors table. This means we can capture many errors over a run and print them all out at the end instead of falling over at the first one.</p><p>I’m passing xpcall the spec function to run which means any errors that are thrown in the unit tests are caught and saved in the errors table.</p><pre>    if status then<br>      table.insert(successes, string.format(&quot;\t%s\n&quot;, spec_line))<br>    end<br>  end</pre><p>xpcall returns a “status” that indicates if the function ran without any errors. If it does run without any errors I’m assuming that it was a successful run! So we table.insert it into the successes table. Then we can print all of those out later too.</p><pre>local status = xpcall(descriptor, function (err)<br>  table.insert(errors, err)<br>end, it)</pre><p>So we’re out of the it method now and we’re using xpcall again? This is so that we can catch any errors that occur while setting up our test suite in the descriptor function. We’ll just add that to the list of errors for now but it might be better to just fail everything if the descriptor fails.</p><p>By the way, we’re passing in the it function to the descriptor at the end there. That means the user (I) can access the it function from the first argument passing to my descriptor function. You’ll see this in a bit.</p><pre>  print(name)<br>  if #errors &gt; 0 then<br>    print(&#39;Failures:&#39;)<br>    print(table.concat(errors))<br>  end</pre><pre>  if #successes &gt; 0 then<br>    print(&#39;Successes:&#39;)<br>    print(table.concat(successes))<br>  end<br>end</pre><pre>return describe</pre><p>Finally we’re printing out the errors and successes. We start with the name of the test suite (or descriptor, as I’ve been calling it for some reason). Then we check, “are there any errors?” — if yes print them out! Then we do the same for successes. It ends up looking like this:</p><pre>Test function<br>Failures:<br>  should print out this failure<br>   lspec/spec.lua:5: 1 should equal 2!</pre><pre>Successes:<br>  should print out this success</pre><p>Anyone familiar with unit testing frameworks (me, the end users here) should be able to figure out what this means. “Test function” is the descriptor name, “Failures:” is all the things that went wrong and were they went wrong and “Successes:” is all the things that went right!</p><p>So, here’s how you write tests with this:</p><pre>local describe = require(&#39;lspec&#39;)</pre><pre>describe(&#39;Test function&#39;, function (it)<br>  it(&#39;should print out this failure&#39;, function ()<br>    assert(1 == 2, &#39;1 should equal 2!&#39;)<br>  end)</pre><pre>it(&#39;should print out this failure&#39;, function ()<br>    assert(1 == 2, &#39;1 should equal 2!&#39;)<br>  end)</pre><pre>it(&#39;should print out this success&#39;, function ()<br>    -- test that do nothing succeed<br>  end)<br>end)</pre><p>Yay, rpsec (sort of) in Lua.</p><p>Off to write some unit tests and figure out why this parser keeps breaking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f6cfd067126" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to have an effective debate]]></title>
            <link>https://medium.com/@ioverthoughtthis/how-to-have-an-effective-debate-bb955c2c54fd?source=rss-b7e4861f45ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb955c2c54fd</guid>
            <category><![CDATA[discussion]]></category>
            <category><![CDATA[debate]]></category>
            <category><![CDATA[conversations]]></category>
            <category><![CDATA[effective]]></category>
            <dc:creator><![CDATA[Jasper Lyons]]></dc:creator>
            <pubDate>Sat, 17 Feb 2018 16:19:09 GMT</pubDate>
            <atom:updated>2018-02-17T16:40:54.459Z</atom:updated>
            <content:encoded><![CDATA[<p>I used to co-run a discussion group focused on liberal politics. We’d meet up in a dark corner of a pub in South West London and spend many hours drinking and discussing our views (loudly). As the years passed by I started to notice that, no matter the strength of anyone’s argument, few of them were very useful beyond proving who was the better orator. The only time people changed their minds about views were in two situations:</p><ol><li>They had internal reasons attached to their internal identity, not as a result of an argument.</li><li>They felt safe in changing their mind about a view. That doing so wouldn’t effect their own or other people’s perception of themselves in a way that conflicted with their identity.</li></ol><p>The latter rarely happened and it was frustrating.</p><p>More often than not the participants of debates are attempting to change the others mind, either for personal gratification or because they truly believe in their arguments. The reason they are ineffective is because their minds are rarely changed. If anything <a href="http://www.dartmouth.edu/~nyhan/nyhan-reifler.pdf">they are left cemented even harder into their currently held views.</a></p><p>Changing people’s minds is hard because ultimately, unless they want to change, there is nothing you can do. An effective debate or discussion is one in which your make some headway towards your intended outcomes. You might not fully achieve those goals but at the very least you don’t make things worse.</p><p>To that end, here’s a guide to having an effective debate.</p><h3>Before you start</h3><p>Often discussions happen suddenly. While not every discussion needs to be effective, if you want this one to be you’re going to need to stop. Hold back on diving into your “why I am right” monologue and instead give yourself some time to think, clarify your goals and ask some questions of yourself and the people you are talking with.</p><h4>What is your purpose for this discussion?</h4><p>Ask yourself, why are you about to launch into this discussion? What are you hoping to get out of it? At the end, what would you like the world to look like? Being honest with yourself is hard but you’ll need to be to start having effective debates.</p><p>Here’s a list of outcomes I usually look for from a debate:</p><ul><li>To clarify, refine, and possibly substantially alter my ideas.</li><li>To persuade those with a different opinion.</li><li>To educate third parties watching the debate.</li><li>To improve my ability to defend my position by exploring possible counter-arguments.</li></ul><p>Ideally, pick one. Having to try and balance between the need to persuade someone of your idea while also educating an audience is hard and will hinder you. Just have two separate discussions instead.</p><h4>What is your partners purpose?</h4><p>Now you know what you would like to achieve from the conversation, let your partners know and get buy-in from them! A conversation is like a ship, if you don’t have a destination in mind you’re going to be left adrift.</p><h4>Are your partners willing to change their mind?</h4><p>Don’t waste your own time. If a person isn’t even willing to conceive of a world where they would believe something different to what they do now, stop trying. Convincing people of your idea often has nothing to do with logical arguments.</p><p>My favorite question to ask in this setting is:</p><blockquote>What would have to be true for you to change your mind?</blockquote><p>It’s a trick I borrowed from watching my ex-business partner sell. If you can show those things to be true and they have admitted they are willing to change their minds then you know what you need to convince them of to achieve your goals. You can’t actually change anyone’s mind, you can only help them change their own mind.</p><p>It’s also a great way to learn about the assumptions that underpin your partners arguments.</p><h4>Are you willing to change your mind?</h4><p>If you’re not going to be open minded about your own opinion you should let yourself and your opponent know. Give them the opportunity to walk away without wasting their time on an impossible task, especially if they have indicated that their goal is to change your mind.</p><p>Have respect for other people’s time and energy. Debates, especially heated ones, can be taxing.</p><h3>During the debate</h3><p>So now you have a clear goal, you’re aware that all of you are willing to have your minds opened and you’ve identified the things that need to be discussed. It’s time to do some discussing!</p><p>Here’s some simple ideas you can apply to your discussions that will help you make a lot more headway:</p><h4>As complex terms come up, stop and agree upon a definition or change the words you use for a concept.</h4><p>So often I’ve got stuck in heated discussions with people only to later realize that we are talking past each other. The problem was that we didn’t have the same meaning for the words we used (my favorite of these is “capitalism”).</p><p>Whenever you start to use a complex word, don’t assume that you both share the same understanding. Also don’t staunchly stand by the dictionary definition, come to an agreement about what the word means and if it not longer embodies what you need it to embody, agree on a different word.</p><h4>Actively listen to your opponent</h4><p><a href="https://www.mindtools.com/CommSkll/ActiveListening.htm">Active listening</a> is a whole thing in and of itself but it is definitely a tool that you can use effectively in a debate. The gist of it is:</p><ul><li>Pay attention, don’t simply wait to say the argument you have in mind, put it aside and swill the words the other person is saying around inside your mind.</li><li>Show you’re listening, use your posture, facial expressions and other body languages to tell the other person “I am engaged”. (This isn’t very useful for internet debates!).</li><li>Feedback on the things you hear, my favorite way is to simply attempt to explain what the other person is saying back to them .e.g “So your argument is X”. They can then check that I have fully understood, you get to show that you’re engaged.</li><li>Ask questions. I like to pair this with the previous point e.g. “So your argument is X, how to you respond to Y?”. This is a great way to not only show you’re engaging but to also test their arguments.</li></ul><h4>Assume good faith</h4><p>By which I mean, make the most respectful interpretation of the other person’s perspective. Perhaps you’ve heard of<a href="https://en.wikipedia.org/wiki/Hanlon%27s_razor"> Hanlon’s Razor?</a> Well this is it! By taking the most respectful interpretation you get to avoid one of the biggest fallacies you can fall into:<a href="https://en.wikipedia.org/wiki/Straw_man"> The straw man fallacy</a>.</p><p>The further you drag an opponent’s argument to logical extremes, the less you are actually arguing about the topic at hand. You might be able to “win” in this way but it is intellectually dishonest and ultimately will not help you in achieving the goal you initially set out to achieve.</p><p>Unless your goal was to “win”, in which case fair enough but I rarely find winning a debate to effective in any real world outcomes.</p><h4>Verbally acknowledge what you agree with and what you have learned from your partner.</h4><p>You need to communicate when you receive new information that adds to, or changes your understanding of the topic under discussion. Doing so helps in 2 ways:</p><ul><li>It builds trust, trust that you are in this debate with an open mind.</li><li>It makes your opponent feel better about doing the same. You’re setting an example, leading them into a place where everyone can be vulnerable. It’s only when we are vulnerable, that our egos and identities are set aside that ideas can truly succeed.</li></ul><h4>Ideas must gain their validity from first principles / empiricism, they can’t be true just because an authority said them.</h4><p>Nothing is true just because someone, or any number of people, said it. This is a simple trick to avoid falling into a second popular fallacy:<a href="https://en.wikipedia.org/wiki/Argument_from_authority"> Argument from authority</a>. That said, if you and your partners lack the ability to evaluate the evidence available then you often have a choice, incorporate the analysis of an “authority” on the subject or ignore the data available.</p><h4>Be ruthlessly honest about your position, including your weaknesses and your partners strengths.</h4><p>This is one of my favorites. If your debate is going to be effective, if you are going to achieve the goals you set out earlier you have to be honest with yourself, and your opponent.</p><p>Not only that though, you need to communicate that honesty. This is another way of making yourself vulnerable, of setting aside your ego and identity and trying to work with the ideas at hand. The great thing about making yourself vulnerable is, it make other people more willing to open up too!</p><p>A great question I was asked as I put this post together is “How do you do this?”. My approach is to use words to the effect of “Honestly, I’m struggling to understand/accept this concept. Perhaps we could circle back around to this later?”.</p><p>The end result of that is that you can all decide, genuinely, on how you feel about the ideas and beliefs under discussion. Not only might you achieve your end goal but you might learn something too.</p><h3>After the debate</h3><p>Something a lot of people fail to do is to reflect on their discussions. This is probably because after you’ve had a heated debate where no one listens to each other and you simply waiting, on the edge of your seat to shout the idea that last came into your head in a belittling attempt to “win”… Well I’d be pissed off with you too.</p><p>Provided you and your opponents have managed to keep things civil and friendly it is exceptionally useful to ask: “Did we achieve what we set out to achieve?”.</p><p>If you did, awesome! Why? This is an opportunity for you to learn more about how your communication strategy, the environment or the other person’s situation affects your ability to achieve your goals.</p><p>If you didn’t, why? Again this is an opportunity to learn about how to get better at achieving your goals.</p><h3>Final points</h3><p>Don’t get better at winning battles, get better at picking battles you can win. I find this translates into:</p><ul><li>Finding people who can change their minds is more important than trying to change people’s minds.</li><li>Finding customers who need your products and services is more important than trying to convince customer they need your product.</li></ul><p>Remember though, not every discussion needs to be “effective”!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb955c2c54fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>