SlideShare uma empresa Scribd logo
1 de 5
Baixar para ler offline
Fall 2008
Issue 6



     MySQL® Magazine
       S
             News, articles and feedback for MySQL database administrators and developers
            using MySQL on a daily basis to provide some of the best database infrastructure
                                                available.




                    INSIDE THIS ISSUE                               REGULAR FEATURES

2       Decision Table-Driven Development        6      Coding Corner

12      Overview of Zmanda Recovery Manager      17     Bookworm

                                                 17     log-bin
Page 2                                       Fall 2008                                    MySQL Magazine




    Decision Table-Driven Development
By Jonathan Levin
I have been trying for a while now to find ways to improve the data-driven applications I work on by
leveraging the database. I begin with tweaking SQL queries. Then I replaced loops with complicated joined
SQL statements. The more I optimized towards the database, the more I improved performance of my overall
application.
Of course, this will not be news to many of you. So I tried to come up with some ways of improving the speed
even more, but the only way I saw myself doing that is if I put some application logic in the database. At least
to the point where the database could arrange itself to use the data more in-line with how I wanted it to be
used.
I did some research (actually a lot of research) and found out that the most convenient form of logic
capturing tool was decision trees and decision tables. I developed a method that I want to share with you
about how I believe decision tables can help you develop data-driven applications and speed up your
database queries.

        How can developers use this?




                                                                        Decision Table continues on next page
Page 3                                       Fall 2008                                     MySQL Magazine


Decision Table from previous page

       STEPS:
    1) The business user would like a new application and develops a requirements list for you
    2) You start analyzing the system and write down what kind of data you need to keep. You then start
designing an initial idea for a database.
    3) You ask what kind of decisions you need to have for the new application and then make decision tree
diagrams. You can then show the diagrams to the business user to see if you are on the same page. Some
examples:
    a) What discount should a new customer get?
    b) When is it ok to go outside and play a baseball game (according to the weather)?
                                                                c) Does the hotel have available rooms?
                                                                4) You can convert the decision tree into a
                                                            decision table, which naturally fits database tables
                                                            where you can store it:




                                                                In this example, you can see all the possible
                                                            options for when a hotel will have available rooms
                                                            or not.   This can also be called a “Truth Table”,
                                                            because it only holds True or False.
                                                            5) Now it is time to go to your application code
                                                                (or your database code).You write code to
                                                                process the conditions and store the result in
                                                                the database. You can store the results in a
                                                                separate table from the data you are referring
                                                                it to because of versioning reasons. After you
                                                                have all the conditions processed and saved,

   you can search the decision table for the result to the decision you are looking for and save it to your table.
6) There are also ways to create and search decision tables by minimizing the rows using “All” (meaning in all
   cases for this condition) instead of True/False. In the event where you forgot a certain situation, or tree
   branch, you can configure your application to add a new row to your decision table for that situation and to
   message you to fill it in later. This helps with debugging behaviour.
7) It is important to note that there is an element of Test Driven-Development here. The idea of creating tests
   first is to help discover what your program should do, run the test to check if it works and then “flesh out”
   the code to make the test pass. Here you use the conditions to help you create tests - Null for fail and
   True/False for pass. You also know what the application should do because you planned it when you

                                                                           Decision Table continues on next page
Page 4                                       Fall 2008                                    MySQL Magazine



Decision Table from previous page
   thought of which data types you need to store. Lastly, you are largely relieved from writing conditional If-
   Then-Else statements (which needs testing for possible side effects), because they are in your decision
   tables.




8) Finally test the code again as well as the code behaviour.
9) You’re done. – Done is a very loose term, but for the purpose of this example, you are done.

     What are the Benefits?

1) I already talked about the benefits for developers. It helps the coding process by defining what you
   should code and it sets up tests in a way to verify your code. Since you keep records of the results for the
   conditions, you have records for debugging.
2) Because of the similarity of decision tables and database tables there is an opportunity to be able to alter
   them. By doing so you can change the behaviour of the application. In the events of larger changes, such
   as adding conditions and results, you have a lot of control for maintenance and testing.
3) Finally, since the database has more information about your data and how it relates to what you need, you




                                                                       Decision Table continues on next page
Page 5                                       Fall 2008                                    MySQL Magazine




  Decision Table from previous page

   can produce very fast queries and reports. In the example of the hotel-reservation system, you can do a
   search for which rooms are available according to “WHERE available = True”.
4) It is also important to note that the logic is not necessarily held in the database if you are really against
   that. The code is the logic which does the “How” and the database holds the results which is the “What”.


      Conclusion

I see this method as similar to the way I have always developed my applications, but with a slight difference. I
usually grab data from different parts of the database, process the data, keep the results in memory and then
throw them away when I am done. This time I just decide to keep the results in the database for later.
   While using this method, I really felt very surprised at the end of the development process and how easy it
was to get to it. I felt a bit like I was “cheating” while I was working on the code, because I already knew all
the answers. I am very happy with how this idea turned out. I am particularly happy with the testing element
and the maintenance element which I know helps cut down on problems in development and keeps the
application going for a long time.

      About the author
   Jonathan Levin lives in England with his wonderful new wife. He has been developing data-driven
applications for over seven years and has been a project manager for over three years. Jonathan has recently
moved over to MySQL and tries to be active in the community. He has been writing a blog for over a year that
discusses database developing in MySQL.

Mais conteúdo relacionado

Semelhante a My Article on MySQL Magazine

What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really DoingDave Stokes
 
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docx
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docxFai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docx
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docxssuser454af01
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoDave Stokes
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018Dave Stokes
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databaseselliando dias
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151xlight
 
Relational database concept and technology
Relational database concept and technologyRelational database concept and technology
Relational database concept and technologyDucat
 
Metric Abuse: Frequently Misused Metrics in Oracle
Metric Abuse: Frequently Misused Metrics in OracleMetric Abuse: Frequently Misused Metrics in Oracle
Metric Abuse: Frequently Misused Metrics in OracleSteve Karam
 
Structure of Database MAnagement System
Structure of Database MAnagement SystemStructure of Database MAnagement System
Structure of Database MAnagement Systemnitish sandhawar
 
Data warehousing change in a challenging environment
Data warehousing change in a challenging environmentData warehousing change in a challenging environment
Data warehousing change in a challenging environmentDavid Walker
 
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent OzarGeek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent OzarIDERA Software
 

Semelhante a My Article on MySQL Magazine (20)

Data science unit2
Data science unit2Data science unit2
Data science unit2
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really Doing
 
Speed up sql
Speed up sqlSpeed up sql
Speed up sql
 
disertation
disertationdisertation
disertation
 
Big data rmoug
Big data rmougBig data rmoug
Big data rmoug
 
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docx
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docxFai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docx
Fai[ Away with Dynamo, Bigtabte, and Cassandra194 cHArlrEF.docx
 
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San FranciscoMySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
 
MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018MySQL 8 Server Optimization Swanseacon 2018
MySQL 8 Server Optimization Swanseacon 2018
 
Hadoop bank
Hadoop bankHadoop bank
Hadoop bank
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 
NOSQL
NOSQLNOSQL
NOSQL
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151
 
Relational database concept and technology
Relational database concept and technologyRelational database concept and technology
Relational database concept and technology
 
Metric Abuse: Frequently Misused Metrics in Oracle
Metric Abuse: Frequently Misused Metrics in OracleMetric Abuse: Frequently Misused Metrics in Oracle
Metric Abuse: Frequently Misused Metrics in Oracle
 
No sql database
No sql databaseNo sql database
No sql database
 
Structure of Database MAnagement System
Structure of Database MAnagement SystemStructure of Database MAnagement System
Structure of Database MAnagement System
 
Big data
Big dataBig data
Big data
 
Big data
Big dataBig data
Big data
 
Data warehousing change in a challenging environment
Data warehousing change in a challenging environmentData warehousing change in a challenging environment
Data warehousing change in a challenging environment
 
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent OzarGeek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
Geek Sync | Planning a SQL Server to Azure Migration in 2021 - Brent Ozar
 

Último

Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 

Último (20)

How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.How Tech Giants Cut Corners to Harvest Data for A.I.
How Tech Giants Cut Corners to Harvest Data for A.I.
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 

My Article on MySQL Magazine

  • 1. Fall 2008 Issue 6 MySQL® Magazine S News, articles and feedback for MySQL database administrators and developers using MySQL on a daily basis to provide some of the best database infrastructure available. INSIDE THIS ISSUE REGULAR FEATURES 2 Decision Table-Driven Development 6 Coding Corner 12 Overview of Zmanda Recovery Manager 17 Bookworm 17 log-bin
  • 2. Page 2 Fall 2008 MySQL Magazine Decision Table-Driven Development By Jonathan Levin I have been trying for a while now to find ways to improve the data-driven applications I work on by leveraging the database. I begin with tweaking SQL queries. Then I replaced loops with complicated joined SQL statements. The more I optimized towards the database, the more I improved performance of my overall application. Of course, this will not be news to many of you. So I tried to come up with some ways of improving the speed even more, but the only way I saw myself doing that is if I put some application logic in the database. At least to the point where the database could arrange itself to use the data more in-line with how I wanted it to be used. I did some research (actually a lot of research) and found out that the most convenient form of logic capturing tool was decision trees and decision tables. I developed a method that I want to share with you about how I believe decision tables can help you develop data-driven applications and speed up your database queries. How can developers use this? Decision Table continues on next page
  • 3. Page 3 Fall 2008 MySQL Magazine Decision Table from previous page STEPS: 1) The business user would like a new application and develops a requirements list for you 2) You start analyzing the system and write down what kind of data you need to keep. You then start designing an initial idea for a database. 3) You ask what kind of decisions you need to have for the new application and then make decision tree diagrams. You can then show the diagrams to the business user to see if you are on the same page. Some examples: a) What discount should a new customer get? b) When is it ok to go outside and play a baseball game (according to the weather)? c) Does the hotel have available rooms? 4) You can convert the decision tree into a decision table, which naturally fits database tables where you can store it: In this example, you can see all the possible options for when a hotel will have available rooms or not. This can also be called a “Truth Table”, because it only holds True or False. 5) Now it is time to go to your application code (or your database code).You write code to process the conditions and store the result in the database. You can store the results in a separate table from the data you are referring it to because of versioning reasons. After you have all the conditions processed and saved, you can search the decision table for the result to the decision you are looking for and save it to your table. 6) There are also ways to create and search decision tables by minimizing the rows using “All” (meaning in all cases for this condition) instead of True/False. In the event where you forgot a certain situation, or tree branch, you can configure your application to add a new row to your decision table for that situation and to message you to fill it in later. This helps with debugging behaviour. 7) It is important to note that there is an element of Test Driven-Development here. The idea of creating tests first is to help discover what your program should do, run the test to check if it works and then “flesh out” the code to make the test pass. Here you use the conditions to help you create tests - Null for fail and True/False for pass. You also know what the application should do because you planned it when you Decision Table continues on next page
  • 4. Page 4 Fall 2008 MySQL Magazine Decision Table from previous page thought of which data types you need to store. Lastly, you are largely relieved from writing conditional If- Then-Else statements (which needs testing for possible side effects), because they are in your decision tables. 8) Finally test the code again as well as the code behaviour. 9) You’re done. – Done is a very loose term, but for the purpose of this example, you are done. What are the Benefits? 1) I already talked about the benefits for developers. It helps the coding process by defining what you should code and it sets up tests in a way to verify your code. Since you keep records of the results for the conditions, you have records for debugging. 2) Because of the similarity of decision tables and database tables there is an opportunity to be able to alter them. By doing so you can change the behaviour of the application. In the events of larger changes, such as adding conditions and results, you have a lot of control for maintenance and testing. 3) Finally, since the database has more information about your data and how it relates to what you need, you Decision Table continues on next page
  • 5. Page 5 Fall 2008 MySQL Magazine Decision Table from previous page can produce very fast queries and reports. In the example of the hotel-reservation system, you can do a search for which rooms are available according to “WHERE available = True”. 4) It is also important to note that the logic is not necessarily held in the database if you are really against that. The code is the logic which does the “How” and the database holds the results which is the “What”. Conclusion I see this method as similar to the way I have always developed my applications, but with a slight difference. I usually grab data from different parts of the database, process the data, keep the results in memory and then throw them away when I am done. This time I just decide to keep the results in the database for later. While using this method, I really felt very surprised at the end of the development process and how easy it was to get to it. I felt a bit like I was “cheating” while I was working on the code, because I already knew all the answers. I am very happy with how this idea turned out. I am particularly happy with the testing element and the maintenance element which I know helps cut down on problems in development and keeps the application going for a long time. About the author Jonathan Levin lives in England with his wonderful new wife. He has been developing data-driven applications for over seven years and has been a project manager for over three years. Jonathan has recently moved over to MySQL and tries to be active in the community. He has been writing a blog for over a year that discusses database developing in MySQL.