So after watching some handmade hero and reading some of Casey's blog posts, I'm really excited to try and start thinking and working with the compression oriented mindset. However, I'm trying to understand how his two ideas of compression oriented programming and 'writing usage code first' come together.
In his compression oriented blog posts Casey says to first write the simplest code you can that works and then go back and 'compress' duplicate code into functions/structs where appropriate. This way the code can sort of guide you to creating appropriate functions/structs for the situation at hand. Then if you find you need to expand your api later on you should always at least consider just writing new functions on top of the functions you've already written, instead of going back and changing your original functions. This way your api won't have any granularity discontinuities meaning that there will always be lower level functions to supplement higher level functions in case someone needs to access some lower level functionality.
However he also advocates to ALWAYS write the usage code first and work towards those original ideas of how the api should be structured. Don't these two ideas sort of conflict with one another? If I'm trying to think of functions/structs to write for my api from the start, then I'm sort of pre-planning my api design instead of letting the code guide me to what's appropriate. So when I'm I suppose to have the compression oriented mindset and when should I be trying to write the usage code first?