Which of the following is FALSE about duplicate code? Duplicate code is a good programming practice Duplicate code is a source of faults Duplicate code has a negative impact on changeability Duplicate code has a negative impact on maintainability   Fixning a fault in the program is a widely used refactoring technique True False Which of the following statements is true?     You need to test the code after refactoring to verify that the behavior is not changed     You do NOT need to test the code after refactoring because the behavior is not changed     After refactoring, no need to test, you need to inspect the code     After refactoring, depending on the programming language. In case of Java, no need to test as Java provided an automatic Garbage collection mechanism   6.     What can go wrong if you refactor an interface?     If an interface becomes a published interface, the interface is being used by code that you cannot find and change.     Nothing!     In Java, interfaces cannot be refactored     The program performance decreases Which of the following classes suffers from the Middle Man bad smell?     A class that contains more methods than it should     A class that delegates many of its requests to another class     A class that only contains data     A class that contains less method than it should   8.     Which of the following is a symptom of Shotgun Surgery bad smell?     Whenever make a change, you have to make a lot of little changes to a lot of different classes.     When one module changed in different ways for different reasons     When a method is making more use of another class than the one it is in     When you have sets of variables that are usually passed together i

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter9: Sequential Access Files And Menus
Section: Chapter Questions
Problem 11E
icon
Related questions
Question

Which of the following is FALSE about duplicate code?

  1. Duplicate code is a good programming practice
  2. Duplicate code is a source of faults
  3. Duplicate code has a negative impact on changeability
  4. Duplicate code has a negative impact on maintainability

 

  1. Fixning a fault in the program is a widely used refactoring technique

True

False

  1. Which of the following statements is true?
   

You need to test the code after refactoring to verify that the behavior is not changed

   

You do NOT need to test the code after refactoring because the behavior is not changed

   

After refactoring, no need to test, you need to inspect the code

   

After refactoring, depending on the programming language. In case of Java, no need to test as Java provided an automatic Garbage collection mechanism

 

6.     What can go wrong if you refactor an interface?

   

If an interface becomes a published interface, the interface is being used by code that you cannot find and change.

   

Nothing!

   

In Java, interfaces cannot be refactored

   

The program performance decreases

  1. Which of the following classes suffers from the Middle Man bad smell?
   

A class that contains more methods than it should

   

A class that delegates many of its requests to another class

   

A class that only contains data

   

A class that contains less method than it should

 

8.     Which of the following is a symptom of Shotgun Surgery bad smell?

   

Whenever make a change, you have to make a lot of little changes to a lot of different classes.

   

When one module changed in different ways for different reasons

   

When a method is making more use of another class than the one it is in

   

When you have sets of variables that are usually passed together in multiple places

 

9.     Pair programming is responsible of introducing bad smells in the code

True  

False  

10.   In OOP, what can you say about a method that requires a lot of parameters?

   

Probably the method is in the wrong class as the method is using a lot of inputs from the outside

   

Sign of high modularity

   

Having methods with long parameter list is the norm in OOP

   

The method is doing a critical task, which explains why it needs all these parameters

 

 

1.     You have a legacy system that consists of 1000 LoC, the code is poorly commented, messed up, and contains a lot of poor design and implementation decision. The only thing that is clear is what the code is doing. You are asked to refactor the code, what should you do?

   

The easiest fastest path to take is to write a new version of the code, you know what the code is doing, design and implement a new solution.

   

Do what you are asked to do, refactor it. It's a typical refactoring scenario

   

Give the task to someone else

   

Pretend that you refactored it, but don't becuase you can't refactor a code that you don't understand. Just add few comments here and there!

 

2.     A method is long if it's LoC exceeds 20

True  

False  

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning