RFC: Use "Id" instead of "Identifier" (for Neos 9)

Hi all,

TL;DR: Do you agree with the short form as (best) practice?

we’re currently making some good progress with the Event-Sourced Content Repository (see Weekly ESCR Talk - #19 by bwaidelich) and will soon go over some fine tuning of things that are hard to change afterwards (event payload, class names, …).

One thing we stumbled upon is the many “…Identifiers” that are quite hard to read.
Sebastian and me (and you?) would like to deviate from our CGL in that specific case and rename “*Identifier” to “*Id” because it is much easier to grasp.

Compare

$someRepository->findByProductIdentifier(ProductIdentifier $productIdentifier);

vs

$someRepository->findByProductId(ProductId $productId);

(OK, that example is a little extreme, but it works for $someRepository->find(ProductId $id) too.

Any concerns?

3 Likes

Hey,

some more context – we propose changing this for Neos.ContentRepository etc; where there will be an API change anyways. IMHO we do not need to rename stuff in Flow for no specific reason…

All the best,
Sebastian

1 Like

For the record, I have a slight preference for writing “identifier”, but I’m completely fine with choosing the shorter variant (productId).

No strong opinion, if it feels better while working with the code i am fine with it.

I would personally tend to use the full name to avoid confusion of value objects with plain types.

Do it if it fits the purpose :+1:

I dislike a bit the aesthetics of ‘id’ but if it helps ^^

  • I like consistency, and thus “we don’t do abbreviations” has a place in my heart.
  • Then again Id is not really an abbreviation, so…

Do what you like in this case. :man_shrugging:

I agree with Karsten, we should really aim for consistency so either Id or Identifier but whichever is chosen should be used consistently at least in the Neos ecosystem.

At the same time Id is very much an unofficial industry standard so moving to Id may make things more easily compatible with other systems going forward.

Thank you for all the input!

I could imagine that this has a lot to do with habit. At least my personal experience was, that it feels really cumbersome to look at the written out version after I used the short form in my personal projects for a while.
Anyways, habits are important of course and we should not mindlessly force a change

Yes, same here. But I also appreciate that we agree to exceptions (and don’t write getHypertextMarkupLanguage() for example *g)

Yes, good point. We’ll start with the Content Repository for now. But if that’s done and feels good, we should add that rule to our CGL.

I don’t really think that this particular cosmetic style affects compatibility with 3rd parties to be honest. But if it does, even better :slight_smile:


When we briefly discussed this topic last week, we decided to close this thread unless severe concerns were brought up.

I’ll do this now, thanks again!

3 Likes