The first step to write good code is to define a clear boundary between systems. A boundary that allows you to freely explore the problem without breaking existing functionalities.

The second step to write good code is to explore the problem thoroughly via iteration. Your first 2~3 solutions will be bad because you don’t understand the problem yet.

Kick-off a feedback-loop as early as possible. Good code, just like good design, need iteration and learning.