<?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 Simon Janes on Medium]]></title>
        <description><![CDATA[Stories by Simon Janes on Medium]]></description>
        <link>https://medium.com/@simon.janes?source=rss-9299d27a7a04------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DmpCKtieUtiGPDyq8vIFgw.jpeg</url>
            <title>Stories by Simon Janes on Medium</title>
            <link>https://medium.com/@simon.janes?source=rss-9299d27a7a04------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 02:30:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@simon.janes/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[Type-checking, linting, formatting: Gates of Power]]></title>
            <link>https://medium.com/the-accepted-forest/making-your-life-unpleasant-for-gain-and-profit-834ab18cf00a?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/834ab18cf00a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[tslint]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Fri, 17 Aug 2018 14:54:32 GMT</pubDate>
            <atom:updated>2018-08-20T13:21:41.275Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-lip49A_DUn3WwNpHhljRw.jpeg" /></figure><p>Writing software systems is a complicated dance between the product owner, the ecosystem of tools and services, and your ability to learn and solve problems. You could make a checklist of all the things you wish were true about the quality of your code, but you would never actually spend the time evaluating it mentally — you need all the “bandwidth” you can get from your mind just for solving the problem.</p><p>Automation of your pain here is perhaps masochistic (or sadistic if you’re a particularly good at designing continuous integration pipelines!) but the consistency of having problems do your checklists for you — consistently — ratchets up your system-quality.</p><blockquote>Do things the hard way in practice,<br>Do things the easy way in crisis. But…<br>THERE IS ALWAYS CRISIS. <br>Therefore, always do it the hard way.</blockquote><p>Today we’re going to explore this idea with Microsoft’s TypeScript. TypeScript is identical to JavaScript and will happily treat it just like that.</p><h4>Type-checking (what the data means)</h4><p>All the types for data and function interfaces will be inferred for you, but you should start habitually annotating. When you skip annotations TypeScript assumes the type any. If you receive a value of type any you have to then make decisions at run-time what you have to do.</p><p>Rapid prototyping can get away for a while with using any as a type, but as you understand your problems you should move away from any as soon as possible. This gives your compiler an explicit idea how to check your code for semantic mistakes — passing in a number when a function only works with strings. Or, even worse, passing in a filename (represented by a string) when you wanted an HTML template fragment (also… representable by a string). Take the primitives of the language and package them up with some semantics. Type aliases are good for this.</p><pre>type Filename = string<br>type HtmlTemplate = string</pre><pre>function fileFrobber(name: Filename) { ... }<br>function templateFrobber(template: HtmlTemplate) { ... }</pre><p>Fully-annotated code moves all of the run-time behavior checks into development — and your code gets <em>faster</em> and <em>more-reliable.</em> What’s not to like?</p><p>Oh, the pain of type-checking. Keep doing it, and you get better and the feedback from the compiler is infinitely more desirable than the feedback of a million error reports per hour captured from a deployed application. Remember, practice the hard things and do the easy things in crisis — but in software development there is always crisis (so always do the hard things.)</p><h4>Code linting (remove lax behaviors)</h4><p>Unfortunately, there are many things that will pass the compiler but may have semantic issues. Here a tool like tslint maintains a checklist for the “human factors” of software development. Not all types are desirable so they can be banned from use. Conditional assignments of values? Get rid of that. Used a language keyword as a variable name? Drop that.</p><p>Use JavaScript eval ? EXPLODE THE COMPILER.</p><p>Well, perhaps not that extreme.</p><h4>Code formatting (uniformity and consistency)</h4><p>tslint also gives you a two-for one bang for the buck: code formatting. When you have this in your quality pipeline another benefit becomes visible in teams: branching and merging code becomes easier because no one is fighting with the positioning of curly brackets and white space.</p><p>You just have to decide in advance to use the formatting and if you have already existing “legacy code” in the arbitrary format. Go ahead and go through the pain of reformatting that merge and tool configuration. Short term pain, long term benefit for your teams.</p><h3>Conclusion</h3><p>Fluency in a language is nice but getting the computer some of the work for you makes your code stronger, faster and more reliable. These are safety nets that enable fearless refactoring. And we haven’t even talked about unit testing (which you should also be doing).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDHTNdqYBS43Ud4gWiRzog.png" /><figcaption>Are you working on the silicon_prairie? Perhaps you want the shirt! Yes… buy the shirt! <a href="https://teespring.com/silicon-prairie">https://teespring.com/silicon-prairie</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=834ab18cf00a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/making-your-life-unpleasant-for-gain-and-profit-834ab18cf00a">Type-checking, linting, formatting: Gates of Power</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mathematical Functions vs. Programming Functions]]></title>
            <link>https://medium.com/the-accepted-forest/mathematical-functions-vs-programming-functions-cf4c7e6f9f4b?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf4c7e6f9f4b</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Tue, 22 Aug 2017 21:37:18 GMT</pubDate>
            <atom:updated>2017-08-22T21:37:18.362Z</atom:updated>
            <content:encoded><![CDATA[<h4>Something is bugging you about your program but you don’t know why…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_X5YAcRjtL33MF3l4CDPg.jpeg" /></figure><p>Mathematicians have it easy. Their functions always make complete sense. There are never any exceptions. They always work in the same way. A set of inputs results into another set of output results. If you have the function that “squares a number” it will always give you a 25 when you give it 5. No exceptions. Never happens in mathematics, if it does, it is a mistake — and it isn’t the math.</p><h4>Programmer’s Functions</h4><p>A programmer’s life is not a simple life. In the crush of “getting things done” we got lax. We make things that are functions that are not actually functions in the mathematical sense.</p><p>We can make a function that sometimes returns 26 when we expect 25 from the input 5. Some functions cause the program to abort giving no result at all — an equally horrible problem in some contexts. Nowhere in the mathematics of “squaring” does it say to return nothing, an incorrect answer or even halt and catch fire. As these functions are composed together in complexity we start to have more and more complicated interactions between every piece in the system. A program may run perfectly fine in an operating system one day and then find itself viciously murdered by another component — often called an Out of Memory killer — without warning. Why did the OOM killer get the program? Very likely, another program on the system stumbled into a flaw with its own particular set of non-mathematical functions and started to use all the available memory.</p><h4>Pure Functions</h4><p>You could imagine that this can be quite frustrating to find that your programs composed of functions that sometimes throw faults or crash or do the wrong behavior. A solution — there are always multiple — emerged repeatedly from the “functional programming” paradigm that is called “pure functions.” As is typical in the fog of naming things, we had to add something to the name “function” in order to regain or capture the essence of what it had in its former glory: predictability.</p><p>Pure functions are nothing more functions that have no side-effects in their definition. Surprise, the mathematics has returned back to programming!</p><h4>Purity isn’t Enough…</h4><p>But we still have a nasty surprise for the creation of “pure” functions — how can we know for sure that they are pure? Now we have to turn the difficulty up to a new level and at the same time acknowledge that there is something that is likely impossible.</p><h4>Total Functions</h4><p>A total function is the pure function with another feature: it can show that it will return a result for all possible inputs. A partial function can be “pure” part of the time but not all of the time — partial functions will crash should they ever receive an input outside of their capability.</p><h4>Halting Functions</h4><p><em>The man in the lab coat puts the device on the steel table under the bright lights of the gallery. The man turns around and with his back to the audience connects the cables for power to the device placed just so, in front of all. The audience’s murmurs raise and hush as the man in the lab coat turns around in a flourish and announces loudly “Ladies and Gentlemen, we are here to evaluate the utility of this device and answer the ultimate of energy and power-conversational resource questions — a problem that is of course important to us all —that is… ‘Will it end?’”</em></p><p>The easy part of the halting problem is knowing that the halting problem exists and it has been proven to be insurmountable. Relax. Alan Turing proved that there is no general-purpose algorithm to analyze a program to determine if it “halts.” It isn’t the first time this has been shown. What does that mean for the working programmer? It means they need to simplify their work so the available known special-purpose algorithms can be used to improve and certify it.</p><h4>Testing Functions</h4><p>One of the greatest things that computers can do other than the functions you have created to accomplish important works, are the functions that watch and guard the behaviors of those other functions to certify that they are working as you expect. The more often you run those tests while you develop the more confidence you can have that nothing is going horribly wrong.</p><h4>Best Practices</h4><p>The best any programmer can do is just this: make the functions small, make the functions pure and make the functions total. Use other functions to automate and evaluate these functions to confirm that they are doing what you expect. And if you can’t understand the function, break it apart into smaller pieces until you do — because if you don’t you can be certain there is a bug waiting to bite you there in the dark.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf4c7e6f9f4b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/mathematical-functions-vs-programming-functions-cf4c7e6f9f4b">Mathematical Functions vs. Programming Functions</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elm Architecture & Programming]]></title>
            <link>https://medium.com/series/elm-architecture-programming-ca23b5ae48e8?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca23b5ae48e8</guid>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Mon, 14 Aug 2017 13:41:27 GMT</pubDate>
            <atom:updated>2017-08-15T02:37:41.575Z</atom:updated>
            <content:encoded><![CDATA[<h4>Begin a Journey</h4><p>The Elm Language and Architecture is a way of constructing programs that are extremely unlikely to crash. This series is for programmers who are wondering… why are these Elm people so fanatical about this little language that transpiles to JavaScript — is it just another (Coffee|Type)Script?</p><p>Elm gives more than just another language idea, there are also some important idioms of its <em>architecture</em>. We’ll start with the <em>model.</em></p><h3>The Model</h3><h4>Deciding How to Represent State</h4><p>Deciding how your application’s state will be represented is called the <em>model</em> of the application. The process itself is often called <em>modeling</em> for obvious reasons.</p><p>Let’s specify a model that enables us to count the sheep leaving or entering the stockyard — very simple, but this already introduces four important concepts.</p><pre><br>type Model = Int</pre><h3>“Naming”</h3><h4>Deciding What to Call Things</h4><blockquote><a href="https://www.martinfowler.com/bliki/TwoHardThings.html"><em>There are only two hard things in Computer Science: cache invalidation and naming things.</em></a></blockquote><blockquote><em>— Phil Karlton</em></blockquote><p>Already we’ve got four “names”, type, Model and Int. The fourth? It’s almost invisible being the = that cues us that Int is being “assigned” to the “type” named “Model”.</p><h3>Four Concepts</h3><h4>name</h4><p>The “human-friendly” symbol used for abstractions.</p><h4>value</h4><p>The representation of concepts or abstractions.</p><h4>type</h4><p>A kind of value or abstraction of a value.</p><h4>assignment</h4><p>The “encapsulation” of a name and value with a new name or “category.”</p><h3>Types for Modeling Simple Values</h3><p>“Simple” values are like the letters of the alphabet or numbers, they can be used to represent other things. Some examples are:</p><p><em>String </em><em>&quot;hello world&quot;</em></p><p><em>Int </em><em>42</em></p><p><em>Float </em><em>3.1459</em></p><p><em>Boolean </em><em>True and </em><em>False</em></p><p>We’ll come back to types later… watch for that.</p><h3>main</h3><p>All programs have to start somewhere, Elm chooses the classic name of “main” in order to do this.</p><h3>update</h3><p>Updating receives the current model and a command to be operated. Once the command is handled, some output has to be generated with the view.</p><h3>view</h3><p>Views are essentially the “output” of your program. Currently in Elm they can be HTML or Svg but nothing is stopping Elm from adding more types of views. Because the views are being handled by Elm’s specialized core — you can leave tricks and optimizations up to it instead of having to do it yourself.</p><h3>modules</h3><p>As the number of names begins to escalate, the complexity of a program begins to outstrip the human’s ability to avoid mistakes.</p><p>Elm provides the ability to create “modules” to isolate names from one another.</p><h3>pure functions</h3><p>You might have heard this also from Haskell programmers as well. “Pure” functions are those without side effects during execution.</p><p>A function that has side-effects is harder to debug because you have to then also capture and observe any external state the function might interact with.</p><h3>packages</h3><p>Even more precision comes with Elm’s packaging of modules — breaking API changes require bumps of the package’s version — otherwise the ecosystem will eventually suffer the same dependency hell seen with Haskell, Node.js and so on.</p><p>All the published Elm packages can be browsed at <a href="http://package.elm-lang.org/">http://package.elm-lang.org/</a></p><p><em>Hey!</em></p><p><em>This is a work in progress, if you’re excited — TELL ME.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca23b5ae48e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Insight on Daily Meditation]]></title>
            <link>https://medium.com/the-accepted-forest/an-insight-on-daily-meditation-8dd344e78eb?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dd344e78eb</guid>
            <category><![CDATA[flow]]></category>
            <category><![CDATA[adult-adhd]]></category>
            <category><![CDATA[meditation]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Thu, 10 Aug 2017 13:56:44 GMT</pubDate>
            <atom:updated>2017-08-10T13:56:44.318Z</atom:updated>
            <content:encoded><![CDATA[<h4>Software development without focus? Good luck with that. Too much focus? That’s not so great either.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WGwYyvs4ocxTn0HS-2Qlmw.jpeg" /><figcaption>Not even money can buy you this skill or the ability to outsource it.</figcaption></figure><p>On any given productivity medium (blog, book or podcast) someone is going to recommend to you that daily meditation is an absolute “must do.” “Changed their life!” “Made them able to earn their first million dollars in 18-months with a new-born child in the aftermath of a horrendous tsunami.”</p><p>Now everyone is different in their own minds, they perhaps don’t have a “need” for meditation, but they might understand it better if it were explained as something not called “meditation.”</p><h4>If not “meditation” what are you doing?</h4><p>Most people fixate on meditation on “something” — perhaps trying to focus all their attention on the “blue lamp” or the “candle” across the room from them. Some forms of meditation seek to isolate the mind from all external stimulus in the form of willed sensory deprivation or a pleasant head-trip floating inside of a warm and dark tank filled with super-saturated epsom salt water. Sometimes it is a a repeated chant looped over and over and looped and over and over so you can’t looped over and over think over and over looping about over and over things. So we have multiple methods of trying to control the mind’s… distraction. For we’re pattern-recognition machines, always searching and always planning.</p><h4>“Distractation” is what I’m calling it</h4><p>Set aside some time — in a quiet place — because what the practice is about is noticing when you are distracted, internally. Suddenly, you think, “Did I check the oil this week in my car?” Distraction.</p><p>“What about the radiator fluid.”</p><p>Distraction.</p><p>What are you going to do about it? You can’t do anything about it right now, you’re busy doing your <em>distractation</em> practice — and succeeding! How?</p><p>You’re catching the expensive loss of focus in your mind before it ruminates and derails your day. Notice that feeling that someone or something is pulling on your ability to decide “what’s the next action?” Hold on to that. What you want to sense from your mind is when it is <em>about to go off on the next adventure. </em>Remember that it is really easy to fool yourself that you’re thinking about what you’re supposed to be thinking (multitasking etc.) unless you have trained to notice when your thinking has shifted contexts.</p><h4>The Disability of Hyperfocus</h4><p>Most people will not have this problem, for others, you know who you are.</p><p>If you don’t have the ADHD “super-power/super-disability” of “hyperfocus” — I consider it a power and a disability — your mind probably has all kinds of interruptions internally. The “disability” of hyperfocus is getting stuck in a flow-state — when time disappears and great and powerful thought explodes effortlessly — and writing code for 18-hours continuously at the neglect of health, family and friends. This is the opposite problem of distractation, the ability to be distracted is completely shut off and the mind levers itself on one <em>very interesting problem</em>. Phones can ring and you won’t even hear them. Rainstorms can buffet the home and you will only notice that somehow the ground is wetter now than you remember earlier.</p><p>For those with this problem, we have to practice unfocusing so that we can better interact with other people around us — so we have to notice that we’re not distracted as opposed to distracted.</p><h4>Set an alarm and feel an appreciation for recognition of mental change</h4><p>Do it for five to ten minutes and enjoy the feeling of knowing that your mind’s immense power is attempting to switch to something more interesting or concerning than what you are wishing to do right now — and you can use that to become more productive. And for those of us with the opposite problem, maybe what we need is a wrist-band taser that shocks us every 25 minutes if we don’t solve a captcha during periods of extreme hyperfocus — but then I know, we might even be able to flow past that except for the problem of not being able to type with the wristbanded hand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dd344e78eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/an-insight-on-daily-meditation-8dd344e78eb">An Insight on Daily Meditation</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Paradox of Back-end and Front-end Reliability]]></title>
            <link>https://medium.com/the-accepted-forest/the-paradox-of-back-end-and-front-end-reliability-c8a71efa7ad2?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8a71efa7ad2</guid>
            <category><![CDATA[elm]]></category>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[actor-model]]></category>
            <category><![CDATA[functional-programming]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Mon, 07 Aug 2017 14:25:10 GMT</pubDate>
            <atom:updated>2017-08-07T14:25:10.486Z</atom:updated>
            <content:encoded><![CDATA[<h4>How Let-It-Fail Makes Never-Fail Possible</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuBRowpJV4_8b6tEsRV4rg.jpeg" /><figcaption>Far from your home, the back-end systems experience another normal day.</figcaption></figure><p>It’s a safety issue when you think about it. Users want to feel safe. If users ever feel vulnerable or angry — they will leave you. End of story. What makes a user feel vulnerable or angry?</p><h4>Lagging and Overwhelming User Interfaces</h4><p>Click. Click. Click-click-click-click.</p><p>[Wait for it…]</p><p>Click?</p><p><em>HEREYOUAREEVERYTHINGYOUASKEDFORFORTHELASTSEVENCLICKS</em></p><p>[Argh!]</p><p>This is not an interface, this is a bulk-foods-dispenser with the wrong chute diameter, the kind that gives you six-pounds of sushi rice — when you open it for 500 milliseconds — when you just wanted one-pound!</p><h4>Vague Error Messages with “Try Again Later” Placations</h4><p>“Something went wrong” is not an error message, but I understand that some users will not want more details — but if they do, maybe they should be able to get that information. DNS wasn’t working? Teach them how to diagnose their own local environment and their confidence will skyrocket. Just teaching them “Turning it off and on again” just creates more digital co-dependent users.</p><h4>Disappearing and Reappearing Data</h4><p>[Finish the conclusion to your two-year thesis on the decay of optical media managed by howler monkeys… save… refresh page]</p><p><em>FILE NOT FOUND… OH HAI THAR IT IS LOADIN’</em></p><p>Data that disappears and reappears is not a magic trick users appreciate.</p><h4>Failure Modes are for the Administrators of the Ivory Towers</h4><p>Compare the utility and engineering that goes into a “consumer product” versus an “industrial product.” A consumer product is sold to ordinary people, who just want their problems to be solved. Bad products create more problems for people. The scary thing about “virtual goods” like websites, is that it is very easy to “ship” bad experiences to hundreds, thousands or millions of people.</p><p>The only people that should have to worry about failures are the people being paid to worry about them — and your customers aren’t those people. Erlang/OTP is a platform that fully embraces the “let it fail” idea on the back end with <em>process-oriented programming</em>.</p><h4>Process-oriented Programming or Actor Model Programming</h4><p>Sir Charles Antony Richard Hoare described this model in a programming techniques paper called “Communicating Sequential Processes” (1978) In this paper, a “fundamental program structuring method” involving processes that cooperate via message-passing only (no global or shared memory). It would take some time — as new understanding in prior decades always takes longer to propagate without the Internet — before others would start to design systems around this idea. Today we have languages like Erlang, Go and Pony that embrace CSP as a fundamental model of program structure. If your programming environment cannot cope with millions of processes, get a new programming environment.</p><p>On top of Erlang, OTP was built that created “supervision tree” structures that wrangle these fundamental processes. If a process goes awry, “let it fail” and make a new one — since everything is virtual, it isn’t like a machine on a factory floor throwing hot slag at operators — and log the error for later analysis. The ability of OTP to supervise and automate the recovery of these systems makes it easier for administrators and developers to react to problems without “the Website is Down!!!” alerts. If your pager never goes off, that’s a <em>good</em> day. Systems built with structures like OTP have phenomenal strings of <em>good days.</em> Some report that systems built with Erlang have nine-9’s of reliability — e.g. 99.9999999% reliable. Imagine… one second of downtime in 20 years. That’s how insane this is.</p><p>Now you could also just embrace CSP inside the web-browser or client, but it appears that we know how to make client code bullet-proof so any client avoids run-time errors.</p><h4>Functional Reactive Programming and Monads</h4><p>Which is more scary? FRP or the big “M” word? Probably both. Functional Reactive Programming is a liberating idea that removes the worst parts of client-user-interfaces: inconsistent view updates and controls. Monads are the big-hairy-mathematical theory that essentially restricts what a program does in order to simplify how we think about it: if your functions have side effects and “aren’t pure” then your programs will be much, much harder to test.</p><p>Functional Reactive Programming systems like Elm just systematically remove all invalid states and turn your user’s gestures into messages to be “reacted” to be different aspects of the client. In short, if you have been programming “event handlers” to subscribe to mouse-clicks and key-presses without any intermediate application-specific representation, you are missing out on some ability to debug your program. Just as with working with CSP, FRP requires some practice and discipline to avoid reaching out for shared-states aka “global” variables. The “Monad” comes into play when you need to interface with external systems that may fail — like your back-end system or network between you and the back-end system. If you are ready to accept either a “result” or an “error” in your client (and you should <em>always </em>be checking for these results or errors in your client) then your client will never present a mysterious behavior to the user, in other words, a vague “something went wrong” catch-all error.</p><h4>Letting it Fail Faster in Order to Never-Fail</h4><p>You should be able to plan a contingency for your users so they can have the best experience — never fail the user if possible — and on the back end, use automation and supervision to recover from failure quickly — because bad states on your servers should be thrown away as fast as possible to recover the memory for the work that <em>gets things done</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8a71efa7ad2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/the-paradox-of-back-end-and-front-end-reliability-c8a71efa7ad2">The Paradox of Back-end and Front-end Reliability</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Type-Annotated Functions]]></title>
            <link>https://medium.com/the-accepted-forest/type-annotated-functions-76293ae13484?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/76293ae13484</guid>
            <category><![CDATA[elm]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[augmented-intelligence]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Thu, 03 Aug 2017 14:01:11 GMT</pubDate>
            <atom:updated>2017-08-03T14:01:11.891Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Shiny Black-boxes of Programming</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8l-hLWnp8F5dH1NxDMTNhQ.jpeg" /><figcaption>Light in the Darkness</figcaption></figure><h4>Using Types and Human Augmentation in Software Development</h4><p>Human augmentation? Absolutely! Our minds can get tired or overwhelmed by complexity unless we have systems to guide us away from dangers. In programming, a strong type system is used to prevent the accidental use of unrelated values. One place this shines is at the edge of functions where values are input and output. When your “augmentation” (here being the Elm compiler or any other compiler) warns you of a problem, you should pay attention.</p><p><a href="http://elm-lang.org/">Elm</a> is a delightfully small language that distills programming behaviors into a warehouse of little black boxes that only misbehave when you allow them to. But how do these little black boxes know when they would or would not misbehave?</p><p>Often when you start prototyping a function’s behavior you first name the “thing you want.” You may not know how it will do it but you think that you know what it would be called. At this point you have a black box with a label and nothing else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCH_sHciZKsVbHmpuXmRcg.png" /></figure><p>Let’s contrive two functions that output some “personal” information. Your name and your birthplace. In Elm, these have to be written in a certain way so the compiler can distinguish between different parts of your program. So we will transform “your name” to what Elm would want to see: yourName. “Your birthplace” of course becomes yourBirthplace. Some functions don’t need inputs so they just do whatever they need to do. When you call/invoke/use a function, it makes an output.</p><p>A good function is predictable or “pure” without side-effects. If you turned on your blender for example to make your morning power-shake, you would probably not imagine it should also add more micellar casein to your Amazon shopping cart and click’s “SHIP” because it guessed that you needed more, all you really wanted was your shake… blended. The output is the shake in that case.</p><h3>A Dance of Values and Types —</h3><p>Values are of course the stuff of computing, when someone asks “What is your name?” You give them a “value” of &quot;Robert&quot; or &quot;Josephine&quot; — and everyone is happy, because it looks like a “name” or a “string”. Now there is a bit of a distinction here, when you give a “name” you are not giving a “number,” because most people will think that is wrong to say your name is 384394558. In Elm, we can inform the compiler — which is ever watchful — that a name should look like a String with a “type alias.” Let’s make a couple of type aliases, one for names and another for “birthplaces.” The following two lines are declarations of “type aliases:”</p><pre>type alias Name = String<br>type alias Birthplace = String</pre><p>Now, to use these we should write a couple of functions to return values, one for yourName, and another yourBirthplace. With these functions we will want to inform the compiler — which can on its own “infer” the types of things most of the time — what we really intend to do with the functions:</p><pre>yourName : Name<br>yourName = &quot;Robert&quot;</pre><pre>yourBirthplace : Birthplace<br>yourBirthplace = &quot;Mirkwood Forest&quot;</pre><p>In Elm, the first lines before each function with the “:” are called “type annotations” — which are optional in the language, but a good practice once you have sketched out your program. These are the guard-rails to prevent the misuse of functions — and in some organizations, are required as documentation.</p><p>With these two functions, we can happily get yourName and yourBirthplace whenever we want. But, there is a silent danger lurking within these aliases: we aren’t getting the maximum type protection from the Elm language that we could possibly get. What if we were confused and wrote:</p><pre>yourBirthplace : Birthplace<br>yourBirthplace = yourName</pre><p>What would the Elm compiler do?</p><p>It would let it fly without warning and crash into the forest just outside of the airport incinerating dozens of woodland creatures and making a few options traders extremely happy at their (mis)fortune. For the two type aliases Name and Birthplace both resolve to the same “type” of String.</p><p>Let’s add some more strength to the types by adding type constructors, starting over we make full types instead of type aliases:</p><pre>type Name = Name String<br>type Birthplace = Birthplace String</pre><p>Our functions now have to be updated to construct and return the types, because they are no longer “aliases” of the type String.</p><pre>yourName : Name<br>yourName = Name &quot;Robert&quot;</pre><pre>yourBirthplace : Birthplace <br>yourBirthplace = Birthplace &quot;Mirkwood Forest&quot;</pre><p>Now what would happen if you tried to corrupt the meaning of yourBirthplace with the result of a Name type?</p><pre>yourBirthplace : Birthplace<br>yourBirthplace = yourName</pre><p>Elm will give you a very helpful error message:</p><pre>-- TYPE MISMATCH -----------------------------------------------  </pre><pre>The definition of `yourBirthplace` does not match its type annotation.  </pre><pre>&gt; yourBirthplace : Birthplace<br>&gt; yourBirthplace = yourName  </pre><pre>The type annotation for `yourBirthplace` says it is a:      </pre><pre>      Birthplace  </pre><pre>But the definition (shown above) is a:</pre><pre>      Name</pre><p>Crisis averted, the woodland-creature barbecue never happens, as this plane will not be allowed access to the tarmac and the options trader’s day progresses as ordinary and normal. The black boxes know who is who, and where is where.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76293ae13484" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/type-annotated-functions-76293ae13484">Type-Annotated Functions</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Why of the Forest]]></title>
            <link>https://medium.com/the-accepted-forest/the-why-of-the-forest-c9ca2af89a56?source=rss-9299d27a7a04------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9ca2af89a56</guid>
            <category><![CDATA[solution-architecture]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Simon Janes]]></dc:creator>
            <pubDate>Tue, 01 Aug 2017 02:59:51 GMT</pubDate>
            <atom:updated>2017-08-01T02:59:51.275Z</atom:updated>
            <content:encoded><![CDATA[<h4>Cutting Systems Development to the Essentials</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7h8_FAfdI2OFjivINK07QQ.jpeg" /></figure><blockquote>Trees are sanctuaries. Whoever knows how to speak to them, whoever knows how to listen to them, can learn the truth. They do not preach learning and precepts, they preach, undeterred by particulars, the ancient law of life.<br>— Herman Hesse</blockquote><p>There is an issue of professional knowledge domains — things like science, computer science, economics, politics — that is a common plagues for humanity: what to call things we work with or build with.</p><p>The initiate idea for The Accepted Forest (<em>tAF)</em> was the realization that there was such an argument between certain botanists about which names of species of Elm apply to which instances of botany that the botanists themselves received a name: <em>pteleologists. </em>(Why, Elm? Because that was the language I was evaluating at the time.) Myself not being a botanist was finding it interesting that so many names of kinds of “Elm” trees were so hotly debated. There were discussions and debates of the “accepted name” for each species in a particular region. The problem with these perpetual debates with biology is that biology is a somewhat continuous process that is very slow to our eyes. A tree of a particular species may live decades and propagations of any particular tree may have genetic changes or epigenetic changes that lie, unobserved, for decades beyond the original tree.</p><p>Hmm, where else has that ever happened in computer science? “Old” mutations come back as “new” ideas — and the woodsmen talk about which are better or worse or what things should be called.</p><p>Ah, yes, in the perpetual utility of language wars where one defends <a href="http://lesswrong.com/lw/gt/a_fable_of_science_and_politics/">Green languages versus Blue ideologies</a> to great personal stress and strife. Is your programming language “functional” or “lazy” or “strict” or “strong typed” or “weak typed.” Are you writing in a “Blub” language or “Not-Blub” language. Wait, what’s a “Blub” language? It turns out to be the language you most prefer — and passionately defend until it becomes a problem.</p><p>Paul Graham describes the problem of the expert “Blub Programmer” proficient with the “most powerful language” of “Blub” in his essay “<a href="http://www.paulgraham.com/avg.html">Beating the Averages</a>”:</p><blockquote>As long as our hypothetical Blub programmer is looking down the power continuum, he knows he’s looking down. Languages less powerful than Blub are obviously less powerful, because they’re missing some feature he’s used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn’t realize he’s looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.</blockquote><p>This problem of naming, which grew into language-blindness can be extended further.</p><p>Another English idiom rings into the Why of <em>tAF</em>: “He can’t see the forest for the trees” — or in other words, one gets tied up into only the specifics of a situation and fails to see larger, general principles. <em>tAF</em> wants to help bring this ability of stepping up your ability to perceive in programming and systems to a higher level. But, for functional programming at least, you have to be able to code a tree to understand how to code a forest — and still knowing that potentially there could be many other “acceptable” trees that may be present in the “acceptable” forest.</p><p>It does not mandate a particular programming language, methodology, operating system, or monetization model except those that make systems and people better at what they need or want to do — with a recognition that it is possible to over-complicate anything. The “Why” of The Acceptable Forest is the teach the understanding of the “What” and the “How” of systems can be fluid without the rancor of processes without reflection. The “How” of systems can show that they are imperfect and can be improved upon without insult or without malice. The Acceptable Forest is not the Proven Forest because people are imperfect — although at times, capable of the purest expressions of thought and inspiration.</p><p>Let’s all go forth and stumble and stroll through the Acceptable Forest to see what we can forage for our minds, our tools and our systems — and we all may find ourselves with surplus beyond imagination.</p><p>Simon Janes writes challenging software and prose for psychological pleasure and was certifiably “incorrigible” according to his 9th Grade GT English teacher.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9ca2af89a56" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-accepted-forest/the-why-of-the-forest-c9ca2af89a56">The Why of the Forest</a> was originally published in <a href="https://medium.com/the-accepted-forest">The Accepted Forest</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>