Also known as Expand and Contract, this is a pattern that can be used to evolve a software design by introducing backwards compatible changes without breaking clients of the existing code. It involves three steps:
- expand (add the new element - class, method, variable);
- migrate (clients of the existing element to use the new one introduced in step 1); and
- contract (remove the old element - class, method, variable)
A more detailed discussion, with examples, may be found in Danilo Sato's article on Parallel Change.
Using Parallel Change, modify the class ShoppingCart
to handle multiple items instead of a single one.
Tests have already been written.
The tests must not be red at any time. No compile-errors, no failures. (The only exception is for a few seconds while you write a single line of code.)