Tangents are opportunities for other lessons. When you find yourself drifting off-topic because you feel you need to explain some code you wrote, consider how that piece of code fits back into a "How do I?" question, then come up with a separate lesson to capture it.