TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

211 pointsby wonderfulyalmost 6 years ago

31 comments

TimTheTinkeralmost 6 years ago
At first glance this looked like a code smell, but after some reflection I can&#x27;t think of a cleaner, more readable way to uniquely identify each possible relationship -- especially in a strongly-typed language with an IDE.<p>Here&#x27;s the full list: <a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;contacts_constants" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;contacts_...</a>
评论 #20351885 未加载
评论 #20352076 未加载
评论 #20352615 未加载
评论 #20352473 未加载
评论 #20352256 未加载
评论 #20352192 未加载
评论 #20352765 未加载
评论 #20351851 未加载
TorKlingbergalmost 6 years ago
I can see why this is needed. English has very broad words for relatives like &quot;grandfather&quot; or &quot;aunt&quot;. 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.<p>English words like &quot;aunt&quot; 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&#x27;t matter. In someones address book you can&#x27;t do that.
评论 #20353072 未加载
评论 #20352776 未加载
评论 #20358339 未加载
评论 #20352595 未加载
评论 #20352762 未加载
评论 #20352613 未加载
mraisonalmost 6 years ago
There’s also CNLabelContactRelationColleauge. Oops :)<p><a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelcontactrelationcolleauge" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelco...</a>
评论 #20355821 未加载
评论 #20352122 未加载
yorwbaalmost 6 years ago
表姐, in case you were wondering.
评论 #20351667 未加载
评论 #20351623 未加载
评论 #20351656 未加载
评论 #20351607 未加载
评论 #20352074 未加载
评论 #20352385 未加载
sixdimensionalalmost 6 years ago
“There are only two hard things in Computer Science: cache invalidation and naming things.” [1]<p>[1] <a href="https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;TwoHardThings.html" rel="nofollow">https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;TwoHardThings.html</a>
评论 #20351705 未加载
评论 #20353164 未加载
salgernonalmost 6 years ago
For a long time, the Carbon universal headers Included a plain, non-namespaced (c header) MacTypes.h which included:<p>enum { h = 0, v = 1 };<p>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..
euskealmost 6 years ago
Well, there&#x27;s CNLabelContactRelationYoungerCousinMothersSiblingsDaughterOrFathersSistersDaughter, which is two letters longer than CNLabelContactRelationElderCousinMothersSiblingsDaughterOrFathersSistersDaughter.<p><a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelcontactrelationyoungercousinmotherssiblingsdaughterorfatherssistersdaughter" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelco...</a><p>This is my favorite topic.
评论 #20352001 未加载
评论 #20351935 未加载
aaronbrethorstalmost 6 years ago
I&#x27;m grateful that Apple at least prefixed this. IIRC, between iOS 11 and 12, Apple added a <i>Contact</i> 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 <i>Contact</i> class.<p>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.
评论 #20352030 未加载
princekoltalmost 6 years ago
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:<p>CoreLocation: CL (CLLocation)<p>SpriteKit: SK (SKScene)<p>CloudKit: CK (CKRecord)<p>CoreVideo: CV (CVBuffer)<p>LocalAuthentication: LA (LAContext)<p>So on and so forth...
评论 #20353003 未加载
评论 #20352987 未加载
rntksialmost 6 years ago
I spent 10 minutes laughing about this and the worst part is my wife asking why am I laughing and I <i>cannot</i> explain why
评论 #20342567 未加载
shaggyfrogalmost 6 years ago
NativLang did a video about kinship systems that is relevant here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YOi2c2d3_Lk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YOi2c2d3_Lk</a>
zarothalmost 6 years ago
Upvote for breaking HN CSS on mobile.
chjalmost 6 years ago
A good example of poor naming. Explained:<p>Your younger cousin sister, either from one of your mother&#x27;s brothers and sisters, or from one of your father&#x27;s sisters.<p>Or two characters in Chinese: 表妹(BiaoMei). If she is from one of your father&#x27;s brothers, she&#x27;s your 堂妹(TangMei). The latter is regarded as being closer because you share the same family name, but nowadays it just doesn&#x27;t matter any more.<p>Some of the other commenters think it&#x27;s 表姐. No matter who is right, you see, the long name bears no clear meaning even for Chinese.
评论 #20354940 未加载
dmixalmost 6 years ago
Can HN add wordbreaking css on mobile?<p>This breaks the width of the page on mobile.
评论 #20351588 未加载
eslaughtalmost 6 years ago
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.<p>Ok, I see it now: there are wbr tags between the words on the page. TIL.
aitchnyualmost 6 years ago
Anybody care to introduce me to this? Why does it have to be father&#x27;s sister but mother&#x27;s sibling? And how does elder and younger cousins behave differently?
评论 #20352184 未加载
评论 #20352073 未加载
评论 #20352245 未加载
shubhamjainalmost 6 years ago
Java Swing took verbosity even further than that. I present to you a 92-character class name [1].<p>&gt; InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState<p>Thankfully, I think they fixed it in the newer version.<p>[1]: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;peterlawrey&#x2F;status&#x2F;577176384520384512" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;peterlawrey&#x2F;status&#x2F;577176384520384512</a>
apialmost 6 years ago
Needs CNFathersMothersNephewsCousinsFormerRoommate
评论 #20352594 未加载
评论 #20351537 未加载
Waterluvianalmost 6 years ago
Is this just one of those exceptional cases when having a strict variable naming convention doesn&#x27;t work out?
评论 #20351573 未加载
评论 #20351779 未加载
jimktrains2almost 6 years ago
I guess I&#x27;m confused as to the specificity of this. Why are a paternal uncle&#x27;s daughters not included? Why only elder?<p>Also curious as to why this is important enough to have a specific type of contact for?
floatingatollalmost 6 years ago
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 :)
tintintinalmost 6 years ago
For those using Refined Hacker News[1] for Firefox on Android, you can add this to the <i>Custom CSS</i> field to prevent the overflow:<p><pre><code> tr.athing td.title:not([valign=&quot;top&quot;]) { word-break: break-word; } </code></pre> [1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;plibither8&#x2F;refined-hacker-news" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;plibither8&#x2F;refined-hacker-news</a>
ridiculous_fishalmost 6 years ago
Winforms has some gems:<p>DataGridViewColumnDividerDoubleClickEventArgs<p>ListViewVirtualItemsSelectionRangeChangedEventHandler
评论 #20351999 未加载
sbr464almost 6 years ago
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?
enriqutoalmost 6 years ago
Camel case needs to die, it&#x27;s been too long and it&#x27;s not funny anymore.
ttfleealmost 6 years ago
Could these ever be swiftified as enums?
peapickeralmost 6 years ago
Well first cousin anyway.
jeromebaekalmost 6 years ago
Help, this post is breaking Hacker News mobile because the title is too long without spaces.
tolgahanuzunalmost 6 years ago
wat? :D
dshields1almost 6 years ago
That label is so long it’s breaking the HN front page layout for me on mobile.
评论 #20351533 未加载
评论 #20351478 未加载
评论 #20351462 未加载
评论 #20352488 未加载
评论 #20351687 未加载
评论 #20351594 未加载
评论 #20351717 未加载
评论 #20356095 未加载
评论 #20352267 未加载
mgranadosalmost 6 years ago
¯\_(ツ)_&#x2F;¯