Imagine code that produces code! Good Code!

I think we should write more code, that writes code for us! Let me explain why.

We love coding, we try to write as much code as possible. LOC is the ultimate measurement of your awesomeness. But how many of us write code that creates code for us?

We love using tools/frameworks etc to aid our writing of course, but limit ourselves to writing these tools.

I’ve recently been looking at Storybook 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.

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?

But I can sharpen pencils too

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 the alternative! Why not create the scaffolds? Each codebase has a style, 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.

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.

Why do we want to do this ourselves?

Anyone can do this!

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?

Yes, Storybook 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?

Leave a Reply

Your email address will not be published. Required fields are marked *