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.

Ask HN: API Method Naming Clarity

2 pointsby tabletover 5 years ago
We are designing API and arguing with developers to death about clarity.<p>Let&#x27;s say you have a service that allow to add entities to collections. For example, you can add Task to Feature. What name is better?<p>1. addToCollection(type, id, collectionField, collectionEntityId)<p>2. addCollectionItem(type, field, id, itemId)

1 comment

jerome-jhover 5 years ago
Lacking many details here, but assuming this is C (or another function centric language), I would favor: &lt;collection&gt;_&lt;action&gt;_&lt;item&gt;()<p>So with &quot;feature&quot; and &quot;task&quot;: feature_add_task()