
CNLabelContactRelation&NegativeMediumSpace;YoungerCousin&NegativeMediumSpace;MothersSiblingsDaughter&NegativeMediumSpace;OrFathersSistersDaughter - wonderfuly
https://developer.apple.com/documentation/contacts/cnlabelcontactrelationyoungercousinmotherssiblingsdaughterorfatherssistersdaughter
======
TimTheTinker
At first glance this looked like a code smell, but after some reflection I
can't think of a cleaner, more readable way to uniquely identify each possible
relationship -- especially in a strongly-typed language with an IDE.

Here's the full list:
[https://developer.apple.com/documentation/contacts/contacts_...](https://developer.apple.com/documentation/contacts/contacts_constants)

~~~
c3534l
You need an intermediate representation (like a tree) rather than attempt to
brute force every possible permutation up until some arbitrary point. Even if
that weren't the case, it'd be better to give it a more obscure name or create
some kind of naming system and then document it rather than demonstrate why
self-documenting code can become self-defeating if taken to an extreme.

~~~
masklinn
The issue of a tree is you could trivially create nonsensical relationships.
An alternative would be some sort of nested attributes / tag set but even
that's not excellent.

A second issue is, this is probably a localisation / cultural concern: below,
yorwba notes that this relationship is a specific term in chinese kinship:
[https://en.wikipedia.org/wiki/Chinese_kinship#Common_extende...](https://en.wikipedia.org/wiki/Chinese_kinship#Common_extended_family_and_terminology).

------
TorKlingberg
I can see why this is needed. English has very broad words for relatives like
"grandfather" or "aunt". Most languages have more specific words, especially
Chinese where there are separate words for fathers or mothers side, older or
younger and sibling or siblings spouse. You also often use these relation
words rather than their names when referring to a relatives. If this code was
in Chinese, they would all be short words.

English words like "aunt" cannot really be translated into Chinese. If you are
translating a book you either try to figure out the exact relation from the
context, or just pick one if it doesn't matter. In someones address book you
can't do that.

~~~
SyneRyder
Genuinely curious, but is it actually like that in most languages? I wondered
if it was maybe an East/West difference, since I haven't come across that in
my French & German learning, and I didn't think Dutch or Danish were like that
either. But apparently Swedish does have this (eg faster/moster for paternal
aunt & maternal aunt)?

(Most of my learning is via Duolingo, so I'm no expert, just curious.)

~~~
mantas
Didn't even English have a bunch of words that were lost as time went by?

We do have quite a few words in Lithuanian (e.g. for maternal/paternal
branches and more detailed words for "X in law"). But it was getting
simplified in the past few decades. I've heard quite a few words that I
couldn't describe without looking at the dictionary.

~~~
zerr
Yup -
[https://www.umanitoba.ca/faculties/arts/anthropology/tutor/k...](https://www.umanitoba.ca/faculties/arts/anthropology/tutor/kinterms/oldenglish.html)

------
mraison
There’s also CNLabelContactRelationColleauge. Oops :)

[https://developer.apple.com/documentation/contacts/cnlabelco...](https://developer.apple.com/documentation/contacts/cnlabelcontactrelationcolleauge)

~~~
microwavecamera
So out of curiosity I Googled it. Either it's a _really_ common mistake or a
regional thing. "Colleauge" has 857k results.

[https://www.google.com/search?q=%22colleauge%22](https://www.google.com/search?q=%22colleauge%22)

------
yorwba
表姐, in case you were wondering.

~~~
kylec
The "CN" is just the prefix for the Contacts framework, it doesn't refer to
Chinese

~~~
wggl
表姐 means older female cousin of a different surname. If surnames are always
passed down via the father that implies an elder cousin who is either your
mother’s sibling’s daughter or your father’s sister’s daughter.

~~~
DavidSJ
So what happens if, by chance, a woman in your family marries someone of the
same surname? Does the 表姐 label then not apply where it otherwise would?

~~~
iforgotpassword
The phone will freeze until the battery is completely drained. NEVER connect
the charger while in this state!

------
sixdimensional
“There are only two hard things in Computer Science: cache invalidation and
naming things.” [1]

[1]
[https://martinfowler.com/bliki/TwoHardThings.html](https://martinfowler.com/bliki/TwoHardThings.html)

~~~
whoisthemachine
And off by one errors

~~~
goatlover
If only there were 1 based PLs.

~~~
masklinn
They don't fix off-by-one errors, just move them around.

------
salgernon
For a long time, the Carbon universal headers Included a plain, non-namespaced
(c header) MacTypes.h which included:

enum { h = 0, v = 1 };

This could lead to very confusing compiler errors... it was there for
compatibility with an anonymous pascalnunion that let you treat a pascal Rect
as an anonymous array of two Point structures..

------
euske
Well, there's
CNLabelContactRelationYoungerCousinMothersSiblingsDaughterOrFathersSistersDaughter,
which is two letters longer than
CNLabelContactRelationElderCousinMothersSiblingsDaughterOrFathersSistersDaughter.

[https://developer.apple.com/documentation/contacts/cnlabelco...](https://developer.apple.com/documentation/contacts/cnlabelcontactrelationyoungercousinmotherssiblingsdaughterorfatherssistersdaughter)

This is my favorite topic.

~~~
dang
Ok, we changed to that from
[https://developer.apple.com/documentation/contacts/cnlabelco...](https://developer.apple.com/documentation/contacts/cnlabelcontactrelationeldercousinmotherssiblingsdaughterorfatherssistersdaughter).
Thanks!

~~~
eridius
Does this now hold the record for most frivolous moderator story edit?

~~~
masklinn
Not just that, it actively broke and confuses existing discussions.

------
aaronbrethorst
I'm grateful that Apple at least prefixed this. IIRC, between iOS 11 and 12,
Apple added a _Contact_ class somewhere within their standard set of
frameworks. I was maintaining an app that used CoreData as a store and did not
have prefixed Core Data entity names. And of course it had its own _Contact_
class.

Long story short, I started building against the newer SDK and the app started
crashing in the most oblique way possible. Prefixing the entity and class name
solved the problem, but I only stumbled on that through a combination of luck,
intuition, and half a day of banging my head against a wall.

~~~
galad87
Apple recommends to use at least a three character prefix in your objective-c
classes to avoid collisions.

~~~
aaronbrethorst
I am well-acquainted with Apple's recommendations. The codebase I inherited
was not. Unfortunately, Apple's Core Data documentation is also not acquainted
with Apple's recommendations:
[https://developer.apple.com/library/archive/documentation/Co...](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/KeyConcepts.html)

------
princekolt
Why is everyone assuming this is about Chinese??? CN is the class prefix for
the Contacts.framework library, like every other Apple API. For example:

CoreLocation: CL (CLLocation)

SpriteKit: SK (SKScene)

CloudKit: CK (CKRecord)

CoreVideo: CV (CVBuffer)

LocalAuthentication: LA (LAContext)

So on and so forth...

~~~
lostphilosopher
It's not about the "CN" bit. People are talking about why the variable exists
at all. Essentially the reason being ventured is that that relationship has a
specific name and meaning in Chinese with no English equivalent beyond an
exacting familial definition. Imagine trying to express "grandfather" in a
language that doesn't have the concept. You might end up with "father's
father."

(I know nothing about Chinese. Just reporting what's been said elsewhere.)

~~~
duskwuff
> Imagine trying to express "grandfather" in a language that doesn't have the
> concept.

Or, for a more concrete example: "daughter-in-law". Many of the English "-in-
law" relations may seem foreign to cultures with different conceptions of the
extended family.

------
rntksi
I spent 10 minutes laughing about this and the worst part is my wife asking
why am I laughing and I _cannot_ explain why

~~~
wonderfuly
yeah, you cannot

------
shaggyfrog
NativLang did a video about kinship systems that is relevant here:
[https://www.youtube.com/watch?v=YOi2c2d3_Lk](https://www.youtube.com/watch?v=YOi2c2d3_Lk)

------
zaroth
Upvote for breaking HN CSS on mobile.

------
chj
A good example of poor naming. Explained:

Your younger cousin sister, either from one of your mother's brothers and
sisters, or from one of your father's sisters.

Or two characters in Chinese: 表妹(BiaoMei). If she is from one of your father's
brothers, she's your 堂妹(TangMei). The latter is regarded as being closer
because you share the same family name, but nowadays it just doesn't matter
any more.

Some of the other commenters think it's 表姐. No matter who is right, you see,
the long name bears no clear meaning even for Chinese.

~~~
umanwizard
The other commenters are saying 表姐 because it was originally "Elder", not
"Younger". The moderators decided to change it and break all the discussions.

------
dmix
Can HN add wordbreaking css on mobile?

This breaks the width of the page on mobile.

~~~
mrob
Looks like a good place for some zero-width spaces.

[https://en.wikipedia.org/wiki/Zero-
width_space](https://en.wikipedia.org/wiki/Zero-width_space)

~~~
saagarjha
Those aren’t automatic, though.

~~~
mrob
HN already supports title edits, so it's simpler than changing the CSS, and
it's easier to read because the breaking is on the internal word boundaries.
Here's the title with the zero-width spaces added:

CN Label Contact Relation Elder Cousin Mothers Siblings Daughter Or Fathers
Sisters Daughter

EDIT: HN strips zero-width spaces and replaces them with normal spaces, so I
can't post it here.

~~~
asutekku
Then the title would not make sense anymore. Adding a simple css rule would
also be futureproof, because i’m quite sure this is not going to be the last
time an absurdly long title word appears.

------
eslaught
Does this page have some sort of camel-case aware word breaking? As I resize
the page I notice it always remains broken at a word boundary and never breaks
inside a word.

Ok, I see it now: there are wbr tags between the words on the page. TIL.

------
aitchnyu
Anybody care to introduce me to this? Why does it have to be father's sister
but mother's sibling? And how does elder and younger cousins behave
differently?

~~~
masklinn
This one seems to come from chinese

* in many EA and SEA culture, there's a difference made based on the age differential aka different term of address to people older than you v younger than you, also gender

* chinese (and likely others) also make a difference between patrilineal relationships and matrilineal, so there's a term of address for people related through the father's brother (and thus sharing your family name) versus other parent's sibling (not sharing your family name).

The combination of the two yields what you have above:

* cousins through your father's brother (sharing family name) are 堂 (táng) all others are 表 (biǎo)

* older brother is 兄 (xiōng), younger brother is 弟 (dì), elder sister is 姊 (zǐ) and younger sister is 妹 (mèi)

Therefore an older "sister" (same generational rank) through an other line
than your father brothers would be 表姊 (biǎozǐ).

~~~
echaozh
Well we mainlanders prefer 姐（jie）. Biaozi sounds the same as bitch so it's
never heard.

------
shubhamjain
Java Swing took verbosity even further than that. I present to you a
92-character class name [1].

>
> InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState

Thankfully, I think they fixed it in the newer version.

[1]:
[https://twitter.com/peterlawrey/status/577176384520384512](https://twitter.com/peterlawrey/status/577176384520384512)

------
api
Needs CNFathersMothersNephewsCousinsFormerRoommate

~~~
cmroanirgo
You missed a sibling or younger or elder in there somewhere.

~~~
Klonoar
It's a Spaceballs reference. :)

------
Waterluvian
Is this just one of those exceptional cases when having a strict variable
naming convention doesn't work out?

~~~
eof
Seems to be working fine.

------
jimktrains2
I guess I'm confused as to the specificity of this. Why are a paternal uncle's
daughters not included? Why only elder?

Also curious as to why this is important enough to have a specific type of
contact for?

------
floatingatoll
It’s kind of nice seeing the homepage with a fixed row height per story! I
guess it will not last bit that was a nice thing that came of this. Thanks, OP
:)

------
tintintin
For those using Refined Hacker News[1] for Firefox on Android, you can add
this to the _Custom CSS_ field to prevent the overflow:

    
    
        tr.athing td.title:not([valign="top"]) {
            word-break: break-word;
        }
    

[1]: [https://github.com/plibither8/refined-hacker-
news](https://github.com/plibither8/refined-hacker-news)

------
ridiculous_fish
Winforms has some gems:

DataGridViewColumnDividerDoubleClickEventArgs

ListViewVirtualItemsSelectionRangeChangedEventHandler

~~~
rimliu
There is also this classic:

[https://github.com/mattl/opensource.apple.com/blob/88cbaab4a...](https://github.com/mattl/opensource.apple.com/blob/88cbaab4a42e97cbbfe6b660f2f0945536821be6/src/system_cmds/system_cmds-735/shutdown.tproj/shutdown.c#L132)

------
sbr464
This is a joke right? Please explain if not. Why wouldn’t you just name the
variable relationship (or CNRelationship to adhere to nonsensical globals) and
abstract the method for getting there to other logic?

------
enriquto
Camel case needs to die, it's been too long and it's not funny anymore.

------
ttflee
Could these ever be swiftified as enums?

------
peapicker
Well first cousin anyway.

------
jeromebaek
Help, this post is breaking Hacker News mobile because the title is too long
without spaces.

------
tolgahanuzun
wat? :D

------
dshields1
That label is so long it’s breaking the HN front page layout for me on mobile.

~~~
cbsks
Yup. @dang, can you fix this?

~~~
dang
In principle yes, but I tried in 4 (edit: 5) browsers and couldn't reproduce
the problem, and it's late here and I'm running out of steam. So you may have
to suffer overnight. Sorry about that.

Edit: ok, thanks to
[https://en.wikipedia.org/wiki/Unicode_character_property#Whi...](https://en.wikipedia.org/wiki/Unicode_character_property#Whitespace)
I put in a bunch of _& NegativeMediumSpace;_. I hope that fixes it because I
need to sign off now. If it isn't fixed, it would be helpful if someone would
email hn@ycombinator.com so we see that in the morning. Short term memory does
not survive the firehose.

~~~
garaetjjte
It probably shouldn't be visible in title tag:
[https://i.imgur.com/a1RLCt0.png](https://i.imgur.com/a1RLCt0.png)

~~~
dang
You're right.

------
mgranados
¯\\_(ツ)_/¯

