Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Examples of refactoring Software Engineering Re-organization of a class hierarchy to remove duplicate code. Tidying up and renaming attributes and methods to make them
Examples of refactoring Software Engineering Re-organization of a class hierarchy to remove duplicate code. Tidying up and renaming attributes and methods to make them easier to understand. The replacement of inline code with calls to methods that have been included in a program library. 30/10/2014 Chapter 3 Agile Software Development 24 'Bad smells' in program code Duplicate code The same or very similar code may be included at different places in a program. This can be removed and implemented as a single method or function that is called as required. Long methods . If a method is too long, it should be redesigned as a number of shorter methods. Switch (case) statements These often involve duplication, where the switch depends on the type of a value. The switch statements may be scattered around a program. In object-oriented languages, you can often use polymorphism to achieve the same thing. 30/10/2014 Chapter 9 Software Evolution 25 'Bad smells' in program code Data clumping Software Engineering Data clumps occur when the same group of data items (fields in classes, parameters in methods) re-occur in several places in a program. These can often be replaced with an object that encapsulates all of the data. Speculative generality This occurs when developers include generality in a program in case it is required in the future. This can often simply be removed. 30/10/2014 Chapter 9 Software Evolution 26
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started