How to Write a speculative application