Ross Esmond

Code, Prose, and Mathematics.

portrait of myself, Ross Esmond

Parallel Implementations

Parallel Implementations are two or more implementations of the same software feature that exist in the same code base at the same time. Parallel implementations usually break the maxim of Don’t Repeat Yourself, as they often involve repeated, even copy-pasted code. They are useful, however, when transitioning from one version of a feature to another.

A parallel implemenation can prevent you from having to transition the entire codebase to the new feature in one commit. The process of transitioning to a new version in this way may be called Expand and Contract.

Feature flags may be used to swap between parallel implementations, allowing you to test new features while retaining quick access to the prior implemenation. This approach keeps the control of the feature swap out of the Git process, which can be more cumbersome than a database bit flip.

You may also implement tests which compare the behavior of different implementations to one another, which I call comparison testing. This can be used in conjunction with generative testing to rapidly test many cases for compatibility between versions.

Parallel Implementations rely on code being able to coexist in a system without breaking one another. Pure functions can often make this simpler, though it is not strictly necessary. Your ability to maintain parallel implementations will depend on the quality of your interface, and often parallel implementations will force you to improve this interface. In Object Oriented Programming, the Strategy Pattern will help to facilitate Parallel Implementations. The State Pattern is necessary, though, if hot swapping of implementations is desired.


Parallel Change by Martin Fowler Parallel Implementation by John Carmack