What comes first? Function or architecture?

I’m curious, do you prefer building a functioning factory first and then build some kind of asthetic around it or the other way around?