refactor(cache): makeName -> createHash for clarity#355
Merged
Conversation
- I've actually been confused multiple times as to what `makeName` does when I read through the cache
- I re-read the code and then am like "oh it's the hash"...
- so thought renaming it to `createHash` would make things **a lot** clearer
- `Name` -> `Hash`
- `make` -> `create` because that's the more common terminology in programming
- also rename variables that reference `makeName`'s return from `name` to `hash`
- for the same reason around clarity -- this way it's quicker to interpret whenever you see it too
- not to mention, `name` can be confusing since we also have `id`, which is a path that is very similar to a name too
- and lots of `fileName`s too
- so good to disambiguate/differentiate a bit
Owner
|
Really it's more like a key, with additional requirement of being filesystem safe, but this works too |
Collaborator
Author
Hashes are keys, so I think that terminology works 👍
Ah, that's a good point that I didn't think about, but I guess a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rename
makeName->createHashandname->hashintscache.tscode for clarityDetails
I've actually been confused multiple times as to what
makeNamedoes when I read through the cachecreateHashwould make things a lot clearerName->Hashmake->createbecause that's the more common terminology in programmingalso rename variables that reference
makeName's return fromnametohashnamecan be confusing since we also haveid, which is a path that is very similar to a name toofileNames tooMisc Notes
Been digging into cache bugs more now that I've fixed a ton of the non-cache ones, so doing a bit of refactoring here as I'm going through it more frequently and in more depth.