Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Naming conventions discussion #29

Open
bounav opened this issue Aug 5, 2020 · 0 comments
Open

Naming conventions discussion #29

bounav opened this issue Aug 5, 2020 · 0 comments

Comments

@bounav
Copy link

bounav commented Aug 5, 2020

Hello,

Nice to see some activity in this project.

I'd be curious to see what the community thinks of the naming convention used to name methods the new version of the API.

IMHO it's not necessary to reflect in the method name the underlying HTTP verb and parameters.

For example:

  • The ItemsIdPut could be simply named UpdateItem(int id) reading the code it's obvious the method takes the ID, and the underlying PUT verb is an implementation detail as far consuming the API goes?
  • The same logic would apply to all the other methods:
    • CategoriesCategoryIdGet should be GetGategory(int id) (here Get would happen to match the HTTP verb but that would be a coincidence.
    • ItemsPost() would become CreateItem(Item item)
    • ...

Better yet, the API could be broken down into services per kind of entity retrieved. E.g. you'd have an you'd instanciate an ItemService, a CategoryService and each would have a set of Get, Update and Create methods...?

As an aside, if the current naming convention is deemed the better one, the GetToken method doesn't follow it.

Looking forward to read people's opinions.

@bounav bounav changed the title Strange naming conventions? Naming conventions discussion Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant