Browse Prior Art Database

Simplifying Complex Conditional Programming Logic

IP.com Disclosure Number: IPCOM000021834D
Original Publication Date: 2004-Feb-11
Included in the Prior Art Database: 2004-Feb-11
Document File: 3 page(s) / 22K

Publishing Venue

IBM

Abstract

As the complexity of conditional programming increases, logical statements grow in size and become difficult to manage and error prone. Associating conditional statements with a binary numbering scheme allows reduction in the level of possible errors and improves manageability.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 60% of the total text.

Page 1 of 3

Simplifying Complex Conditional Programming Logic

Disclosed is a method for reducing the complexity of conditional programming.

Software applications are composed of various codepaths whose execution is based on conditional operators. This is referred to as conditional programming. Often, the executed codepath is determined through the use of if...then...else operators. In situations involving multiple levels of conditional logic the code itself becomes complex, difficult to manage, error prone, and difficult to troubleshoot. An example of this is database querying where the presence of various keys determines the database query that is executed. Figure 1 contains example Java code for a database search of a employee record detailing the typical solution for a complex conditional statement:

______________________________________________________________

__________________

PreparedStatement statement = null;
if ((firstname!=null) && (lastname!=null) && (street!=null) &&
(city!= null) && (state != null) && (zip!= null) && (serial
number!=null)) {
statement = connection.prepareStatement("UPDATE
EMPLOYEE_TABLE SET FIRSTNAME = ? AND LASTNAME = ? AND STREET =
? And CITY = ? And STATE = ? AND SERIAL_NUMBER = ? WHERE ID =
?");
statement.setString(1, firstname); statement.setString(2, lastname);

.....

1

Page 2 of 3

(serial number!=null)) {
....

2

Page 3 of 3

case 127: ....
case 126: ....
....

case 1:
case 0:
....

}

________________________________________________________________...