Spotted a "mistakes" (CC Ep 19.)

90 views
Skip to first unread message

doug.he...@hotmail.com

unread,
Jun 12, 2013, 4:17:52 AM6/12/13
to clean-code...@googlegroups.com
Dear Uncle Bob,

The invertName() function makes two assumptions about the format of the originalName:
  1. The names are given in <honorific> <givenName> <familyName> <post nominals> order.
  2. The names are delimited by spaces.
In Chinese culture, "first name" is the family name, and "last name" is the given name (community before individual). Names are not delimited by spaces.
To allow for this particular cultural difference, I think invertName would have to take the separate name components (honorifics, givens, family, and post nominals) as parameters, which would make the NameInverter merely a NameFormatter with no responsibility for parsing and identifying honourifics, just formatting. This would allow distinction between multiple given names, double-barrelled surnames and post nominals which are currently all handled as post nominals.
I would also prefer to see givenName and familyName replace firstName and lastName respectively as they are less ambiguous variable names.
It may also be beneficial to configure the delimiter (or choice of delimiters) on construction of the NameInverter.

Sincerely,
Douglas

P.S. Epic series!

Uncle Bob

unread,
Jun 14, 2013, 4:15:04 AM6/14/13
to clean-code...@googlegroups.com
Winner #16.  

Yes, there are bugs in the requirements when you extrapolate out into multiple cultures. 

The variable name change seems reasonable.
Reply all
Reply to author
Forward
0 new messages