Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are working in a software team. Your primary job is to fix PCRs (Problem Reports) on a section of legacy code. The software lead

You are working in a software team. Your primary job is to fix PCRs (Problem Reports) on a section of legacy code. The software lead has assigned you to a Buddy Code Review for a fellow programmer Jing Hsan. Jing was fixing a PCR regarding inserting a check for empty name fields. She was supposed to pop up a message box asking the user to insert a valid name if the user clicked any of the buttons without first entering a name.

During your code review you notice that the ActionPerformed() is longer than 100 lines. You also notice some other things suggesting Jing Hsan ought to refactor the code.

While you dont usually unit test for a fellow programmer, you notice that Jing Hsan has introduced another error while implementing her fixshe broke the Update Button logic.

You are encouraged to paste this code into an IDE like Eclipse to help you find how the program can be improved.

Your assignment is to write the buddy code review (emails with the following):

Your advice for Jing on how to fix the update problem.

At least 8 specific suggestions on how to refactor the code.

Paste your refactored code at the end of this document, and follow it with a list of the changes that you made.

Here is the source code Jing asked you to code review (you can cut and paste from this document):

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

PASTE YOUR REFACTORED CODE HERE:

LIST YOUR CHANGES HERE:

public static void mai String args) Refactoring/Code Review Assignment int xl 300; ?3:1-130: PhoneBook1 frame-new PhoneBook10. You are working in a software team. Your primary job is to fix PCRs (Problem Reports) on a section of legacy code. The software lead has assigned you to a 'Buddy Code Review' for a fellow programmeig n. Jing was fixing a PCR regarding inserting a check for empty name fields. She was supposed to pop up a message box asking the user to ine valid name if the user clicked any of the buttons without first entering a name. framesctsizefxl, yl); During your code review you notice that the ActionPrfcmcd) is longer than 100 lines. You also notice some other things suggesting Jing Hsan ought to refactor the code. Constructor public PhoneBookl While you don't usually unit test for a fellow programmer, you notice that ing Hsn has introduced another erro while implementing her fix-she broke the Update Button logic. alnew Awayli(20); / 1ntially set for up to 20 entries; und for v5.0 You are encouraged to paste this code into an IDE like Eclipse to help you find how the program can be improved. Your assignment is to write the 'buddy code review' (emails with the following) Create panel p to hold the text field and button 1) Your advice for Jing on how to fix the update problem. 2) At least & specific suggestions on how to refactor the code. Raddnew ILabel Name: ")) p.addoN-new extFild20) p.addinew ILabsl('Phone: ); Paste your refactored code at the end of this document, and follow it with a list of the changes that you made Here is the source code Jing asked you to code eview (you can cut and paste from this document) p.addlibrdd-newButton Add")) RaddiD-new Rutton( Delete") Radd(iblund-new,?unan(" Update")); -Refactoring Example import jaya.awt WSet FlowLavout for the frame and add components in it add p, CENTER); updated for v5.0 import javaxng import javau Register listeners public class PhoneBook1 extends IFrame implements ActionListener DaddActigntistcacr this) private TextFicld jN iPh private Button ibiddd.??MUnd.? private AuayList-String- nl pl updated for v5.0 private int lastE-1; this) public void senterDaScreealint x 1 , ?nty 1 ) Main method public static void mai String args) Refactoring/Code Review Assignment int xl 300; ?3:1-130: PhoneBook1 frame-new PhoneBook10. You are working in a software team. Your primary job is to fix PCRs (Problem Reports) on a section of legacy code. The software lead has assigned you to a 'Buddy Code Review' for a fellow programmeig n. Jing was fixing a PCR regarding inserting a check for empty name fields. She was supposed to pop up a message box asking the user to ine valid name if the user clicked any of the buttons without first entering a name. framesctsizefxl, yl); During your code review you notice that the ActionPrfcmcd) is longer than 100 lines. You also notice some other things suggesting Jing Hsan ought to refactor the code. Constructor public PhoneBookl While you don't usually unit test for a fellow programmer, you notice that ing Hsn has introduced another erro while implementing her fix-she broke the Update Button logic. alnew Awayli(20); / 1ntially set for up to 20 entries; und for v5.0 You are encouraged to paste this code into an IDE like Eclipse to help you find how the program can be improved. Your assignment is to write the 'buddy code review' (emails with the following) Create panel p to hold the text field and button 1) Your advice for Jing on how to fix the update problem. 2) At least & specific suggestions on how to refactor the code. Raddnew ILabel Name: ")) p.addoN-new extFild20) p.addinew ILabsl('Phone: ); Paste your refactored code at the end of this document, and follow it with a list of the changes that you made Here is the source code Jing asked you to code eview (you can cut and paste from this document) p.addlibrdd-newButton Add")) RaddiD-new Rutton( Delete") Radd(iblund-new,?unan(" Update")); -Refactoring Example import jaya.awt WSet FlowLavout for the frame and add components in it add p, CENTER); updated for v5.0 import javaxng import javau Register listeners public class PhoneBook1 extends IFrame implements ActionListener DaddActigntistcacr this) private TextFicld jN iPh private Button ibiddd.??MUnd.? private AuayList-String- nl pl updated for v5.0 private int lastE-1; this) public void senterDaScreealint x 1 , ?nty 1 ) Main method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions