# Module: Lookout::Diff

- Defined in:
- lib/lookout-3.0/diff.rb

## Overview

Namespace for the “diff” subsystem. Includes various algorithms for generating “diffs” and output formats for displaying them. Used by Difference to generate meaningful “diffs” of objects.

A “diff” is a sequence of Operations that describe how to turn an old/original/from version of a structure, such as an Array, to a new/new/to version of that structure. For example, if the old version of an Array is [1, 2, 3] and the new version of that array is [1, 2, 3, 4], then the “diff” is a sequence of operations containing one operation, the insertion of the element 4 at the end of the Array.

A “diff” is generated by one of various Algorithms that calculate optimal sequences of operations, for some definition of “optimal”. A common goal is to provide the shortest sequence of operations necessary, but providing a sequence that “feels natural” to a human is often also a priority. The algorithms work by looking for Matches between Slices of the sequences and then turning the information provided by these matches into the operations that describe the changes that need to be made.

“Diffs” can be turned into quite a few different textual Formats for display to a human. Such formats may Group together related Groups of operations, focusing the display on the actual differences.

You can find more information about “diffs” at http://en.wikipedia.org/wiki/Diff.

## Defined Under Namespace

**Modules:** Algorithms, Formats
**Classes:** Group, Groups, Match, Operation, Operations, Slice