Generating code from software requirements: Is it possible?

Software requirements, descriptions of features that will solve a problem, are not necessarily transferable into coding languages. Requirements management expert Scott Sehlhorst explains the nature of requirements and availability of tools that generate code in this response.

Are there tools available that will generate code from requirements?

Yes and no. Yes, there are tools that will generate source code in a particular language. However, all they are really doing is translating code from a syntax that is presumably easier to document into code in another language. I've even written one before that translated specifications from a spreadsheet to compiled source code. The inputs to the translator, however, are not requirements. So the answer is no.

A requirement is a description of a problem that someone wants to solve. In product management, we say "...a problem that someone is willing to pay to solve."  After identifying the problem (the requirement), you have to define the capabilities that your product should have -- given a particular approach (i.e. a design) to solving the problem with your product. Reasonable people disagree, but you could contend that this description of a capability is a requirement. "I need to remove leaves from my gutter" is the requirement, and "Enable someone to reach their hand into the gutter" is the capability that a ladder manufacturer would define. "Prevent leaves from entering the gutter" is the capability that a gutter-screen manufacturer would define.

You can't create code that solves a problem -- manually or automatically -- without having first designed the approach to solving that problem, and then design how the code will embody that approach. There are creative -- and possibly innovative -- steps involved in both of those design decisions. Using our gutter example, the first decision is the choice of "climb up to the gutter" versus "prevent the leaves from becoming an issue." You cannot mechanically generate that decision.

Ultimately, the issue is that a generator can only really translate syntax -- literally, it is a compiler. And it must follow a set of precepts that precisely defines how each input would lead to a specific output. The generator processes a set of instructions that say "build it like this." The instructions are an inside-out view of "[The code] will perform these actions, in those situations." Requirements are outside-in descriptions of "[The user] needs a problem to be solved." The concepts are different; you can't translate from one to the other.

Dig Deeper on Topics Archive