November 2024
Intermediate to advanced
300 pages
7h 12m
English
The last thing to tackle was some final code cleanup.
The solution works. The method extractSuffix should be reworked, however, into a pure function (i.e., with no side effects). The side effects, if needed, should occur in normalizeName.
Also, I just noticed the silliness in formatLastNameFirst. Inline the temporaries, please.
Oh my. I don’t want to show you the abomination it produced, but I suppose I must. Here’s a small piece of it:
| | public String normalizeName(String name) { |
| | var extractedResult = extractSuffix(name); |
| | var nameParts = extractedResult[0].split(" "); |
| | var suffix = extractedResult[1]; |
| | |
| | if (nameParts.length == ... |
Read now
Unlock full access