To me getPromotedPosts() contains the idea that the function won’t run a neural model to decide which post should be promoted or load information from the internet but return to me data that’s already available in the program. On the other hand promotedPosts() feels unclear about that.
I’m curious whether other people have the same intuition here.
if it’s called getPromotedPosts then it is probably fetching some information from somewhere—maybe the internet, maybe a database—and probably isn’t doing any computation to speak of;
if it’s called promotedPosts then it is probably either computing something or just using a value it already knows and can return quickly and easily.
I am not sure there’s any function name that would be perfectly neutral between (1) extremely cheap operation, probably just returning something already known, (2) nontrivial calculation, and (3) nontrivial fetching.
There’s also a bit of ambiguity about whether something called getPromotedPosts is fetching the posts themselves or just cheap representations of them (e.g., ID numbers, pointers, etc.).
So I might consider names like fetchPromotedPostIDsFromDatabase, retrievePromotedPostContent, inferPromotedPostsByModel, cachedPromotedPostList, etc. Or I might prefer a brief name like promotedPosts and put information about what it does and the likely performance implications in a comment, docstring, etc.
To me getPromotedPosts() contains the idea that the function won’t run a neural model to decide which post should be promoted or load information from the internet but return to me data that’s already available in the program. On the other hand promotedPosts() feels unclear about that.
I’m curious whether other people have the same intuition here.
My intuition says that
if it’s called getPromotedPosts then it is probably fetching some information from somewhere—maybe the internet, maybe a database—and probably isn’t doing any computation to speak of;
if it’s called promotedPosts then it is probably either computing something or just using a value it already knows and can return quickly and easily.
I am not sure there’s any function name that would be perfectly neutral between (1) extremely cheap operation, probably just returning something already known, (2) nontrivial calculation, and (3) nontrivial fetching.
There’s also a bit of ambiguity about whether something called getPromotedPosts is fetching the posts themselves or just cheap representations of them (e.g., ID numbers, pointers, etc.).
So I might consider names like fetchPromotedPostIDsFromDatabase, retrievePromotedPostContent, inferPromotedPostsByModel, cachedPromotedPostList, etc. Or I might prefer a brief name like promotedPosts and put information about what it does and the likely performance implications in a comment, docstring, etc.