Code creation, try it!
Tags: discuss, beginners, productivity, webdev
Published: 2019-06-25 08:48:05

<!-- wp:paragraph -->
<p>I think we should consider the option of <strong>writing code</strong>, that writes code for us! Let me explain why.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We love coding,  we try to write as much code as possible. LoC is the <strong>ultimate measurement</strong> of your awesomeness. 😊 But how many of us write code that creates code for us?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>We love using tools/frameworks etc to aid our writing of course, but limit ourselves to writing these tools.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I've recently been looking at <a href="https://storybook.js.org/">Storybook </a>to help automate the creation of a demo app for our UI library. Currently, this is a manual task creating pages and implementing the components and variations needed.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I've been told that it's not difficult and doesn't take very long. My first thought was, well why haven't we automated it then?</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="http://i.imgur.com/cPw6cAK.gif" alt="Related image"/><figcaption>But I can sharpen pencils too</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Automation seems to have been swallowed by testing. Developers no longer use it as a tool in their arsenal. We’ll happily scaffold using AngularCLI or&nbsp;the alternative! <strong>Why not create the scaffolds</strong>? Each codebase has a style,&nbsp;and each company does things their own way, so they should create tooling. Let’s end the notion of style guides and lengthy how to’s to follow.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/1600/1*1hT23VteSYhRbOaUtCcuEg.gif" alt="Image result for automation gif"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>A component has a template and some inputs. You could create a simple config file, be that in JSON, YAML, JavaScript, hell any language you choose that could parse those inputs and create those pages dynamically.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Why do we want to do this ourselves?</strong></h2>
<!-- /wp:heading -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://media0.giphy.com/media/KpACNEh8jXK2Q/giphy.gif" alt="Image result for code monkey gif"/><figcaption>Anyone can do this!</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>This sort of grunt work doesn't give us any satisfaction, but writing a tool to do this for us, packaging, styling and deploying it would be awesome. Maybe it's the inherent difference between a web developer and software engineer? I don't know, I've always thought these titles are interchangeable, is this not the case? Is it that JavaScript is not thought of in this way yet?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Yes, <a href="https://storybook.js.org/">Storybook </a>gives us this functionality, and it seems to do a pretty good job at it too. I just worry that we expect everything built for us these days. We seem to have forgotten that we can build them ourselves, exactly as we want. Lightweight, customisable, geared specifically to our use case. Even if we do not, it's at least worth considering no?</p>
<!-- /wp:paragraph -->

I guess this follows on slightly from Bens Post the other week.

{% link https://dev.to/ben/invest-in-building-custom-tools-3430 %}

How many people do this currently? What are the main positives and negatives from this approach? Would you do it again?