A common complaint about software patents are that they overly broad and abstract. We often cite this as a reason why the patent law needs to be changed. But actually, the law is there, it is just not being applied.

From the US Patent Office,

The specification must include a written description of the invention and of the manner and process of making and using it, and is required to be in such full, clear, concise, and exact terms as to enable any person skilled in the technological area to which the invention pertains, or with which it is most nearly connected, to make and use the same.

https://www.uspto.gov/patents-getting-started/general-information-concerning-patents

For software, the way to describe something in “full, clear, concise, and exact terms” is to show the actual source code demonstrating the concept. For simple concepts a mere description may be enough, but for anything novel enough to be patentable it is highly unlikely that anything less than the source code would be sufficient.

Note that when I say “open source” I mean the source code can be viewed and is not treated as a trade secret. You can still keep your copyrights and you should not obligated to offer a “free and open source license”, as that would defeat the purpose of the patent from the applicant’s viewpoint.

At the same time, not revealing the source code at all defeats the purpose from society’s viewpoint. The reason we offer patent protection is so that companies will reveal how their technology is implemented so that, once the patent expires, others may copy it.

In conclusion, if a competent programmer cannot recreate your idea using the information in the patent, then the patent should be considered insufficient and thus invalid.