Follow up from discussion about location of services here where we define most OFN services will end up in app/services (or within engine_name/app/services/. And we will have some folders like app/services/reports, etc.
I create this thread to clarify and get consensus about services naming and structure.
The current list of services we have is this:
We should decide how to name a service.
In 16 services, we have 6 different approaches here!!!
named service - pattern <resource.>_<actor.>
- examples: subscription_estimator, subscription_validator, order_syncer, line_item_syncer, order_factory
named action - pattern <action.>_<resource.>
- examples: create_mail_method, create_order_cycle, restart_checkout, search_orders
resource service - pattern <resource.>_service
- examples: cart_service, embedded_page_service
named action service - pattern <action.>_<resource.>_service - a mix of 2 and 3
- examples: reset_order_service
named action with resource first - pattern <resource.>_<action.> - a variation on 2 with resource name first and then action name
- examples: order_update_issues, subscriptions_count
resource - pattern <resource.> - like in option 1, no indication of action allows for more than one action
- examples: order_cycle_form, subscription_form
It’s a mess
I believe we can accept two of these but not more than 2. Let’s choose?
Additionally there is the question of what is the method name inside. We have some services where we use the method call(). We can 1. be flexible and allow both call() and something else, or 2. we can disallow call or 3. we can enforce call on most services.
I accept the (new for me) fact of only having single action services which means excluding options 1, 3 and 6 as long as we keep the resource name in the beginning of the file name (so different services/actions on the same resource stay together in the list), which means excluding 2 and 4. This is my logic to vote for one single option acceptable which is 5.
Re the method name, I don’t like the service.call() pattern… I am not sure what’s the best convention here.
What do you guys think?