Click here to Skip to main content
Click here to Skip to main content
Go to top

Design Notes: Reducing Opportunities for Error

, 20 Apr 2007
Rate this:
Please Sign up or sign in to vote.
An article on how to apply the quality concept of reducing the opportunities for error to software development.

Screenshot - OFE_Demo.jpg

Introduction

Consider the example dialog box shown here. What is the real difference between the two approaches when it comes to software quality? Example 1 is easier to produce, whereas Example 2 took more effort and some research by the developer to produce. This article examines why a developer should spend the extra effort to reduce the opportunities for error by the user.

Defining Opportunities

A good analogy for applying this concept is to think of the software product as a factory that takes orders from the user and produces a product of data. Therefore, the emphasis for this design method is to take better orders and produce a higher quality product. The first part of this process is to define measurable objects to be able to calculate opportunities. Some good metrics to start with are the number of database fields and the number of user interface elements (textboxes, buttons, menu choices etc).

Once a count of the objects has been established, the next step is to calculate the number of occurrences. The next set of metrics will be harder to come by, and may need to be estimated, but they are important to providing a proper analysis of where to reduce opportunities. They are metrics like the number of database records and number of users. Now, the number of opportunities for error is: the number of objects x the number of occurrences = opportunities for error.

For example: a database with 15 fields and an estimated 10000 records will create a potential 150000 opportunities for error. Automation added to a software product that reduces the number of database fields by 2 reduces the number of opportunities by 20000, and it typically does not take 20000 lines of code to add that automation.

While it is true that an opportunity for error does not equate to an actual error, it is reasonable to assume that a percentage of the opportunities will become actual errors. If you reduce the opportunities then by inference, you will reduce the actual number of errors, thus creating a higher quality product.

Example 2 reduces the number of objects on the user interface by one, and effectively reduces the opportunities for error by checking the user entered date and not requiring a user entry to determine the Membership level. I have attached the code for this optimization for your reference. In this example, it only took 9 lines of code to make this reduction in opportunities for error.

private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
{
     DateTime dt = DateTime.Now;
     TimeSpan ts = new TimeSpan(dt.Ticks - dateTimePicker1.Value.Ticks);

     //if duration is > than 2 years in days
     //else if duration > 1 year in days
     //else less than 1 year

     if(ts.TotalDays > 730)
     {
             label7.Text = "Gold Member";
     }
     else if (ts.TotalDays > 365)
     {
             label7.Text = "Silver Member";
     }
     else
     {
             label7.Text = "Bronze Member";
     }
}

This article is intended to demonstrate another method for analyzing the trade off between placing the work on the developer vs. giving that work to the user of the software. It also starts to outline the process for quantifying the need and justifying the additional work to be added to a project.

History

  • 4/20/07: Original release.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Darrell Long
Web Developer
United States United States
Darrell Long is a developer with over 20 years of experience, a Master's degree in Computer Science, and an IEEE CSDP.

Comments and Discussions

 
GeneralThe details are what count PinmemberMiguel Garrido24-Apr-07 0:19 
GeneralUsers? Ha! PinmemberJohnDeHope320-Apr-07 10:08 
GeneralRe: Users? Ha! PinmemberPatrick Sears20-Apr-07 11:21 
GeneralRe: Users? Ha! Pinmemberpurplepangolin20-Apr-07 12:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 20 Apr 2007
Article Copyright 2007 by Darrell Long
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid