It helps if you use a technique called functional programming. Functional programming means avoiding side effects. It’s something you’re more likely to see in research papers than commercial software, but for web-based applications it turns out to be really useful.