<?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 Rune Rasmussen on Medium]]></title>
        <description><![CDATA[Stories by Rune Rasmussen on Medium]]></description>
        <link>https://medium.com/@runerasmussen?source=rss-9254dd1e9903------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wUpRS-DQPK8x9giB.</url>
            <title>Stories by Rune Rasmussen on Medium</title>
            <link>https://medium.com/@runerasmussen?source=rss-9254dd1e9903------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 19:18:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@runerasmussen/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[Creating a design system]]></title>
            <link>https://medium.com/@runerasmussen/creating-a-design-system-22f10b96a305?source=rss-9254dd1e9903------2</link>
            <guid isPermaLink="false">https://medium.com/p/22f10b96a305</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[component-libraries]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Rune Rasmussen]]></dc:creator>
            <pubDate>Mon, 30 Sep 2019 07:29:16 GMT</pubDate>
            <atom:updated>2019-09-30T07:29:16.138Z</atom:updated>
            <content:encoded><![CDATA[<p><em>…and developing the shared component lib in React</em></p><p>In modern development we often come across different articles describing the importance of having a design system in an organization. The benefits and cost will vary with your organization. Vox media has made a video describing their journey and it is worth a watch if you want to learn more about design systems.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fqy4TgWvqEWE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dqy4TgWvqEWE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fqy4TgWvqEWE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/69923034dd4139c610f3e0192de32c32/href">https://medium.com/media/69923034dd4139c610f3e0192de32c32/href</a></iframe><p>The video highlights the importance of flexibility in a design system to match the many existing and potential new use cases within an organization. The right level of flexibility is, not surprisingly, also important when it comes to the code.</p><p>The focus of this article is therefore on the code, and engineering behind it, to achieve a better flexible component library that support your design system<strong>.</strong> Recommendations are given throughout the article. Important aspects such as naming components or their properties are not described as they are worthy of their own articles.</p><p>The natural thing to do when developing is to look to open source. Nobody is interested in paying to reinvent off-the-shelf items. Working with open source leads us to the first thing to consider when creating the library: <strong>Performance</strong>.</p><p>Using components from different third party vendors can eventually clog up an application, increasing the bundle size, <a href="https://medium.com/@addyosmani/the-cost-of-javascript-in-2018-7d8950fbb5d4">which will lead to bad customer outcomes</a>.</p><p>Blind use of third party libraries can also have another risk: <strong>Security. </strong>I strongly suggest reading <a href="https://medium.com/hackernoon/part-2-how-to-stop-me-harvesting-credit-card-numbers-and-passwords-from-your-site-844f739659b9">How to stop me harvesting credit card information from your website</a> for more information.</p><p><strong>Recommendation</strong>: Consider <em>when to be inspired by how others have coded their open source libraries</em> vs simply <em>NPM installing a package</em>. I generally look to <a href="https://material-ui.com/">material-ui</a> for inspiration.</p><p>Building a simple component like a Card can be done in multiple ways. The Card component in this article is a big simplification of <a href="https://material.io/components/cards/">material card</a> and consists initially of three elements; i<em>tself</em>, a <em>title</em> and a <em>body</em>.</p><figure><img alt="Card layout" src="https://cdn-images-1.medium.com/max/1024/1*im_w1X_Y72SzUl3dTu0-cw.png" /><figcaption>Simple card with a title and a body containing a text saying “Some other content”.</figcaption></figure><p>Since the card clearly has spacing all around it, it can be tempting to just add a padding to the <em>Card </em>when implementing it<em>. </em>Paddings do not collapse with any space created by a child component so the end result is extra spacing.<strong><em> </em></strong>Unless that is truly the intent, then you have a problem with: <strong>Spacing.</strong></p><p>I have create an example with <em>Card</em> using a <em>title </em>that is based on a <em>Typography</em> library that comes with a <em>margin</em>. Consider structuring the component like the example below.</p><pre>interface CardProps {<br>  title: string;<br>  children: any;<br>  className: string;<br>}</pre><pre>const Card = (props: CardProps) =&gt; (<br>  &lt;div className={props.className}&gt;<br>    &lt;div=&quot;m<em>arginForSpacing</em>&quot;&gt;<br>      &lt;div&gt;{props.title}&lt;/dib&gt;<br>      &lt;div&gt;{props.children}&lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>)</pre><p>Wrapping the content of the <em>Card</em> with a div having m<em>arginForSpacing,</em> allows<em> </em>us to collapse the spacing of <em>Card </em>and <em>title, </em>effectively<em> </em>avoiding double spacing. Mozilla has made a technical article on <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing">mastering margin collapse</a>.</p><p><strong>Recommendation: </strong>Carefully consider when to use padding or margins for spacing to avoid double spacing. Consider restructuring your component and identify which part should have a specific style.</p><p>Another solution to the problem mentioned above is to create more variants of <em>Typography</em> or override margins with CSS. This can be powerful for simple use cases, but with more complex CSS you can end up breaking: <strong>Encapsulation with CSS</strong></p><p>Let’s say that we want to change the background color of the <em>CardTitle</em>. With the <em>Card</em> created as above, we can only target the title with some sort of CSS child or sibling selector. This means we now depend on the internal structure of a component and can no longer rely on semantic versioning to safely update.</p><p>One of the ways around this is to update the component slightly to follow <a href="http://getbem.com/">BEM</a> naming conventions for classnames.</p><pre>const Card = (props: CardProps) =&gt; (<br>  &lt;div className=&quot;card&quot;&gt;<br>    &lt;div className=&quot;card--content&quot;&gt;<br>      &lt;div className=&quot;card--content--title&quot;&gt;<br>        {props.title}<br>       &lt;/CardTitle&gt;<br>      &lt;div className=&quot;card--content--body&quot;&gt;<br>        {props.children}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>)</pre><p>With this convention, the different parts of a component have been explicitly identified; only these parts should be overridden. <a href="https://material-ui.com/styles/advanced/#overriding-styles-classes-prop">Material-ui</a> has a slightly different solution using JSS.</p><p>The idea of only allowing certain parts of a component to be overwritten is the standard of the latest web capabilities such as Shadow DOM with <a href="https://developers.google.com/web/fundamentals/web-components/shadowdom">WebComponents</a>.</p><p>With <em>WebComponents,</em> the developer is required to explicitly state the p<em>arts</em> that can be manipulated with CSS. Everything else is locked in order to reduce the brittleness of a component.</p><p><strong>Recommendation: </strong>Avoid using CSS overrides with child selectors. Instead, identify different parts of your component and provide an interface for how to override the style of these parts. Breaking this interface is semantically a breaking change for the entire component.</p><p>Identified in the solution above, a <em>Card</em> may exist as a composition of multiple parts such as <em>CardContent </em>and <em>CardTitle.</em> Therefore just passing all the props to a <em>Card</em> could create the problem related to: <strong>Composition &amp; Prop drilling</strong></p><p>Relying on the <em>Card</em> component to provide the props to all the child components can make <em>Card </em>rigid and hard to extend. This problem can however easily be mitigated by changing it to work like the code given below.</p><pre>import { Card, CardContent, CardTitle, CardBody } from &#39;@org/ui-kit&#39; </pre><pre>const MyApp = (props) =&gt; (<br>  &lt;Card&gt;<br>    &lt;CardContent&gt;<br>      &lt;CardTitle&gt;Titles are fun&lt;/CardTitle&gt;<br>      &lt;CardBody&gt;So is body text&lt;/CardBody&gt;<br>    &lt;/CardContent&gt;<br>  &lt;/Card&gt;<br>)</pre><p>Breaking the <em>Card</em> component into multiple smaller parts and exporting these, allows the code to be more flexible as a developer can add content and props to the specific part that needs it.</p><p><strong>Recommendation:</strong> Create components that allow developers to specify props to specific parts of a component. This can be done via providing component instances via props in React or by following the standard DOM and HTML specification for passing in children.</p><h3>Conclusion</h3><p>We have covered a lot in this article, cheers for reading it if you made is this far! Here is the list:</p><ul><li>Performance</li><li>Security</li><li>Spacing</li><li>Encapsulation with CSS</li><li>Composition &amp; Prop drilling</li></ul><p>Lots of deeper details have been left out, so keen on getting feedback on where I need to elaborate. <em>In the meantime</em>:</p><p>Keep looking at successful open source projects and how web standards are evolving - try to understand why some of these solutions have come about. This could help you solve your next problem!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22f10b96a305" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rebuilding the monolith]]></title>
            <link>https://itnext.io/rebuilding-the-monolith-59e54614f070?source=rss-9254dd1e9903------2</link>
            <guid isPermaLink="false">https://medium.com/p/59e54614f070</guid>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[monolithic]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rune Rasmussen]]></dc:creator>
            <pubDate>Tue, 06 Feb 2018 08:08:36 GMT</pubDate>
            <atom:updated>2018-02-20T22:57:23.967Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2msUEoKn33HpWZR_6Pn1w.jpeg" /></figure><p>When building frontend applications we can end up rebuilding our monolith in a new, more fancy, technology. However, no fancy buzz words are gonna save us from the consequence of building a monolith.</p><p><a href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitnext.io%2Frebuilding-the-monolith-59e54614f070"><em>Click here to share this article on LinkedIn »</em></a></p><p>Before we get too deep in this article, i want to give a quick reminder on how important it is to think about in which context/organisation and part of your project your monolith are forming. In some cases a monolith can be a less bad idea than the alternative.</p><h3>Organisation of code</h3><p>So you have decided you want to create a frontend application for your frontend architecture. You have one development team to work on the frontend. How should the project’s folder structure look like?</p><p>It is quite easy to organize files by filetype. In react with redux this means you will have at least the folders: <em>actions, reducers, containers, components</em>. In Angular you are probably familiar with the another structure: <em>component based architecture </em>as described by <a href="https://johnpapa.net/angular-2-styles/"><strong>John Papa</strong></a><strong>. </strong>Each component following the <a href="https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)"><strong>SOLID</strong></a> principles.</p><p>The type based organisation of files is good in the sense that it removes a lot of overhead in terms of naming components and organizing which files belongs to which component. If you want to make an MVP or work within a single development team this might therefore be a good option.</p><h3>Working in a scaled environment</h3><p>When you get to work within a more scaled environment with multiple teams, that should work independently, on the same frontend application, it gets more tricky. You might start to split your project up into different <em>packages </em>alias<em> large components. </em>It is important that each of these <em>packages</em> and its components only operates within a bounded context such as we know it from <a href="https://martinfowler.com/bliki/BoundedContext.html"><strong>Domain-Driven Design</strong></a>. This is because it helps to make teams less coupled and more autonomous, but it does add some overhead in form of time at project planning. This planning can however be a solid investment in form of a stable speed of development and maintainability throughout the lifecycle of the software.</p><p>Not doing the planning can cause code rot, a decreasing development speed and ultimately result in the whole project being ditched.</p><h3>Putting it all together</h3><p>Each of the <em>packages </em>can be viewed as a microservice that can be separately released in different ways. A core project could via tools such as <a href="https://webpack.js.org/"><strong>Webpack</strong></a><strong> </strong>consume all of the published packages. An interesting approach is done by the project <a href="https://github.com/CanopyTax/single-spa"><strong>single-spa</strong></a> that is also framework agnostic. Depending on what you do you might end up with a distributed monolith. The different ways and their respective pitfalls are however worthy of an article of its on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59e54614f070" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/rebuilding-the-monolith-59e54614f070">Rebuilding the monolith</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>