<?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 Ben Janecke on Medium]]></title>
        <description><![CDATA[Stories by Ben Janecke on Medium]]></description>
        <link>https://medium.com/@benjanecke?source=rss-25d78a998cf0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oH6siiwkYXTTUHLTgDYDJA.jpeg</url>
            <title>Stories by Ben Janecke on Medium</title>
            <link>https://medium.com/@benjanecke?source=rss-25d78a998cf0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:04:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benjanecke/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[Javascript is a teacher]]></title>
            <link>https://benjanecke.medium.com/javascript-is-a-teacher-a68ee5e055f8?source=rss-25d78a998cf0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a68ee5e055f8</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Ben Janecke]]></dc:creator>
            <pubDate>Mon, 10 Oct 2022 07:02:42 GMT</pubDate>
            <atom:updated>2022-10-21T00:11:05.296Z</atom:updated>
            <content:encoded><![CDATA[<h3>(Type/J)avascript is a teacher</h3><p>Around 2012 a single <a href="https://www.joelonsoftware.com/2006/08/01/can-your-programming-language-do-this/">essay</a> fundamentally shifted the way I thought about writing software, it’s still relevant and worth a read (Joel if you’re reading this you’re a superhero).</p><p>I’d like to pretend that reading the Mythical Man Month or Domain Driven Design had a greater impact than a short essay describing how you could design novel abstractions in javascript. Yet no amount of pretending will stop it from being the catalyst that triggered my specialisation into the language. I suspect that if I had specialised into say Java or Ruby in the same way I did javascript I would not have nearly as broad an array of software design techniques available to me as I do today.</p><p>Due to its inexorable presence in any project that even tangentially touches the web platform, javascript is a circus of opinions. There really is no strong consensus on how to write it (imperatively/FP/OO/declaratively/whatever perl is/reactively/procedurally) so as a JS developer you are exposed to very different design approaches in a way you just aren’t with other languages.</p><p>I’ve used C#, Clojure, Golang, Ruby, and Java in anger before. <br>Their ecosystems have a noticeably more coherent design philosophy(Java seems to be in a transitory phase though). This coherence is great for the seasoned developers who choose to work inside these ecosystems however more novice developers born into the utopia are highly unlikely to encounter “heretical” design philosophies during their day to day work. Arguably stunting their growth.</p><p>Given the nature of javascript, its ecosystem doesn’t really stagnate much. Things change frustratingly quickly with wildly varied depth in rationale. The opportunity to grok the rationale and selectively adopt changes is something I love about javascript.</p><p>Understanding which philosophy of JS to apply to a project or identifying the philosophy a given project matured into is an important skill. Especially for those wanting to remain sane whilst designing software for the web platform. Without this understanding your decision making will be hampered when adopting change and you’ll be destined to subscribe to the zeitgeist of javascript fatigue.</p><p>Generally these philosophies can be boiled down to “I really like how I can abstract things in /lisp|java|erlang|go|whatever/ and I believe I can make JS do the same thing.” It’s important to remember that these abstractions are translated and as with most translations having the source available with at least a basic grasp of its history will give you a better understanding.</p><p>If you’re lucky enough to be working on JS/TS projects I’d encourage you to make the mindshift from change being something that you have to respond to immediately, to change being an opportunity for you to learn and possibly evolve your work. There’s nothing wrong with favoring your current philosophy. Javascript is a circus and javascript is a teacher enjoy the ride.</p><p>I’ll leave you with some things I’ve learned from TS/JS</p><ol><li>I don’t like writing code without first class functions</li><li>Rich primitive data structures in a language are an indicator of high quality design</li><li>Frameworks and libraries that write down design goals and decisions usually have more direction and better design</li><li>Immutable by convention only works if your team really wants it</li><li>ORMs are hard. Languages with macros seem to have better ORMs</li><li>ORMs are more useful for manipulating relational data than they are for querying</li><li>Continuation passing style is the gateway drug to functional composition</li><li>I don’t have good enough working memory to properly wield a dynamic language</li><li>I prefer expressions over statements</li><li>Frameworks tend to be at their best on their third generation</li><li>Dependency injection doesn’t have to be all encompassing and framework bound</li><li>Writing proper types is hard in any language, remember that you write them both to help codify the constraints you’re operating under now and to help remind yourself and others about what the constraints were in the future</li><li>Mutating state although error prone will almost always be more performant a.k.a. you can trade your sanity for performance</li><li>Single responsibility principle is hell on performance but supportive of sanity</li><li>Prefer if (cond) { return } over if (cond) {} else {} where appropriate</li><li>It’s often appropriate to trade consistency for progress</li><li>Monorepos although hard are probably one of the better organizational tools we have</li><li>Time is hard <a href="https://tc39.es/proposal-temporal/docs/">Temporal</a> seems to think about it in a way that’s not insane</li><li>I like pattern matching</li><li>Utility libraries are some of the most opinion heavy code you’ll ever encounter</li><li>Concurrency can be made simple parallelism is for better people than me</li><li>Making people do work that a compiler could be doing for them is mean</li><li>Nested routes are the future</li><li>SQL statements and single responsibility don’t gel</li><li>The less something does the better it probably does what it does</li><li>Meta-frameworks are low code in disguise</li><li>Being explicit about the kind of integer/float values you are dealing with is critical</li><li>Putting related concepts in a single file when it feels reasonable is nice</li><li>Conditional types in typescript are a superpower</li><li>You can remove the first element from a list in Typescript like this, there’s more nuance to it but this should give you a start</li></ol><pre>type RemoveFirst&lt;List&gt; = List extends [first: infer First, ...rest: infer Rest] ? Rest : List;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a68ee5e055f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>