Hacker News new | past | comments | ask | show | jobs | submit login

thanks for the detailed reply, this is an example of an 'okay' comment, but its still not really needed imo. you can fix this with variable and function names:

function disambiguateRecordsByGroupID() {

    recordsSortedByTime = Data.load()

    results = recordsSortedByTime.map(function(record) { return record.timestamp })

    print(results)

}



ExceptThatNobodyWantsToTypeDisambiguateRecordsByGroupID20Times. (No, IDE can only help you so much. You still lose valuable screen estate for browsing source code when we have excessively long names.)

Not to mention you only captured half of the parent's comment (the "why" of the function), so it should really be something like disambiguateRecordsByGroupIDBecauseRecordsAreAlwaysSortedByTime.


yeah, i missed a whole line of code as well :)

there should probably be a reasonable limit to the length of a name... the IDEs are great, but even without them copy-paste is pretty universal and safe for identifiers.


To get rid of comments, you've now hard-coded the algorithm into every call to `disambiguateRecordsByGroupID`. What happens if something changes and you need to disambiguate records by something other than group ID? It seems like a short comment is a pretty small price to pay for some additional robustness.


  records.SortedBy(:time).DisambiguateBy(:group_id)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: