Explain these terms with examples in one lines Long Methods and Classes Long Parameter List Divergent Change Original core function Shotgun Surgery Feature Envy Data Clumps Lazy Class Message Chains
Explain these terms with examples in one lines
- Long Methods and Classes
- Long Parameter List
- Divergent Change
- Original core function
- Shotgun Surgery
- Feature Envy
- Data Clumps
- Lazy Class
- Message Chains
1. Long Methods and Classes
Long class in java defined as java.lang.Long which wraps the value of predefined data type long in an object. It contains two type of constructor Long(long x) and Long(String st).
2. Long parameter list
In a method call, Long parameter list is a code smell. Long parameter list detects that there might be something wrong with program.
EX - calculateAverage(subject, unit, null, true, false);
3. Divergent Change
When many changes are made to a single class then it is known as Divergent Change.
EX- You have a food class and want to add some new food types then you have to change in all methods of that class.
4. Shotgun surgery
when a single change is made to multiple classes simultaneously then it is known as Shotgun Surgery.
EX- You have to copy paste the main code in many classes
Step by step
Solved in 2 steps