rules icon indicating copy to clipboard operation
rules copied to clipboard

Naming inside Entity

Open GregOnNet opened this issue 5 years ago • 5 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behaviour

The naming of Entity members do not follow a common convention.

Expected behaviour

It should be easy to identify members coming form Entity.

Minimal reproduction of the problem with instructions

interface Entity {
  identity(): string;
  className(): string;
  getTypes(): any;
}

What is the motivation / use case for changing the behaviour?

Having an easy-to-follow naming structure.

interface Entity {
  entityIdentifier(): string; // before: identity
  entityName(): string;       // before: className
  entityTypes(): any;         // before: getTypes
}

GregOnNet avatar Jan 25 '20 10:01 GregOnNet

What is this common convention are you refering to ?

fkolar avatar Jan 25 '20 21:01 fkolar

In this case it would be the prefix entity. It clearly expresses that the methods come from the interface.

Another example would be Angular itself: ngOnInit, ngOnDestroy,...

I think the benefit is that as the entity grows, a visual boundary between implemented and own members exist.

But I also have to confess that this proposal is based on my personal preference.

GregOnNet avatar Jan 26 '20 07:01 GregOnNet

make sense.

It will be braking change as most of the apps, demos, tests needs to be updated.

fkolar avatar Jan 26 '20 13:01 fkolar

A possible way without breaking anyone would be introducing an interface in parallel.

interface MetaEntity {
  metaIdentifier(): string; // before: identity
  metaName(): string;       // before: className
  metaTypes(): any;         // before: getTypes
}

I consider this issue to be very low prio. For sure, there are more important todos.

GregOnNet avatar Jan 26 '20 16:01 GregOnNet

Or we can simplly write not into braking changes, later for such things we can use schematics. Let;s do it.

fkolar avatar Feb 05 '20 17:02 fkolar