Worked Python example

A checkout refactor that a source-order diff makes harder to review

Functions moved, variables changed, one helper was renamed, and tax calculation was added. AlignDiff keeps related blocks together so the edits that matter remain visible.

Marketing overview of AlignDiff structure-aware code comparison
A compact overview of the product. The actual comparator output for this example appears below.

The refactor

Three kinds of change are mixed together

A conventional source-order view can make movement look like deletion and insertion. AlignDiff first pairs related structures, then displays the detailed line changes inside those pairs.

Moved + modified

The order-total function changed and moved

Its parameter and local names changed, and a tax calculation was added.

Renamed

A helper kept the same behaviour

calculate_total became compute_total while its body stayed aligned.

Inserted

A new tax helper appeared

The new function remains one-sided instead of shifting unrelated code out of alignment.

Actual comparator output

Related functions stay in the same horizontal lane

This is a snapshot of the result produced by aligndiff.com for the worked example—not a hand-built before-and-after code layout.

Actual AlignDiff aligned-file result for the checkout refactor
Actual AlignDiff output: moved and modified code is paired, the rename is isolated, and the inserted helper remains one-sided. Select the image to inspect it at full size.
1

Movement is separated from editing

calculate_order_total stays paired with its counterpart even after moving.

2

The rename stays reviewable

calculate_total and compute_total appear together as a renamed structure.

3

New code remains visibly new

calculate_tax is shown as an inserted block without creating false pairings.

Private by design

Your source stays in the browser

AlignDiff parses, matches, and compares source locally. The comparison flow does not upload or execute the code you provide.

Compare code locally

Review the refactor, not the movement

Paste two Python, JavaScript, or TypeScript files and inspect the structural pairs AlignDiff finds.

Open AlignDiff