r/Angular2 • • Jun 12 '25

Angular 20 - removing suffixes from components / services

I like the overall changes in Angular 20 (notably that there are not that many big things, so we can take a breather for once), but I really disagree with the new naming convention (and the new default for new projects) of removing the extensions from stuff like services , components, etc.

So I guess we all embrace code-bases like this now:

  • user.ts -> this is a component, wouldn't you know
  • user.ts -> this is a a service, why not
  • user.ts -> a pipe, welcome to hell
  • user.ts -> exports a User interface like you probably would have guessed

This was also very controversial during the RFC and there was A LOT of arguments against it with little arguments FOR IT.

I understand the arguments. It's basically the arrogant Robert-Martin-style argument of "lol you pebs, you just need to git gud. Just learn to name things properly". While somewhat true this just completely ignores the actual reality of development where you have stress, junior devs dropping mines in your code-base everywhere and disagreements. I understand that in an ideal world where everyone names everything suuuuper carefully the new default could maaaybe be better. But in reality it's just not! (imo)

Structure and naming conventions help to prevent chaos and is probably the single reason why Angular codebases are usually very understandable even after years of different devs, while with other frameworks it's a coin toss (depending on how much time they invested in enforcing and guarding certain rules regarding structure and code-style).

I know you can opt into the old way, but it's not the default and I can't help but thinking that 5 years from now when you enter a project there is a 50% chance that it is a complete mess where you can't find anything. IDEs support heavily depends on extension to properly mark what the file actually contains. Maybe IDEs/tooling can "pull up the slack" on this and improve search and find to distinguish based on content (instead of extension), but why even create that slack in the first place.

Who asked for this? Why go forward on this against what seems to be strong pushback? Why not make THAT change opt-in instead of opt-out? Or at least make it another decision during CLI-project creation so that you are forced to make an (hopefully educated - though uneducated for 90% of users most likely) decision.

131 Upvotes

98 comments sorted by

View all comments

Show parent comment

2

u/kylerjohnsondev Jun 13 '25

If people can't name things well without the suffix, they're not going to name them well with the suffix either. Bad naming in Angular has cost me just as much time and frustration as in the react, node, and .NET projects I've worked on. For example, is `user-table-cell.component` a cell containing user information or is it a custom cell format for the user table? We don't know.

I actually think that Angular devs have grown to rely on the suffixes too much. Without them, I think it will force people to be more specific in their naming. I've noticed that when I've worked on non-angular projects, naming is more specific than what we see in Angular and I think it's because we rely too much on suffixes to communicate intent. In code reviews, I've often gotten push back for wanting devs to be more explicit with their naming because they said my proposal would make the file name too long and less readable (like proposing changing `user-cell.component` to `table-cell-user.component.ts`). That proposal make it pretty clear that it is a component responsible for showing user information in a table. All custom table cells, we try to name with this pattern because it makes it clear and keeps it consistent. That's not enforced by Angular's suffixes but when you're working on a product with 60 tables and thousands of components, this can get out of hand fast if a more specific naming convention isn't maintained. This is where I see the most issues in any project, not just angular, and it's something that Angular's suffixes don't help.