Lets say we have a backend server maybe a database or whatever. When generating the use cases for that server who would be considered as the actor? System(front-end) or the user(user interacts only via the front-end with our server) ?
When generating the use cases for that server who would be considered as the actor?
Your question defines the backend server as System under Discussion (SuD). Anything which interacts with SuD is an actor, so the direct answer is "System(front-end)".
But be aware of common pitfalls:
- It is essential to write user goal level scenarios first and only from them unfold to the lower level. "Front-end or user" is somewhat false dilemma, each of them can be
- Consider situation when today validation is done in JS front-end, tomorrow in the back-end and the next day handled by DB constraints. Such changes would immediately invalidate many use cases if back-end is an actor. This is why most of the time you should be very cautious about introducing system components as actors. Instead write subfunction scenarios where system as the only actor does all the complicated validations and operations step by step and level by level.
- Scenarios with back-end as an actor are guaranteed not to be read by business users. So you would have to describe all the behaviour twice, in those scenarios for IT folks and somewhere else for business. Which brings all sorts of troubles like additional work and reconciliation.
At the core of a Use Case diagram you should think of it in terms of the Subject that you want to describe. The Subject is defined as:
A subject is a classifier (including subsystem, component, or even class) representing a business, software system, physical system or device under analysis, design, or consideration, having some behavior, and to which a set of use cases applies.
The Subject demonstrates various Actions performed by the Subject. The Subject is interacted with by the Actors. The Actor is defined as:
A role played by an external entity that interacts with the subject (e.g., by exchanging signals and data), a human user of the designed system, some other system or hardware using services of the subject.
Your database server sounds like the important Subject at play, so there is no rules that say you should use a Front End software component or the end user as the Actor in your diagram. It is completely dependent on how you feel the use case should be communicated.
With that being said, it is up to you to decide if this Use Case would have any real value or not or if it is too granular. Clearly the Database is interesting as a Subject as it is a proper software component, however not every interaction made by a component has an interesting actor that you may want to advertise.
You can use Use Case diagrams for high or low level description, though I sometimes find that Use Case diagrams are more interesting at the high level with Business Actors and inter system communications can better be described with something like a Component Diagram.