Top-down, what-if development
You want to write code from the top down. You start with the highest level code. Those one or two lines of code that will make everything work. Then you write what you would want and write your code that way. Because you are going top down, you're creating objects that don't exist and calling nonexistent methods on them. Doing this lets you define the usage before building the thing. Then you go down a level and repeat this process.
Your code as a product
You want to think of the methods you write, the objects you create, the APIs you design, and everything else as a product. Even if it's just you using it, imagine someone else will use it. This will lead to question such as
- Does this name make sense? Or is it obvious?
- How much work is it to use this? Am I creating an unnecessary burden on the user? Could I make this easier to use?
- How would someone want this to work? Does it work the way they would want it? Can I move this a step further in th