5

I am creating use cases for my web application and I was wondering if a representation of the DB should be listed as an actor. For example a user can check his profile and edit it (assuming that he is logged in). The two use cases would be:
- User can view his profile
- User can edit his profile

Would the use cases then be for example:
Actor: User, DB
Use case: View profile

Or can I leave out the DB as an actor? Unfortunately I haven't found any consistent way of drawing the use cases.

Walter
  • 16,158
  • 8
  • 58
  • 95
Bas
  • 255
  • 1
  • 2
  • 7

3 Answers3

13

I would say if the DB is internal to your app (i.e. it is used solely by this app and the external world doesn't interact with it directly in anyway, only via your app), you shouldn't represent it as a separate actor.

If the DB is shared and used directly by external users/systems, it is probably better to represent it as a separate actor.

Péter Török
  • 46,427
  • 16
  • 160
  • 185
  • Fully agree with this answer. The database can either be an irrelevant implementation details *or* an explicit "user interface" inside your application. The later is very frequent. – Laurent Bourgault-Roy Jul 15 '13 at 01:16
  • Fully agree. Computer systems can be actors, a simple example is shopping purchase by card, which involves the following actors: a customer, a merchant, and a payment agent (computer system). Anthropomorphizing is not a problem. – Maciej Skorski Mar 25 '23 at 05:59
5

When You define Your use cases, You need to think about behavior of Your actors instead of structure.

Database is static reflection of actor. If we use anthropomorphizing, calling database an actor is like calling photography or memories of beloved one as real human.

Arnis Lapsa
  • 866
  • 5
  • 11
4

According to my point of view I think Use Cases are drawn largely to depict the Interaction between System and External Environment.

Hence, DB is an internal entity comparing to the system, so it's not worthwhile to draw DB as an actor unless it's an external entity. At the same time, it should be mentioned that though it's an external body, accessing it directly can raise security issues, right!

Therefore, unless you have a very special reason for doing it like that, it's not wise to depict DB as an actor in Use Cases. Of course you can do that in Sequence Diagrams: there's no such issue, since it shows the interaction between actors and objects.

gnat
  • 21,442
  • 29
  • 112
  • 288
Wageesha
  • 123
  • 1
  • 1
  • 8
  • Please don't use text speak in your answers. And I would encourage you to review the value of having an Actor within a use case. Your answer misses some of the fundamental points of what use cases are to provide. –  Jul 15 '13 at 00:53
  • I don't think so...can anyone point out some?? – Wageesha Jul 17 '13 at 12:29