Before students try to write code that solves a problem, make sure that they can solve the problem by hand. This can involve writing test cases that show that they can predict the expected behavior. You can also have students describe or draw the output of an algorithm.
Example: "Before coding, test your understanding of the algorithm."
See this and related tips as a Tip Sheet: http://csteachingtips.org/tips-for-assessing-programming