Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Rename CacheableSupportsMethodInterface to VaryingSupportInterface#27210

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@teohhanhui
Copy link
Contributor

@teohhanhuiteohhanhui commentedMay 9, 2018
edited
Loading

QA
Branch?4.1
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A

Follow up from#27105.

@teohhanhui
Copy link
ContributorAuthor

/cc@dunglas

Bug label was a mistake.

@dunglasdunglas removed the Bug labelMay 9, 2018
@teohhanhui
Copy link
ContributorAuthor

Travis CI build errored due to network issues...

* {@inheritdoc}
*/
publicfunctionhasCacheableSupportsMethod():bool
publicfunctionisSupportsVaryByData():bool
Copy link
Member

@nicolas-grekasnicolas-grekasMay 9, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not english-native, but I feel like this should be either "doesSupportsVaryByDataInterface" or "isSupportsVaryingByDataInterface". The context should also be taken into account, so that this could be "doesSupportsVaryByDataOrContextInterface".

All in all, I'm not sure the new name is better. But I'll let others decide since I'm biased, by being the author of the original proposal.

ogizanagi reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

supportsMethodVaries,hasVaryingSupportsMethod? But I'm not really convinced either.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'll improve it. 😄

@nicolas-grekasnicolas-grekas added this to the4.1 milestoneMay 9, 2018
@teohhanhuiteohhanhuiforce-pushed therename/serializer-supports-cacheable branch from72de9df to2fb8ce9CompareMay 11, 2018 10:02
@teohhanhui
Copy link
ContributorAuthor

teohhanhui commentedMay 11, 2018
edited
Loading

Search for "varying support" on some English corpus (actually the plural is corpora):

https://corpus.byu.edu/coca/
https://corpus.byu.edu/glowbe/

They don't support direct links.

@teohhanhuiteohhanhui changed the title[Serializer] Rename CacheableSupportsMethodInterface to SupportsVaryInterface[Serializer] Rename CacheableSupportsMethodInterface to VaryingSupportInterfaceMay 11, 2018
@teohhanhuiteohhanhuiforce-pushed therename/serializer-supports-cacheable branch from2fb8ce9 toda5038bCompareMay 11, 2018 12:48
* file that was distributed with this source code.
*/

namespaceSymfony\Component\Serializer\Normalizer;
Copy link
ContributorAuthor

@teohhanhuiteohhanhuiMay 11, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've removed any mention about caching, because that is an implementation detail of what the serializer does with classes implementing this interface. I think it's better to have a pure abstraction here.

If necessary, we could document it in theSerializer class. WDYT@nicolas-grekas@dunglas?

@dunglas
Copy link
Member

I like this one (VaryingSupportInterface) 👍

@teohhanhui
Copy link
ContributorAuthor

Current proposed method name:
isVaryingSupportByData

Interpretation:
Is this normalizer and/or denormalizervarying itssupport by the data provided?

Alternative proposed method name:
isSupportVariedByData

Interpretation:
Is this normalizer and/or denormalizer'ssupportvaried by the data provided?

Yes, "varied by" fares very well in the above mentioned corpus (corpora). But I'm concerned that it might be misinterpreted as:
Does this normalizer and/or denormalizersupport (some kind of?) varied (thing?) by data???

Which might cause some confusion...

* {@inheritdoc}
*/
publicfunctionhasCacheableSupportsMethod():bool
publicfunctionisVaryingSupportByData():bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I propose:isVaryingSupport (it can also vary depending of the context).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd prefer that we make it explicit in the method name.

@teohhanhui
Copy link
ContributorAuthor

Okay, it seems like "varied on" is the right phrase.

Source: the above mentioned corpus / corpora.

@teohhanhuiteohhanhuiforce-pushed therename/serializer-supports-cacheable branch fromda5038b to5a1f084CompareMay 11, 2018 13:22
@teohhanhui
Copy link
ContributorAuthor

@ogizanagi
Copy link
Contributor

ogizanagi commentedMay 14, 2018
edited
Loading

None of us are native-english speakers, so I think we should ask someone who is.
At least "varied by" sounds really weird to me, "varied on" probably is better (so 👍 ).

EDIT: actually,isSupportVaryingOn* looks more correct to me.

dunglas reacted with thumbs up emoji

@weaverryan
Copy link
Member

I actually prefer the old name :).

But, if we're going to change it, from an English perspective:

A)VaryingSupportsInterface with an "s". I saw the reason for removing the "s" earlier. But, we're talking about whether or not thesupports() method can be cached/varies. I think NOT having the "s" complicates things

B)doesSupportsVary() ordoesSupportsVaryOnDataOrContext (but the second is long). I know that we like usingis as a prefix, but it just doesn't sound right here.

Sorry to muck things up further :)

@ogizanagi
Copy link
Contributor

👍doesSupportsVary for me. Thanks@weaverryan

@dunglas
Copy link
Member

Keeping the old name for me (doesSupportsVary is my second choice)

@fabpot
Copy link
Member

Naming is really hard :) I'm not a big fan of the current name (and don't have any great idea for better names), but I think that the current naming is still better than the alternatives.

@teohhanhui
Copy link
ContributorAuthor

@weaverryan

But, we're talking about whether or not the supports() method can be cached/varies.

I should explain the rationale in depth. What I'm doing here is to use "support" as a noun, i.e. the concept of whether the normalizer supports normalizing / denormalizing a certain something. The previous interface name was bad for 2 major reasons:

  1. It clearly says "cacheable" when in fact, that might or might not be the case.
  2. It directly refers to the "supports method" which makes it a confusing abstraction.

By changing it to an interface which says how this support may vary, we borrow the same concept from the HTTP Vary header.

@nicolas-grekas
Copy link
Member

HTTP vary is a list ofwhat it varies-by. Here it's a boolean. Thewhat is thus abstract.
I think we should close now: I'm pretty sure we're growing frustration on your side because you might feel we don't get your point. I do, I promise, and I'm confident enough others get your point also, and still expressed a preference for the status quo, which is a good enough sign to move forward and not spend more time here IMHO.

@teohhanhui
Copy link
ContributorAuthor

I'll do one last attempt.

  • variesSupportOnDataAndContext
  • canVarySupportByDataAndContext (I think this is the least confusing)
  • doesSupportVaryByDataAndContext

@teohhanhui
Copy link
ContributorAuthor

I've thought of a different way that involves more than a naming change. I need to try and see if it'll actually work, but if it does I'm confident that it'll be accepted. Stay tuned!

@teohhanhui
Copy link
ContributorAuthor

Never mind. I tried to implement my idea, but it doesn't work:

<?php/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */namespaceSymfony\Component\Serializer\Normalizer;/** * Defines the interface for checking normalization / denormalization support, * where the result of the check may be safely cached. * * @author Kévin Dunglas <dunglas@gmail.com> */interface CacheableSupportInterface{/**     * Checks whether the specified type and format is supported for     * normalization and denormalization.     *     * If the return value is null, it means that support could not be     * determined based on these criteria alone. Support will have to be     * checked using the {@see NormalizableInterface::supportsNormalization} /     * {@see DenormalizableInterface::supportsDenormalization} methods.     */publicfunctionsupports(string$type, ?string$format =null): ?bool;}

@teohhanhuiteohhanhui deleted the rename/serializer-supports-cacheable branchMay 16, 2018 14:34
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

7 participants

@teohhanhui@dunglas@ogizanagi@weaverryan@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp