Most tasks are too complex for us to think about all at once. The solution is to break tasks into pieces. Break the pieces into pieces, until we get to pieces that are small enough to fit into our brains. Often there's an existing pattern that makes it easier to create each piece.
When the pieces are done, you want them to fit together to complete the original task. In programming, that means making sure that each piece provides what the next piece needs.