Skip to content

Instantly share code, notes, and snippets.

@macabreb0b
Last active July 8, 2022 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macabreb0b/8e6cefbcb81b96d6dc32d96b503af67d to your computer and use it in GitHub Desktop.
Save macabreb0b/8e6cefbcb81b96d6dc32d96b503af67d to your computer and use it in GitHub Desktop.
A method-naming flow chart

because there's so much more than "get"

Is your method retrieving a record(s) from a data source? (e.g., a database or external service, or making a GET request)

get_*
fetch_*

Is your method creating a new record in a data source?

create_*

Is your method updating a record in a data source?

update_*

Is your method taking some data and changing how it looks? (but keeping it in the same object type)

format_*

Is your method making a data structure (i.e. a factory method) or taking some data and fitting it into a new data structure? (e.g., dict => namedtuple)

make_*
make_*_from_*

Is your method extracting some information from a set of resources? (e.g., "get all IDs from this list of user objects")

collect_*
collect_*_from_*

Is your method triggered by an event? (e.g., "when button X is clicked")

on_*
handle_*

TODO: when to use on vs. handle? <Link onClick={handleClickLink} />

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