0

I'm currently working in an industry where extensive documentation is required, but the apps I'm writing are all pretty much cookie cutter at a high level. What I'd like to do is build an app that asks a series of questions regarding business rules and marketing requirements to generate a requirements spec.

For example, there might be a question set that asks "Does the user need to enter their age?" and a follow-up question of "What is the minimum age requirement?" If the inputs are "yes" and "18", then this app will generate requirements that look something like this:

"The registration form shall include an age selector" "The registration form shall throw an error if the selected age is less than 18"

Later on down the line, I'd like to extend this to do additional things like generate test cases and even code, but the idea is the same: generate some output based on rules determined by answering a set of questions.

Are there any patterns I could research to better design the architecture of such an application? Is this something that I should be modeling as a finite state machine?

4
  • 2
    You sure it isn't easier to just type "The registration form shall include an age selector" "The registration form shall throw an error if the selected age is less than 18"? Aug 19, 2014 at 19:38
  • In any event, the principle is simple: knowledge-based templates and text substitution. There are plenty of examples of template engines. ASP.NET is one of them. You store the questions and answers in a database. Aug 19, 2014 at 19:39
  • It probably is easier to do so on a small scale, but we have limited resources and an overwhelming number of projects. What I'd like to do is just automate 70% of all the requirement gathering work so we don't have to keep hosting meetings and asking the same questions over and over again for each app. Aug 19, 2014 at 19:41
  • Eventually, this utility will morph into some code generation tool or similar, and before long you will be spending all your time have implemented your own half-backed programming platform, in addition to the software you need to actually make. Aug 19, 2014 at 21:31

1 Answer 1

2

This is not fully baked, but you should get the idea.

Requirements Table:

RequirementID     PK
Question          String
Action            String
Artifact          String
Condition         String
Role              String
Template          String

Example tuple:

Question          "What is the minimum age requirement"
Action            "display an error message"
Artifact          "the registration page"
Condition         "age is less than <$ answer>"
Role              "user"

Responses Table:

ResponseID        PK
RequirementID     FK
ProjectID         FK
Answer            String

Pseudocode

foreach(response in Responses)
{
    // Display template text with text substitution
}

Sample Template text

The application shall <$ Action> on <$ Artifact> when <$ role> is <$ condition>
1
  • Many thanks for your detailed answer! When I was prototyping, I had actually come up with very similar fields as your tables, so I feel a little bit more validated in my approach Aug 19, 2014 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.