|Just another Perl shrine|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
I like to generate the efficient code from the truth table and would like to know if we have any tools available.
For example, sulfericacid like to design a system to add/remove email addresses via CGI form based upon if users have provided proper fields and email address exists or not in the database. While talking in CB, I created the truth table.
name email add emailexist step: T T T T warn 1. email exists in database T T T F action 1: add email in database T T F T action 2: remove email from database T T F F warn 2. email doesn't exist in database T F - - warn 3. email empty F T - - warn 4. name empty F F - - warn 5. name and email emptyNotes:
Name: 'T' If user has provided name Email: 'T' If user has provided email Add: 'T' if radio button for 'add' is checked. (other option is to remove Emailexist: 'T' if email exists in the database - : It's not relavent.Sample code
According to me, the truth table provides the business logic. While programming we convert the business logic in the code. If we can represent the business logic in truth table and have the code-generator, it would be very helpful. With few fields, it could be common sense, with more fields it is usually a long mental/paper exercise to come up with good code. Our focus will be rightly shifted towards truth table generation in these type of case.
In reply to Code generation from truth table. by artist