Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have come across many blogs and books where it is stated that it is bad for a system requirement to contain conjunctions like "and". However in reality I am often coming across scenario where a requirement is satisfied when a certain set of conditions are met. For instance, Shopkeeper should sell alcohol only if the buyer is older than 18 years, he has the necessary proof and he does not have any alcohol related problems. The requirement would not be complete if I break it down into multiple system requirements and I cannot complete the requirement without use of "and".

share|improve this question
add comment

3 Answers

There is no reason that all the conditions have to be one requirement.

  • The system shall sell alcohol only to those older than 18.
  • The system shall require proof of age to sell alcohol.
  • The system Shall not sell alcohol to those with alcohol related problems.

These are all perfectly valid requirements, and the system is not valid unless it meets all the requirements. System requirements are all implicitly connected with an "and" its why the are requirements and not wishes. Furthermore by expanding each condition to its own requirement it is far easier to track what has and hasn't been met this way because each requirement is a binary yes or no.

share|improve this answer
    
Thanks Ryathal! When writing test cases , wouldn't the QA team write test cases for each requirement? Shouldn't the system requirement be testable on its own? Should QA team combine all these related system requirements and have a single test case to have test a successful scenario? –  Punter Vicky Feb 12 '13 at 15:36
    
System requirements are all implicitly connected with an "and" In my experience that depends on who actually writes the requirements. Some people will write out a bulleted list like that and they assume that the conditions are a disjunction. Others will write it out and assume they are conjunction. I prefer it to be spelled out clearly: "The system shall sell alcohold only to those older than 18 AND shall require proof of age AND..." –  FrustratedWithFormsDesigner Feb 12 '13 at 15:44
    
Thank You. I assume if there multiple logical conditions (involving && and ||), it is better to write it in a single line? I also assume use of conjunctions is prohibited primarily to join to different functionality and is acceptable as long as it is a logical condition. –  Punter Vicky Feb 12 '13 at 15:50
    
@FrustratedWithFormsDesigner its only a requirement if it is an and, it can't possibly be anything else, optional requirements don't exist. –  Ryathal Feb 12 '13 at 16:58
    
@Ryathal: Optional requirements exist in the sense of "A OR B OR C" - not all of them are required, but at least one of them is required. And I have seen such requirements written as you listed above. I really do prefer if there is a sentence to say "All of these conditions must be met" (implying AND) or "At least one of these conditions must be met" (implying OR). If only I could get certain coworkers to agree to do this.... ;) –  FrustratedWithFormsDesigner Feb 12 '13 at 18:23
show 1 more comment

You could phrase it as a tree. This avoids any sort of grouping ambiguity in natural language.

  1. Alcohol can be sold if the buyer meets all of the criteria
    1. Buyer is older than 18 years.
    2. Buyer has the necessary proof of age.
    3. Buyer does not have any alcohol related problems.

This approach also works well for or(One of the following), and nested items.

share|improve this answer
    
+1 I like the way this is phrased. –  FrustratedWithFormsDesigner Feb 12 '13 at 15:45
    
Thanks Sign!!!! –  Punter Vicky Feb 12 '13 at 16:06
    
If you've ever had to do requirement traceability matrixes you would find that the way Ryathal suggests is superior to using this list based approach. You want to easily be able to track each requirement on its own. Lists make that next to impossible and can cause issues with copy and pasting between various applications/tools. A full sentence using AND for each of the list items would be far more preferable than the above. But separate requirements are even better, per Ryathal's example. –  Dunk Feb 12 '13 at 20:42
add comment

Consider using both approaches (stand-alone and conjunctive) for your rules.

Using the example you cited, you would have three stand-alone rules:
1. only if the buyer is older than 18 years
2. has the necessary proof of identification
3. does not have any alcohol related problems

And then have a conjunctive rule for all three of the stand-alone rules.

  • 1 + 2 + 3 == true

Your stand-alone rules represent the core of your system requirements. The conjunctive rules represent a higher level or requirements that could change based upon the jurisdiction.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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