- 1: All external online API's should be wrapped into our own services.
- This provides a general guideline for developers when they make calls to a said service
- We avoid issues if a service changes their api somewhere, as tests would fail.
- 2: Services should have 100% static methods.
- API State should be maintained only on the external side of things.
- This avoids use of any global state making things more predictable and reproducable.
- 3: Any Calls to API should be mapped/wrapped to methods
- Reduces copy-paste of the same api calls.
- Fields¶ms can be mapped to properties just as easily as they are with an api call.
- Private methods can be used in a service to wrap things (in javascript, its an underscore)
- Forces decoupling and smaller functions by moving complex queries to their own functions
- 4: Services should be tested
- Make sure all service methods return valid data given tested keys.
- Also maintains that each service is hooked up to a test environment.
- 5: Anything that impliments a Service should be tested with a MockService
- Makes things much more reproduceable, state is static
- Faster, doesn't have to connect to an external db
- Better for the environment, uses less electricty
Created
February 5, 2018 18:44
-
-
Save hellsan631/fe9d449d9a662a0f5d715dd8e89b617c to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment