Robert C. Martin: The current best explanation for the origin of the moon is a collision of two protoplanets 4.5 billion years ago.

As Martin notes, the protoplanets have likely melted due to energy released in that collision.

The massive core of the protoplanet that crashed into the early Earth penetrated the crust and fused with the core of the Earth.

A curious corollary may follow from that hypothesis. The side of the Earth where the Mars-sized planetoid hit it 4.5 billion years ago can differ in a particular way from the rest of the planet. That difference can be the composition of Earth's outer layers - or thickness of its crust, at the particular point of impact!

On the other hand, in 2013 Nature published a compilation of evidence that disagrees with the hypothesis known as "giant impact" at some points - so the matter is not yet concluded.

As Robert C. Martin notes, we may never know exactly how the Moon was formed - but it is stunning to imagine the thrill of being there and observing the moment of Moon's formation.

Source: Clean Coder's TDD — Part 1