In my case, I find it very useful to have a second line of public methods.
Imagine something like reacting to an article. I'd have:
A basic react_to_article(user, article, reaction) that does exactly that, provided the user and article exist.
An http_react_to_article(auth_token, article, reaction) that takes care of token-based authentication before calling the first one.
A cli_react_to_article(ssh_key, article, reaction) that uses public SSH key as an authentication method.
My point is, some things are related to the communications protocol and some others are pure app behavior, and having the latter isolated allows you to:
Have an admin panel with a completely different approach to permissions (based on the role at the company for instance).
Have development tools that create features relying on a public API (that shouldn't change).
Those are my 2 cents on this.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article!
In my case, I find it very useful to have a second line of public methods.
Imagine something like reacting to an article. I'd have:
react_to_article(user, article, reaction)
that does exactly that, provided the user and article exist.http_react_to_article(auth_token, article, reaction)
that takes care of token-based authentication before calling the first one.cli_react_to_article(ssh_key, article, reaction)
that uses public SSH key as an authentication method.My point is, some things are related to the communications protocol and some others are pure app behavior, and having the latter isolated allows you to:
Those are my 2 cents on this.