paint-brush
Quick, text-based flowcharts for developersby@tewen
13,823 reads
13,823 reads

Quick, text-based flowcharts for developers

by Trevor EwenJuly 27th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

I’m a developer. I like text editors. I like code. I like markup.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Quick, text-based flowcharts for developers
Trevor Ewen HackerNoon profile picture

I’m a developer. I like text editors. I like code. I like markup.

Like many 90s kids, my early skills were forged in the fires of Adobe Dreamweaver, Microsoft FrontPage, and GeoCities. Finding the right mix of WYSIWYG (What you see is what you get) web development seemed to be the theme of the decade. Since then, the consensus for UI work has moved aggressively towards written markup.

On one hand, we have Wix and Squarespace Inc. doing great things with WYSIWYG. Despite that, most developers choose to write their own user interfaces. The elegance, the speed, the simplicity, the hotkeys. For my part, I just don’t like dragging and dropping things with unsteady hands.

It’s for this reason that I experimented recently with the goal of text-based, browser-rendered flowcharts. A web search brought me to a number of sophisticated WYSIWYG tools like LucidChart, Creately, and Draw.io. For founders and creatives alike, I don’t doubt the power of these tools. It’s just that I wanted the developer-friendly solution. I wanted text input, default colors, and default layout.

Enter flowchart.js. This was the library I wanted. It had a simple, text-based data schema that could be consumed by the JavaScript library. The sample routine on the flowchart.js site looks something like this:







st=>start: Starte=>endop1=>operation: My Operationsub1=>subroutine: My Subroutinecond=>condition: Yesor No?io=>inputoutput: catch something...



st->op1->condcond(yes)->io->econd(no)->sub1(right)->op1

And it produces:

I was extremely happy with the outcome. No more drawing lines, no more determining how to draw a shape, no more deciding relative size and distance.

Learning the specifics of the data schema takes a few minutes. It’s elegant and sophisticated enough for my use cases. Here is a more complicated example from the flowchart.js site:









st=>start: Start|past:>http://www.google.com[blank]e=>end: End|future:>http://www.google.comop1=>operation: My Operation|pastop2=>operation: Stuff|currentsub1=>subroutine: My Subroutine|invalidcond=>condition: Yesor No?|approved:>http://www.google.comc2=>condition: Good idea|rejectedio=>inputoutput: catch something...|future





st->op1(right)->condcond(yes, right)->c2cond(no)->sub1(left)->op1c2(yes)->io->ec2(no)->op2->e

With the configuration styles, it produces:

Flowcharts are an incredibly powerful way to model user experience and product flow. Developers should keep a process like this handy in order to dispel present or future arguments. Product people and designers should consider the possibility of moving to text-based flowcharts.

Flowchart.js provides loads of configuration options for colors and appearance. While I encourage you to explore these, they are outside of my use case. My job is building products and stopping arguments. Haven’t seen a case where black & white couldn’t do the job.

For anyone attempting to create a quick, text-based flowchart, I have created a simple web application at textflowcharts.com. I was using the seed project locally, so it made sense to open up the use case.

For anyone attempting to replicate the project, I have assembled a seed project here. Clone or download the repo. Run a quick npm install or yarn, then npm start and you’ll be off to the races. The project pulls data from the data/sample.txt file. You should edit that to match your flow.

I welcome any contributions to the project. It’s very simple, and I’d like the keep it that way. My hope is that developers, designers, and product people find a use case for the seed.

Special thanks Adriano Raiano, creator of flowchart.js. It’s a very awesome project and I am glad he built it.