Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
Last active October 21, 2020 05:44
Show Gist options
  • Select an option

  • Save AshCoolman/cfb7a88590db88b8856d5755ef153bfd to your computer and use it in GitHub Desktop.

Select an option

Save AshCoolman/cfb7a88590db88b8856d5755ef153bfd to your computer and use it in GitHub Desktop.
Naming things is hard

Always beware that in English, the use of a past participle as an adjective is ambiguous between transitive and intransitive verbs (and perhaps between active and passive voice). isRecovered might mean that the object has been recovered by something else, or it might mean that the object has recovered. If your object represents a patient at a hospital, does "isRecovered" mean that the patient is fit and well, or that someone has fetched the patient back from the X-ray department? wasRecovered might therefore be better for the latter.

https://stackoverflow.com/questions/3669433/do-you-use-tense-when-naming-methods-of-boolean-return-type

Like this but with attributes/adjectives https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/

If the property/method is a boolean, use isVal() or hasVal(). https://github.com/airbnb/javascript#accessors--boolean-prefix

The tradition of naming constants in UPPER_SNAKE_CASE reflects an era before the modern IDEs that quickly reveal the const declaration. TypeScript prevents accidental reassignment. https://angular.io/guide/styleguide If I import the const into another file, do I need intellisense/type-checking to visually tell me it is constant?

LIFT

Do structure the app such that you can Locate code quickly, Identify the code at a glance, keep the Flattest structure you can, and Try to be DRY. To confirm your intuition about a particular structure, ask: can I quickly open and start work in all of the related files for this feature?

https://angular.io/guide/styleguide#lift

https://angular.io/guide/styleguide#folders-by-feature-structure Is also prep for splitting out into own module

variables should be named with their scope in mind Yep - name space: should be

Basics

Use Pronounceable names Avoid Encodings Don't be too cute Most meanings have multiple words. Pick ONE Most words have multiple meanings Nouns and Verb Phrases Use Solution Domain Names Also Use Problem Domain Names Avoid Mental Mapping Nothing is intuitive Avoid Disinformation Names are only Meaningful in Context Don't add Artificial Context No Disambiguation without Differentiation

http://www.maultech.com/chrislott/resources/cstyle/ottinger-naming.html Great https://introcs.cs.princeton.edu/java/11style/

Active vs passive

passive: He was told by a doctor to take a pill active: The doctor told him to take a pill

https://news.ycombinator.com/item?id=9599282

Nouns vs Verbs

https://ventrellathing.wordpress.com/2015/02/04/programming-languages-need-nouns-and-verbs/

Commits

https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits

Meta

https://angular.io/guide/styleguide#style-vocabulary Nice format for plain markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment