Patents are required to be both "novel" (no one has done it before) and "non-obvious" (a typical software engineer wouldn't have thought of it). These seem to cover it pretty well to me, except that novelty is trivial to find in the software world and the bar for obviousness seems to be completely ignored; I've never heard of a software patent so obvious it was rejected.