Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.
 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M982233

Have any Question?


Related Questions in Computer Engineering

Despite being noble gases xenon and radon actually form a

Despite being noble gases, xenon and radon actually form a small number of compounds. What is the partial pressure in atmospheres of radon in a mixture at STP composed of equal masses of xenon and radon?

Rock paper scissors please make sure it compiles and

Rock, Paper, Scissors (Please make sure it compiles and include output in answer.) You will implement a rock-paper-scissors game. The player enters 1 for Rock, 2 for Paper, or 3 for Scissors. The computer randomly select ...

Aa stock will pay dividends of 3 4 and 9 over the next

aA stock will pay dividends of $3, $4, and $9 over the next three years, and then increase dividends at a rate of 3% afterwards. Its required rate of return is 15%. What is the value of the stock? Round to the penny.

Youve entered a contract to purchase a new house and the

You've entered a contract to purchase a new house, and the closing is scheduled for next week. It's typical for some last-minute bargaining to occur at the closing table, where sellers often try to tack on extra fees. Yo ...

The stock price for international business machines ibm

The stock price for International Business Machines (IBM) historically has followed an approximately normal distribution (when adjusting for inflation) with a mean of $155.483 and standard deviation of $4.0278. What is t ...

Explain that when an unauthorized individual gains access

Explain that when an unauthorized individual gains access to the information an organization trying to protect, that act is categorized as a deliberate act of espionage or trespass.

Assignmentnbspon information systems audit and

Assignment  on Information Systems audit and controls Assignment purpose: Elaborate on the different types of control that are applied in a hospital (Preventive, detective and corrective control). Evaluate the logical an ...

Can someone please show me how to do this step by step

Can someone please show me how to do this step by step please. I dont understand any of it 1.) Add a new virtual disk a) Edit VMware player settings to add a new virtual hard disk. b) Start or reboot the virtual machine ...

Restaurant management database project the restaurant

Restaurant Management Database Project : The restaurant maintains the catalog for the list of food and beverage items that it provides. Apart from providing food facility at their own premises, the restaurant takes order ...

Research and describe a tool that can be used to test for

Research and describe a tool that can be used to test for web server vulnerabilities. This tool can be as simple as a Google Dork or it can be included in a toolkit for performing enumeration. Why is this tool valuable t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As