-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plural vs. singular for certain core module names that aren't piece types in A3 #2261
Comments
|
@stuartromanek it sounds like you like the proposed change to remove the extra layer of objects from apos.cache and just include the namespace in each call to get or set something? |
|
@boutell yes, I'm in favor of the proposed changes to |
|
Sorry to be a pain 😬 I won't fight if everyone else prefers the plural form of |
The singular |
I think given that everything else will be singular (no module other than utils comes close to Ben's criteria for a plural), and that Node.js uses the singular for its core |
Question about our upcoming renaming plans. We said we would give all modules singular names. Some examples that make me think follow.
apos.areas
: this is a module that is in charge of all areas, but that excuse isn’t good enough for a pieces module to be plural, so it’s not good enough here. So it becomesapos.area
. Or I’m going crazy. Sure, fine.There is no conflict with inserting an area in a template because that is
{% area %}
now. However it does mean that we might have to find another way of linting for projects with legacy 2.xapos.area
calls in them. Because we can't just replaceapos.area
with a helpful warning function if it is the name of a module. At least they will get an error ("not a function").apos.utils
: this literally contains more than one utility. “Literally contains” is @localghost443 's suggested trigger for a plural. But, nodejs itself has a util module, which I’ve often found confusing because apostrophe contains a utils module. Do we rename our module to match?apos.caches
: in charge of all caches - yes, yes, not good enough - but the syntax is gonna be weird if we make it singular.apos.cache.get
really, really sounds like it gets a value out of a cache! But it doesn't. It gets you a cache, that you can get values from.OK, big 👾 🧠 moment: I propose we fix this forever like so...
We kill the idea of multiple cache objects as part of the API completely, and just always include a namespace name when getting and setting things. Having multiple caches, one per namespace, as part of the implementation under the hood depends on how the cache is implemented but an apostrophe developer should not care. They should have a simple, normal apostrophe module method they can call to get something. This also fixes our documentation about how to use the module, which is currently written in a weird way because of the "call get to get a cache object" issue.
Can I get a hell yeah?
cc @stuartromanek @abea @falkodev
The text was updated successfully, but these errors were encountered: