“Bad” programming style

if($totalrowsModel == 0 && $formType == 2)
{
// Procedure 1
}
else if($_SESSION[‘loggedin’] == $userAccountEncrypt && $product!=”” && $spec !=”” && $PSID == $randomURL)
{
// Procedure 2
}
else if($_SESSION[‘loggedin’] == $userAccountEncrypt)
{
// Procedure 3
}
else
{
// Procedure 4
}

This is a typical bad programming style that does not converge to a
location. It is called “spaghetti program”. I need to exclude some
access to database but it seems like I must put the condition at
multiple locations.

if($totalrowsModel == 0 && $formType == 2)
{
}
else if($_SESSION[‘loggedin’] == $userAccountEncrypt)
{
if($product!=”” && $spec !=”” && $PSID == $randomURL)
{
// Procedure 2
}
else
{
// Procedure 3
}
}
else
{
// Procedure 4
}

At least, the conditionals must be formatted this way.

Advertisements

About easai

Programming is, a way to earn living, to express yourself, to explore logic, and to make a permanent record of your thinking. View all posts by easai

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: