Sometimes it is easy to see how the whole solution


Refactoring
Sometimes it is easy to see how the whole solution can be broken into pieces, and other times it is done as you see abstractions and opportunities for reuse in the resulting design. This is called refactoring. For the pseudocode you see below, look for abstractions you could create and create a flowchart using your simplifications.

Psuedocode in Need of Refactoring
Array : namesInSystem
Array : phoneNumbersInSystem
String : nameInput
While (nameInput is not valid)
nameInput = prompt user for input
if (nameInput is provided and not blank)
break out of loop
end loop
Prompt user the input is required and not blank
End loop

Integer : indexForName = -1
For (index = all items in namesInSystem
If (nameInput = namesInSystem[index])
indexForName = index
end if
End loop

If (indexForName = -1)
Prompt user "We cannot find your account, please call us"
Else
String : phoneNumberInput
While (phoneNumber is not valid)
phoneNumber = prompt user for input
if (phoneNumber is provided and not blank)
break out of loop
end loop
Prompt user the input is required and not blank
End loop
If (phoneNumber = phoneNumbersInSystem[indexForName])
Prompt "we found your account welcome"
Else
Prompt "we cannot validate your account, try again later"
End if
End if
Refactored Flowchart
The above pseudocode is long, but you can omit much of the details. You can accomplish the same logic removing more than 30 lines. You do not have to show all of the details removed if moved into an abstraction, simply name the abstraction and define the parameters to be passed to the call replacing the lines of code.
 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Sometimes it is easy to see how the whole solution
Reference No:- TGS082233

Expected delivery within 24 Hours