<?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[Ohlman IO - Medium]]></title>
        <description><![CDATA[The official blog of Ohlman IO - Medium]]></description>
        <link>https://medium.com/ohlman-io?source=rss----10b683a6bf6e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Ohlman IO - Medium</title>
            <link>https://medium.com/ohlman-io?source=rss----10b683a6bf6e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:13:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ohlman-io" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The unsolved problem of semantic components in html]]></title>
            <link>https://medium.com/ohlman-io/the-unsolved-problem-of-semantic-components-in-html-2291945c6495?source=rss----10b683a6bf6e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2291945c6495</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Joshua Ohlman]]></dc:creator>
            <pubDate>Mon, 12 Jun 2017 13:18:30 GMT</pubDate>
            <atom:updated>2017-06-12T13:18:10.548Z</atom:updated>
            <content:encoded><![CDATA[<p>The advent of React.js and various styles in js libraries has brought huge advancements to modularity and components. Now using a library like styled-jsx you can create components who’s content &amp; styles are completely modular, which is a huge win for testing and maintainability.</p><p>Another concept that’s growing is the idea of semantic styles. Semantic styles are great: you define and name a component (or css class) based on what it is, not how it should look, then (usually in a separate file) you style the component, often using mixins or other css-preprocessor tricks to allow multiple semantic components to share styles. This is a huge win for readability, both in the html/component code and in the style code, it’s easy to see the link between a component and it’s styles.</p><p>However, there remains a couple of un-solved issues:</p><ol><li>The coupling of ui elements and styles</li><li>The tradeoff between global and component-level styles</li></ol><p>First, there’s the coupling of ui elements to styles. If you want to create a component, for example a card component, you sometimes need more ui elements (multiple &lt;div&gt;s) than you need semantic elements (a single &lt;card&gt;), this can be due to a variety of reasons, for example centering elements, creating multiple borders around an element, etc. The net result is that not every style can be accomplished simply by adding a class name or inline styles to an element.</p><p>Second, there’s the tradeoff between global and component level styles. Every developer want’s to create styles as close to where they’re used as possible, this makes debugging and developing easier. But we also want to reuse styles, and we want to be able to ‘theme’ things, completely changing the style of the entire app based on some external condition (whether that’s screen size or user preference).</p><p>So how do we solve these problems?</p><p>I propose the introduction of the Div component. Building on the idea of styled-jsx, the Div component takes responsibility of styling it’s contents away from your component. You wrap every distinct UI element in a single Div and the Div module takes care of the styling. Here’s a proposed api/example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e148647a8adf7ade651bcce5303407f/href">https://medium.com/media/3e148647a8adf7ade651bcce5303407f/href</a></iframe><p>A naive implementation of the above code could simply use the component identifier as a classname and place styles in a style tag, but more complex implementations could offer:</p><ul><li>Styles shared between components by adding a ‘defineCommonStyle’ method</li><li>Use of objects or symbols instead of string component ids to avoid name collisions.</li><li>Child styles (e.g. ‘post’ &gt; input)</li><li>A reflection api (so that all styles can be queried and manipulated in js)</li></ul><p>Of course, there are other ways to implement this same idea, for example as attributes to html elements (e.g. &lt;article component=’post’&gt;).</p><p>I’d love to hear your feedback on this idea! Especially if you have any ideas for improvement!</p><figure><a href="http://www.ohlman.io/"><img alt="" src="https://cdn-images-1.medium.com/max/487/1*QTp2hFk0w1vTKeeWYfSbnA.png" /></a></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fpowered.by.rabbut.com%2Fp%2FyXbT%3Fc%3D0&amp;src=https%3A%2F%2Fpowered.by.rabbut.com%2Fp%2FyXbT%3Fc%3D0&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=rabbut" width="500" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/f05146eac29b9261da7b1172b359a368/href">https://medium.com/media/f05146eac29b9261da7b1172b359a368/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2291945c6495" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ohlman-io/the-unsolved-problem-of-semantic-components-in-html-2291945c6495">The unsolved problem of semantic components in html</a> was originally published in <a href="https://medium.com/ohlman-io">Ohlman IO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Random in redux]]></title>
            <link>https://medium.com/ohlman-io/random-in-redux-b6b9932ad061?source=rss----10b683a6bf6e---4</link>
            <guid isPermaLink="false">https://medium.com/p/b6b9932ad061</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Joshua Ohlman]]></dc:creator>
            <pubDate>Mon, 01 May 2017 22:44:02 GMT</pubDate>
            <atom:updated>2017-05-01T22:44:01.313Z</atom:updated>
            <content:encoded><![CDATA[<p>So I’m building a game with react, and I’m using redux, just to try it out. Naturally in a game I need some randomness… but in redux you’re supposed to write pure functions. So… here’s my solution:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/739e02f9ee602a2889a3852a9217bcf2/href">https://medium.com/media/739e02f9ee602a2889a3852a9217bcf2/href</a></iframe><p>So you just pass in the seed value (which can be truly random in production, and fixed in development), and all future values are simply a function of the seed and all intervening actions.</p><p>So what do you think? Is this the right way to do random in redux, or is there a better way?</p><p>Notes:</p><ol><li>I think that this paradigm could be easily abused if you were to call state.rand() outside of the reducer. Simple fix for this would be to store only the seed.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6b9932ad061" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ohlman-io/random-in-redux-b6b9932ad061">Random in redux</a> was originally published in <a href="https://medium.com/ohlman-io">Ohlman IO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My thoughts on npm modules, tests, and functional programming]]></title>
            <link>https://medium.com/ohlman-io/my-thoughts-on-npm-modules-tests-and-functional-programming-1c183cb636f7?source=rss----10b683a6bf6e---4</link>
            <guid isPermaLink="false">https://medium.com/p/1c183cb636f7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[npm]]></category>
            <dc:creator><![CDATA[Joshua Ohlman]]></dc:creator>
            <pubDate>Wed, 19 Apr 2017 17:14:00 GMT</pubDate>
            <atom:updated>2017-04-19T18:12:25.070Z</atom:updated>
            <content:encoded><![CDATA[<p>Javascript modules have a few problems. First off, there are too many modules. As Jordan Scales rightly points out, adding just a few npm modules to your project can create giant bloat (at best):</p><p><a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558">I Peeked Into My Node_Modules Directory And You Won’t Believe What Happened Next</a></p><p>But it get’s worse. When you want to bundle those modules up and push them to the client you end up with more bloat. Nolan Lawson points out that most module bundlers create excessive (and unnecessary) bloat around each package, especially when babel is involved:</p><p><a href="https://nolanlawson.com/2016/08/15/the-cost-of-small-modules/">The cost of small modules</a></p><p>And then there’s the problem of broken modules. What do you do when someone else’s module breaks? It’s not always easy:</p><p><a href="https://medium.freecodecamp.com/youre-asked-to-make-a-fix-e156b802ad92">So a product manager asks you to fix a bug…</a></p><p>You’ll notice that each problem above is directly related to using other people’s code. After all if it was all your code you could control dependencies, write modules which can be concatenated instead of bundled and fix bugs wherever you find them.</p><p>But there’s a lot of benefits to using other peoples code. In fact, you can’t avoid it. Reinventing the wheel is just too expensive in terms of time, complexity, and cost. So, what to do?</p><p>It seems to me that there’s a huge benefit to be realized by distributing code in smaller, replaceable, and testable chunks. For example, most npm modules seem to include a file called ‘util.js’ or depend on some kind of utils package (e.g. underscore), often (especially when a package is involved) a lot of code is included simply in order to use a single utility function (e.g. _.extend). I think there would be a huge benefit to reducing the overhead for code-sharing by sharing smaller units of code.</p><p>I think that code should be shared at the function level, this has several benefits:</p><ol><li>It’s clear exactly why a given dependency is needed, it’s a function and you can easily count the number of instances in which the function is used.</li><li>Writing dependencies as standalone functions purifies code and makes testing of dependencies much easier.</li><li>There’s a huge reduction in overlapping and unused dependency code, for example, if one package uses each and extend from underscore, and another package uses extend and map from lodash, depending on only the individual functions being used results in in 4 functions being included, vs. 2 libraries of dozens or hundreds of functions each.</li></ol><p>But there’s an added benefit: it’s much easier to replace individual functions than libraries, for example if you depend on underscore.js, and you want to use lazy.js, writing a wrapper around lazy.js which behaves like underscore.js is not easy, however, if your dependencies are defined on the function level, you can write wrappers only for the 3 or 4 functions you actually use (in principle you could do this with package level dependencies, but it’s much harder in practice to find which dependencies are actually being used).</p><p>So what do people think? Does it make sense to share code at the function level? I’ve got more ideas on this front, so stay tuned for future blog posts!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c183cb636f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ohlman-io/my-thoughts-on-npm-modules-tests-and-functional-programming-1c183cb636f7">My thoughts on npm modules, tests, and functional programming</a> was originally published in <a href="https://medium.com/ohlman-io">Ohlman IO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crystal Clear Calculations]]></title>
            <link>https://medium.com/ohlman-io/crystal-clear-calculations-95ea4ea50f68?source=rss----10b683a6bf6e---4</link>
            <guid isPermaLink="false">https://medium.com/p/95ea4ea50f68</guid>
            <dc:creator><![CDATA[Joshua Ohlman]]></dc:creator>
            <pubDate>Mon, 29 Aug 2016 13:16:02 GMT</pubDate>
            <atom:updated>2016-08-29T13:16:02.334Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>At the core of one of my projects is an algorithm. That algorithm is essential to the project and also constantly changing. While I could write (and have written) tests to ensure the correctness of the algorithm and it’s calculations, the constantly changing nature of the algorithm means that’s not enough. I need to be able to examine the exact steps in the algorithm which lead to a particular result.</p><p>Enter Crystal.js, a (half-started) javascript framework for writing crystal clear calculations. Crystal.js is a thin wrapper for javascript functions which saves the input and output of every operation in your calculation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97441605ecede81e6d2efca8196e345a/href">https://medium.com/media/97441605ecede81e6d2efca8196e345a/href</a></iframe><p>Using Crystal.js is pretty easy, just use Crystal.* methods instead of math operations, map operations, or any other operation you want to define.</p><p>Here’s an example</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5c7800f61ee61354ecf1daef9e09892/href">https://medium.com/media/c5c7800f61ee61354ecf1daef9e09892/href</a></iframe><p>As you can see, the output of Crystal.js, makes the operation of a calculation easy to trace and understand. (Though it is a bit verbose at times!)</p><p>I’ve still got a long todo list of improvements that I’d like to make when I get time:</p><ol><li>Improve the output when it comes to chained operations (for example multiple map operations in a row).</li><li>Get a working json export added</li><li>More syntactic sugar methods to make it easy to annotate everything</li><li>Add a readme</li><li>Add a full set of default operations</li><li>Build a react front end for this component which can display a computation in easy to read format for end-users</li></ol><p>If you enjoyed reading this, please recommend it!</p><p>If you have any feedback or ideas for how I could improve this little script leave me a reply!</p><p>If you want me to be applying innovations like this to your project or codebase, contact me: <a href="http://www.ohlman.io/#hire-me">http://www.ohlman.io/#hire-me</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95ea4ea50f68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ohlman-io/crystal-clear-calculations-95ea4ea50f68">Crystal Clear Calculations</a> was originally published in <a href="https://medium.com/ohlman-io">Ohlman IO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript Scientist]]></title>
            <link>https://medium.com/ohlman-io/javascript-scientist-15da61064d8d?source=rss----10b683a6bf6e---4</link>
            <guid isPermaLink="false">https://medium.com/p/15da61064d8d</guid>
            <dc:creator><![CDATA[Joshua Ohlman]]></dc:creator>
            <pubDate>Mon, 22 Aug 2016 13:16:02 GMT</pubDate>
            <atom:updated>2016-08-22T13:16:02.704Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Early this year, Github released <a href="http://githubengineering.com/scientist/">Scientist</a>, a ruby gem which fills a crucial gap in development by testing your code against production data and behavior instead of just developer-made-up unit or integration tests.</p><p>Github’s Scientist is pretty cool, and if I wrote code in ruby, I’d certainly use it. But I generally write code in javascript using meteor, so if I want to ‘do Science’ I’m going to need a different package. So I wrote my own.</p><p>Caveat: there is a much more fully formed Scientist package for node on github: <a href="https://github.com/trello/scientist">https://github.com/trello/scientist</a>, I chose not to use trello’s scientist for 2 reasons: first reason being I had a little trouble with configuration, I don’t remember what the trouble was, but I didn’t spend long on it because of the next reason: my needs for a Scientist package are actually quite simple, but I did want to do a little customization in the way that Scientist behaves. Long story short: If you use node.js and want to go with a much more fully formed Scientist package, try <a href="https://github.com/trello/scientist">https://github.com/trello/scientist</a>, if you use meteor.js and want something really light that you can completely rewrite in 30 minutes, take a look at my gist (that’s right, it’s just a gist).</p><p>So here it is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/139d26d3cd9c0535f82558c49fda7a23/href">https://medium.com/media/139d26d3cd9c0535f82558c49fda7a23/href</a></iframe><p>As you can see this is a pretty simple implementation with a long todo list:</p><ol><li>We should randomize the order of the control &amp; test runs</li><li>It would be nice to be able to run more than one test against the control</li><li>We should set and enforce a timeout for the test function</li><li>Finally, this code needs to be abstracted to allow developers to drop-in their own logging handlers</li></ol><p>If you enjoyed reading this, please recommend it!</p><p>If you have any feedback or ideas for how I could improve this little script leave me a reply!</p><p>If you want me to be applying innovations like this to your project or codebase, contact me: <a href="http://www.ohlman.io/#hire-me">http://www.ohlman.io/#hire-me</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15da61064d8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ohlman-io/javascript-scientist-15da61064d8d">Javascript Scientist</a> was originally published in <a href="https://medium.com/ohlman-io">Ohlman IO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>