Problem Study Supplied Code List Code Smells See Exercise Code Smells One Long Method Larg Q43902997
For each problem, study the supplied code, and list the codesmells you see. For this exercise the code smells should be one ofthese:
- long method,
- large class,
- duplicate code (aka cut and paste code),
- long parameter list,
- primitive obsession, and
- magic numbers.
For each code smell,
- list the line numbers of the code where the smell isfocused,
- identify the design principle(s) that are violated, and
- identify some program change that the smell wouldcomplicate.
- Code fragment 1
Smells and locations?
Design principles?
Maintenance Consequences?
public void onTaxAccountNoChanged (String taxAccountNo) { String errorMessage if(errorMessage != null) { showTaxAccountNoValidationError(errorMessage); } else { String tax0fficeIdInput = taxAccountNo. substring (0, 2); Integer tax0fficeId = Integer.value0f (tax0fficeIdInput); TaxAccountNoUtil.validateTaxAccountNo (taxAccountNo); %3D %3D %3D tax0fficeRepository.findByNumber(tax0fficeId).getName (); String tax0fficeName = showTax0fficeName (tax0fficeName); 10 11 12 Show transcribed image text public void onTaxAccountNoChanged (String taxAccountNo) { String errorMessage if(errorMessage != null) { showTaxAccountNoValidationError(errorMessage); } else { String tax0fficeIdInput = taxAccountNo. substring (0, 2); Integer tax0fficeId = Integer.value0f (tax0fficeIdInput); TaxAccountNoUtil.validateTaxAccountNo (taxAccountNo); %3D %3D %3D tax0fficeRepository.findByNumber(tax0fficeId).getName (); String tax0fficeName = showTax0fficeName (tax0fficeName); 10 11 12
Expert Answer
Answer to For each problem, study the supplied code, and list the code smells you see. For this exercise the code smells should b…
OR