Somewhere between API resources, queue workers, repositories, clients and serializers there is a class of … classes/modules that does the needful. Gun-to-my-head, I would call them “services” but I’m looking for a less overloaded term. Maybe capabilities? Controllers? Pick a term from the business domain? What do you call them?

  • d23dro@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    7 months ago

    I would call them “agents” at a class layer and encapsulate the logic specific to each domain in its own class. Completely arbitrary but in my mind: adapters - call other web services

    dao - database calls

    agent - responsible for stitching the pieces all together and doing the actual business logic.

    Example: OpenWeatherAdapter - call the OpenWeather API. No business logic. H2SelectDao - get user preferences from an internal database. No business logic.

    WeatherAgent(openWeatherAdapter, h2SelectDao) - All the business logic.

    Note: this is in context of a API service like a middleware.