<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://commons.oreilly.com/wiki/skins/common/feed.css?97"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;action=history&amp;feed=atom</id>
		<title>From Requirements to Tables to Code and Tests - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;action=history"/>
		<updated>2013-06-19T00:05:49Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.11.0</generator>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25177&amp;oldid=prev</id>
		<title>Kevlin at 18:36, 6 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25177&amp;oldid=prev"/>
				<updated>2009-08-06T18:36:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 18:36, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;else&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/del&gt;statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! I want to focus here on business logic. It is the execution of the business logic which delivers the value of an application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;else&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! I want to focus here on business logic. It is the execution of the business logic which delivers the value of an application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This is &lt;/del&gt;a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;big step forward from conventional &lt;/del&gt;requirements &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;capture. We &lt;/del&gt;can ''prove'' completeness! &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;A concrete example could be a simple Insurance Category. An Insurance quote might depend on   Age ( less than or greater than 21), Accident History (accident or not in the last year), Value of vehicle (Less than £300 or not). This gives 8 combinations, each of which must have an Action. We know this is complete, from the mathematics and we can simply show our logic in a table form.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Given such &lt;/ins&gt;a requirements &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;model we &lt;/ins&gt;can ''prove'' completeness!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Assuming that the requirements are captured in this form then we have an opportunity to (largely) automate the code generation process. In doing this we have massively reduced the gap between the business&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;-&lt;/del&gt;community and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;By feeding &lt;/del&gt;this back to the user &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; in a constructive manner&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;of course &amp;amp;mdash; &lt;/del&gt;we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Assuming that the requirements are captured in this form&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;then we have an opportunity to (largely) automate the code generation process. In doing this we have massively reduced the gap between the business community and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Feeding &lt;/ins&gt;this back to the user, we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;We should explore the alternatives for coding a decision table. We can &lt;/del&gt;write (or generate) conventional ''if-then-else'' logic&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. This is just one choice&lt;/del&gt;. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship between the decision table used for requirements specification and its implementation, still reducing the gap between specification and implementation even more. Of course, there is nothing that says the table need be in memory &amp;amp;mdash; we could store it in a relational database, and then access the appropriate table and index directly to the set of actions.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;For implementation, one choice would be to &lt;/ins&gt;write (or generate) conventional ''if-then-else'' logic. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship between the decision table used for requirements specification and its implementation, still reducing the gap between specification and implementation even more. Of course, there is nothing that says the table need be in memory &amp;amp;mdash; we could store it in a relational database, and then access the appropriate table and index directly to the set of actions&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. The general idea is to try to capture logic in a tabular form, and interpret it at runtime. You can also have runtime modification of table content&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;I hope that you can see where this is going. The general idea is &lt;/del&gt;to &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;try to capture logic in a tabular form, and interpret it at run-time. You can of course have (simple) real-time modification of table content.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;And so &lt;/ins&gt;to testing. If the code generation process from the table has been largely automated, there is little need to path test &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;all &lt;/ins&gt;the possible paths through the table. The code is the table&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;the table is the code. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Certain &lt;/ins&gt;tests need to be done, but these are more along the lines of configuration management &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and reality checking &lt;/ins&gt;than &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;path testing&lt;/ins&gt;. The total test effort is significantly reduced because we have moved the work into unambiguous requirements specification.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Finally, &lt;/del&gt;testing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;should rear its ugly head, of course&lt;/del&gt;. If the code generation process from the table has been largely automated, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;then &lt;/del&gt;there is little need to path test the possible paths through the table . The code is the table&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;the table is the code. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Of course certain &lt;/del&gt;tests need to be done, but these are more along the lines of configuration management than &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;logic exercise&lt;/del&gt;. The total test effort is significantly reduced because we have moved the work into unambiguous requirements specification.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;run-time &lt;/del&gt;environments with natural &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;English &lt;/del&gt;translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;runtime &lt;/ins&gt;environments with natural &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;language &lt;/ins&gt;translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25171&amp;oldid=prev</id>
		<title>Gbcambridge at 15:18, 6 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25171&amp;oldid=prev"/>
				<updated>2009-08-06T15:18:52Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:18, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness! A concrete example could be a simple Insurance Category. An Insurance quote might depend on   Age ( less than or greater than 21), Accident History (accident or not in the last year), Value of vehicle (Less than £300 or not). This gives 8 combinations, each of which must have an Action. We know this is complete, from the mathematics and we can simply show our logic in a table form.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness! A concrete example could be a simple Insurance Category. An Insurance quote might depend on   Age ( less than or greater than 21), Accident History (accident or not in the last year), Value of vehicle (Less than £300 or not). This gives 8 combinations, each of which must have an Action. We know this is complete, from the mathematics and we can simply show our logic in a table form.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Further, if &lt;/del&gt;the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;user &lt;/del&gt;and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. By feeding this back to the user &amp;amp;mdash; in a constructive manner, of course &amp;amp;mdash; we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Assuming that &lt;/ins&gt;the requirements are captured in this form then we have an opportunity to &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/ins&gt;largely&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;) &lt;/ins&gt;automate the code generation process. In doing this we have massively reduced the gap between the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;business-community &lt;/ins&gt;and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. By feeding this back to the user &amp;amp;mdash; in a constructive manner, of course &amp;amp;mdash; we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;can &lt;/del&gt;explore the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;code generated from &lt;/del&gt;a decision table. We can write (or generate) conventional ''if-then-else'' logic. This is just one choice. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship between the decision table used for requirements specification and its implementation. Of course, there is nothing that says the table need be in memory &amp;amp;mdash; we could store it in a relational database, and then access the appropriate table and index directly to the set of actions.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;should &lt;/ins&gt;explore the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;alternatives for coding &lt;/ins&gt;a decision table. We can write (or generate) conventional ''if-then-else'' logic. This is just one choice. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship between the decision table used for requirements specification and its implementation&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, still reducing the gap between specification and implementation even more&lt;/ins&gt;. Of course, there is nothing that says the table need be in memory &amp;amp;mdash; we could store it in a relational database, and then access the appropriate table and index directly to the set of actions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I hope that you can see where this is going. The general idea is to try to capture logic in a tabular form, and interpret it at &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;runtime&lt;/del&gt;. You can of course have (simple) real-time modification of table content.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I hope that you can see where this is going. The general idea is to try to capture logic in a tabular form, and interpret it at &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;run-time&lt;/ins&gt;. You can of course have (simple) real-time modification of table content&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Finally, testing should rear its ugly head, of course. If the code generation process from the table has been largely automated, then there is little need to path test the possible paths through the table . The code is the table, the table is the code. Of course certain tests need to be done, but these are more along the lines of configuration management than logic exercise. The total test effort is significantly reduced because we have moved the work into unambiguous requirements specification&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full run-time environments with natural English translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full run-time environments with natural English translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25169&amp;oldid=prev</id>
		<title>Gbcambridge at 15:12, 6 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25169&amp;oldid=prev"/>
				<updated>2009-08-06T15:12:01Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:12, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &amp;quot;else&amp;quot; statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! I want to focus here on business logic. It is the execution of the business logic which delivers the value of an application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &amp;quot;else&amp;quot; statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! I want to focus here on business logic. It is the execution of the business logic which delivers the value of an application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness!&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness! &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;A concrete example could be a simple Insurance Category. An Insurance quote might depend on   Age ( less than or greater than 21), Accident History (accident or not in the last year), Value of vehicle (Less than £300 or not). This gives 8 combinations, each of which must have an Action. We know this is complete, from the mathematics and we can simply show our logic in a table form.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. By feeding this back to the user &amp;amp;mdash; in a constructive manner, of course &amp;amp;mdash; we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing: decision tables, which have been around for at least 40 years! Although there are processors around for decision tables, they are not necessary to get many of the benefits. For example, the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the decision table representation. By feeding this back to the user &amp;amp;mdash; in a constructive manner, of course &amp;amp;mdash; we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:25167:newid:25169 --&gt;
&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25167&amp;oldid=prev</id>
		<title>Gbcambridge at 15:09, 6 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25167&amp;oldid=prev"/>
				<updated>2009-08-06T15:09:07Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:09, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &amp;quot;else&amp;quot; statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Now &lt;/del&gt;I want to focus here on &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;the &lt;/del&gt;business logic&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, not &lt;/del&gt;the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;interconnecting tissue. The &lt;/del&gt;execution of the business logic delivers the value of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;our &lt;/del&gt;application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. Many reasons are given for this: a lack of clarity on the part of the user; incomplete or inadequate requirements; misunderstandings on the part of the developer; catch-all &amp;quot;else&amp;quot; statements; and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! I want to focus here on business logic&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. It is &lt;/ins&gt;the execution of the business logic &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;which &lt;/ins&gt;delivers the value of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;an &lt;/ins&gt;application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness!&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &amp;amp;mdash; say, evaluation of a client or a risk, or simply the next step in a process &amp;amp;mdash; there are some criteria that, when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form: a list of the criteria, ''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;'', ''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;'', ..., ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' and a list of corresponding actions. Then for each combination of criteria we have a selection of actions, ''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''. If each of the criteria is simply a condition that evaluates to a Boolean, we know that there are possibly 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can ''prove'' completeness!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25163&amp;oldid=prev</id>
		<title>Gbcambridge: Consider Table-Driven Logic moved to From Requirements to Tables to Code and Tests: Kevlin said so!</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25163&amp;oldid=prev"/>
				<updated>2009-08-06T15:06:26Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/index.php/Consider_Table-Driven_Logic&quot; title=&quot;Consider Table-Driven Logic&quot;&gt;Consider Table-Driven Logic&lt;/a&gt; moved to &lt;a href=&quot;/wiki/index.php/From_Requirements_to_Tables_to_Code_and_Tests&quot; title=&quot;From Requirements to Tables to Code and Tests&quot;&gt;From Requirements to Tables to Code and Tests&lt;/a&gt;: Kevlin said so!&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:06, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25134&amp;oldid=prev</id>
		<title>Kevlin at 09:41, 6 August 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=25134&amp;oldid=prev"/>
				<updated>2009-08-06T09:41:32Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 09:41, 6 August 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;I guess I do not need to elaborate on all of the reasons as they are pretty well known. However, some key &lt;/del&gt;reasons are lack of clarity on the part of the user &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;..&lt;/del&gt;incomplete &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;/ &lt;/del&gt;inadequate requirements &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/del&gt;misunderstandings on the part of the developer &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;.. &lt;/del&gt;catch-all &amp;quot;else&amp;quot; statements and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Many &lt;/ins&gt;reasons are &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;given for this: a &lt;/ins&gt;lack of clarity on the part of the user&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;incomplete &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;or &lt;/ins&gt;inadequate requirements&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;misunderstandings on the part of the developer&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;catch-all &amp;quot;else&amp;quot; statements&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;; &lt;/ins&gt;and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;We can imagine that for some circumstance, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;say &lt;/del&gt;evaluation of a client&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;or a risk, or simply the next step in a process&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;there are some criteria &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;which &lt;/del&gt;when satisfied, determine one or more&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/del&gt;actions to be performed. It would be convenient to capture the requirements in this form&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;... &lt;/del&gt;a list of the criteria, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;C1&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;C2&lt;/del&gt;,... &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Cn &lt;/del&gt;and a list of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Actions&lt;/del&gt;. Then for each combination of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Criteria &lt;/del&gt;we have a selection of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Actions&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Am&lt;/del&gt;. If each of the criteria is a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;boolean&lt;/del&gt;, &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;then &lt;/del&gt;we know that there are possibly 2 &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;raised to the nth power of &lt;/del&gt;possible criteria combinations to be addressed &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(depending on the number of possible states of each of the criteria. For now we assume simple boolean states)&lt;/del&gt;. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;This is a big step forward from conventional requirements capture. We can &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/del&gt;prove&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/del&gt;completeness! &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little. We can imagine that for some circumstance &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; say&lt;/ins&gt;, evaluation of a client or a risk, or simply the next step in a process &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;there are some criteria &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;that, &lt;/ins&gt;when satisfied, determine one or more actions to be performed. It would be convenient to capture the requirements in this form&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: &lt;/ins&gt;a list of the criteria, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''C&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;''&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''C&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;''&lt;/ins&gt;, ...&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, ''C&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;'' &lt;/ins&gt;and a list of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;corresponding actions&lt;/ins&gt;. Then for each combination of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;criteria &lt;/ins&gt;we have a selection of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;actions&lt;/ins&gt;, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''A&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;''&lt;/ins&gt;. If each of the criteria is &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;simply a condition that evaluates to &lt;/ins&gt;a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Boolean&lt;/ins&gt;, we know that there are possibly 2&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; &lt;/ins&gt;possible criteria combinations to be addressed. This is a big step forward from conventional requirements capture. We can &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;prove&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;completeness!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;.. they run under the heading of Decision Tables and &lt;/del&gt;have been around for at least 40 years!&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;: decision tables, which &lt;/ins&gt;have been around for at least 40 years! Although there are processors around for &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;decision tables&lt;/ins&gt;, they are not necessary to get many of the benefits. For example&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;decision table &lt;/ins&gt;representation. By feeding this back to the user &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;in a constructive manner&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;of course &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Although there are processors around for &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Decision Tables&lt;/del&gt;, they are not necessary to get many of the benefits. For example the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;DT &lt;/del&gt;representation. By feeding this back to the user &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(&lt;/del&gt;in a constructive manner of course&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;), &lt;/del&gt;we can overcome some of the tension in the relationship.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We can explore the code generated from a &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Decision Table&lt;/del&gt;. We can write (or generate) conventional &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot;&lt;/del&gt;if - then - else&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;quot; &lt;/del&gt;logic. This is just one choice. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;between the decision table used for requirements specification and its implementation. Of course there is nothing that says the table need be in memory &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; ---&lt;/del&gt;we could store it in a relational database, and then access the appropriate table and index directly to the set of actions. &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We can explore the code generated from a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;decision table&lt;/ins&gt;. We can write (or generate) conventional &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;if-then-else&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;logic. This is just one choice. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship between the decision table used for requirements specification and its implementation. Of course&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, &lt;/ins&gt;there is nothing that says the table need be in memory &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;mdash; &lt;/ins&gt;we could store it in a relational database, and then access the appropriate table and index directly to the set of actions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I hope that you can see where this is going. The general idea is to try to capture logic in a tabular form, and interpret it at &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;run-time&lt;/del&gt;. You can of course have (simple) real-time modification of table content. &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;I hope that you can see where this is going. The general idea is to try to capture logic in a tabular form, and interpret it at &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;runtime&lt;/ins&gt;. You can of course have (simple) real-time modification of table content.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full run-time environments with natural English translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full run-time environments with natural English translation to generate rule tables for interpretation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;By [[George Brooke]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This work is licensed under a [http://creativecommons.org/licenses/by/3.0/us/ Creative Commons Attribution 3] &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Back to [[97 Things Every Programmer Should Know]] home page&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Kevlin</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23589&amp;oldid=prev</id>
		<title>Gbcambridge: Table-driven logic is safe and fast</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23589&amp;oldid=prev"/>
				<updated>2009-03-04T13:38:02Z</updated>
		
		<summary type="html">&lt;p&gt;Table-driven logic is safe and fast&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:38, 4 March 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little.  We can imagine that for some circumstance, say evaluation of a client, or a risk, or simply the next step in a process, there are some criteria which when satisfied, determine one or more, actions to be performed. It would be convenient to capture the requirements in this form... a list of the criteria, C1, C2,... Cn and a list of Actions. Then for each combination of Criteria we have a selection of Actions, Am. If each of the criteria is a boolean, then we know that there are possibly 2 raised to the nth power of possible criteria combinations to be addressed (depending on the number of &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;possibel &lt;/del&gt;states of each of the &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;criteris&lt;/del&gt;. For now we assume simple boolean states).  This is a big step forward from conventional requirements capture. We can [[prove]] completeness!  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little.  We can imagine that for some circumstance, say evaluation of a client, or a risk, or simply the next step in a process, there are some criteria which when satisfied, determine one or more, actions to be performed. It would be convenient to capture the requirements in this form... a list of the criteria, C1, C2,... Cn and a list of Actions. Then for each combination of Criteria we have a selection of Actions, Am. If each of the criteria is a boolean, then we know that there are possibly 2 raised to the nth power of possible criteria combinations to be addressed (depending on the number of &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;possible &lt;/ins&gt;states of each of the &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;criteria&lt;/ins&gt;. For now we assume simple boolean states).  This is a big step forward from conventional requirements capture. We can [[prove]] completeness!  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing .. they run under the heading of Decision Tables and have been around for at least 40 years!&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing this we have massively reduced the gap between the user and the developer. Some readers may recognise what I am describing .. they run under the heading of Decision Tables and have been around for at least 40 years!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23327&amp;oldid=prev</id>
		<title>Gbcambridge at 16:33, 6 February 2009</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23327&amp;oldid=prev"/>
				<updated>2009-02-06T16:33:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 16:33, 6 February 2009&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little.  We can imagine that for some circumstance, say evaluation of a client, or a risk, or simply the next step in a process, there are some criteria &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;to be &lt;/del&gt;satisfied&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;. Also depending on these criteria there are various&lt;/del&gt;, one or more, actions to be performed. It would be convenient to capture the requirements in this form... a list of the criteria, C1, C2,... Cn and a list of Actions. Then for each combination of Criteria we have a selection of Actions. If each of the criteria is a boolean, then we know that there are possibly 2 raised to the nth power of possible criteria combinations to be addressed.  This is a big step forward from conventional requirements capture. We can [[prove]] completeness!  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's abstract business logic a little.  We can imagine that for some circumstance, say evaluation of a client, or a risk, or simply the next step in a process, there are some criteria &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;which when &lt;/ins&gt;satisfied, &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;determine &lt;/ins&gt;one or more, actions to be performed. It would be convenient to capture the requirements in this form... a list of the criteria, C1, C2,... Cn and a list of Actions. Then for each combination of Criteria we have a selection of Actions&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;, Am&lt;/ins&gt;. If each of the criteria is a boolean, then we know that there are possibly 2 raised to the nth power of possible criteria combinations to be addressed &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(depending on the number of possibel states of each of the criteris. For now we assume simple boolean states)&lt;/ins&gt;.  This is a big step forward from conventional requirements capture. We can [[prove]] completeness!  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;thsi &lt;/del&gt;we have massively reduced the gap between the user &lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;adn &lt;/del&gt;the developer. Some&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;this &lt;/ins&gt;we have massively reduced the gap between the user &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;and &lt;/ins&gt;the developer. Some &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;readers may recognise what I am describing .. they run under the heading of Decision Tables and have been around for at least 40 years!&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Although there are processors around for Decision Tables, they are not necessary to get many of the benefits. For example the enumeration of the criteria and the actions is a significant step in abstraction and understanding of the problem. It also provides the developer with the opportunity to analyse and detect logical nonsense in the requirements because of the formalism of the DT representation. By feeding this back to the user (in a constructive manner of course), we can overcome some of the tension in the relationship.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;We can explore the code generated from a Decision Table. We can write (or generate) conventional &amp;quot;if - then - else&amp;quot; logic. This is just one choice. We could also use the combination of criteria to index into an in-memory table representation of the decision table. This has the advantage of preserving the clear relationship  between the decision table used for requirements specification and its implementation. Of course there is nothing that says the table need be in memory  ---we could store it in a relational database, and then access the appropriate table and index directly to the set of actions.  &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;I hope that you can see where this is going. The general idea is to try to capture logic in a tabular form, and interpret it at run-time. You can of course have (simple) real-time modification of table content. &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Implementations of this type of system run from the humble programmer using the technique as a private coding method to full run-time environments with natural English translation to generate rule tables for interpretation.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23326&amp;oldid=prev</id>
		<title>Gbcambridge: New page: It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. I guess I do not need to elaborate on all of the reasons as they are ...</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=From_Requirements_to_Tables_to_Code_and_Tests&amp;diff=23326&amp;oldid=prev"/>
				<updated>2009-02-06T16:08:51Z</updated>
		
		<summary type="html">&lt;p&gt;New page: It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. I guess I do not need to elaborate on all of the reasons as they are ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;It is generally reckoned that the process of getting from requirements to implementation is error prone and expensive. I guess I do not need to elaborate on all of the reasons as they are pretty well known. However, some key reasons are lack of clarity on the part of the user ..incomplete / inadequate requirements and misunderstandings on the part of the developer .. catch-all &amp;quot;else&amp;quot; statements and so on. We then test like crazy to show that what we have done at least satisfies the law of least surprise! &lt;br /&gt;
Now I want to focus here on the business logic, not the interconnecting tissue. The execution of the business logic delivers the value of our application.&lt;br /&gt;
&lt;br /&gt;
Let's abstract business logic a little.  We can imagine that for some circumstance, say evaluation of a client, or a risk, or simply the next step in a process, there are some criteria to be satisfied. Also depending on these criteria there are various, one or more, actions to be performed. It would be convenient to capture the requirements in this form... a list of the criteria, C1, C2,... Cn and a list of Actions. Then for each combination of Criteria we have a selection of Actions. If each of the criteria is a boolean, then we know that there are possibly 2 raised to the nth power of possible criteria combinations to be addressed.  This is a big step forward from conventional requirements capture. We can [[prove]] completeness!  &lt;br /&gt;
Further, if the requirements are captured in this form then we have an opportunity to largely automate the code generation process. In doing thsi we have massively reduced the gap between the user adn the developer. Some&lt;/div&gt;</summary>
		<author><name>Gbcambridge</name></author>	</entry>

	</feed>