ideally, the two different materials used for a heterojunction would have the same lattice constant (spacing between the atoms). in practice, the lattice constants are typically slightly different (e.g. algaas on gaas), resulting in crystal defects. as an analogy, imagine pushing together two plastic combs with a slightly different spacing. at regular intervals, you'll see two teeth clump together. in semiconductors, these discontinuities form deep-level traps and greatly reduce device performance.