[Article] RFC: Refactoring flows - with inline flow images!

Nice to see people writing blog posts for node-red :slight_smile:

Refactoring IS quite often discussed but rarely, if ever, is it called that because that is a techie developer phrase. :grin:

I think, though that you missed possibly the most important tool for refactoring - the link nodes.

Refactoring flows often starts with tidying the layout and then realising just how much duplication or redundancy you ended up with. Link nodes can help both with the tidying and with de-duplication.

Many of us much prefer linked flows to sub-flows in any case because the use of sub-flows actually DOES introduce duplication (each instance of the subflow being a duplicate of course).

As with traditional code, flow designers are likely to read flows far more than they ever amend them and so layout is critical to rapid understanding and memory of what the flow does. The use of groups (with titles) and comment nodes further enhances (when you do it right!) the comprehension. Personally, I would include all of this under the topic of refactoring.

2 Likes