If you don’t know what to name your module it’s probably too big

David Björklund
Mic Product Blog
Published in
2 min readFeb 23, 2016

At Mic we have our own CMS and WYSIWYG article editor. While it works fine, it’s been a bit of a pain working with the ContentEditable APIs.

For example, <p><span style=”font-style=italic”>beep</span></p> and <p><i>beep</i></p> would both be normalized to <p><em>beep</em></p>.

I tested different approaches and got something going. It worked surprisingly well for a prototype! The parsing, normalizing and rendering approach was good enough to handle HTML from both Google Docs and Microsoft Word without any special rules. I used Virtual DOM so that updating the original HTML with normalized HTML was efficient and smooth.

The problem was that I didn’t know what to name the project. My module didn’t just handle WYSIWYG. It also parsed and normalized HTML, and I wanted the name to reflect that. I held off releasing the module as open source, figuring I’d come up with a good name later on.

A neither short nor memorable name

The problem was that I didn’t know what to name the project. My module didn’t just handle WYSIWYG. It also parsed and normalized HTML, and I wanted the name to reflect that. I held off releasing the module as open source, figuring I’d come up with a good name later on.

Fast forward a few months, and we’re about to get started with our AMP integration. As part of this, we wanted a way to go from HTML to structured JSON and then render AMP HTML.

For this project, the parsing and normalization from the WYSIWYG editor was a perfect fit. So I removed all the rendering from that module and released a new module. This time around, thinking about a name was a lot simpler. It’s a module that takes in HTML and returns JSON, describing an article. So we named it html-to-article-json.

What would you name this?

The Future

Now I’m working on a new WYSIWYG editor based upon the same idea that I had back in September 2015. This time around I’m doing it in smaller steps, in smaller modules.

We released our AMP integration as Open Source. We have broken out the base that renders our article JSON to HTML as article-json-html-render, which I’m now using as part of the WYSIWYG.

Breaking my previous, larger, multi-purpose module out into what became functional subcomponents that delivered specific, specialized value was the right decision. It taught me that if I don’t know what to name a project, it’s probably because the project is doing too much.

--

--

David Björklund
Mic Product Blog

I like to run, drink quality coffee and complain about my allergies. Also engineer at mic.com #yolo