When developing domain models, I can see two major ways of thinking about the user:
The first one assumes that a program is a kind of "simulation" of what happens in the real world, and the user is an spectator. With that approach you would have a Customer class -for example- with perhaps methods that correspond to the actions a Customer can perform. Whenever the customer wants to do something, the corresponding method is called.
The other approach would be to design the classes as if they were exposed to the user and s/he then has the ability to create and play with the objects "directly", thinking of the program as a kind of extension of the user’s reality. With this approach, a Customer class would probably make no sense as the customer is already "involved".
I've read some articles talking about adding security at the method level, which seems to be consistent with the second approach, but I believe the first approach is far more popular.
What's the best way to deal with this?
Thanks.
1 Answer 1
Two things pop out at me from this question:
the application metaphor (simulation vs API sandbox) has nothing to do with the domain model; until you understand the domain model better that decision should be deferred
You'll probably find that your domain model has more than one way of considering the User.
- Security sees users as a potential threat ;)
- Data-Processing transactions may see users as Customers and/or Accounts
- Configuration/preferences elements may see users as owners of Profiles or Preferences
- feature-control elements may see users as members of permission groups
- and so on
-
Thanks, very interesting. What criteria do you use to select the application metaphor? In regards to (2): in my experience if you "split" the user into what you really "have" in real life (accounts, profiles, identities, etc.), this multidimensionality disappears.user3013752– user30137522013年11月21日 22:57:51 +00:00Commented Nov 21, 2013 at 22:57
-
the application metaphor evolves from the user interaction modes, which is part of the user experience analysis and UI design; can't get that from just the domain model. deciding on the app metaphor prematurely is likely to skew your interpretation of what the users are telling you (confirmation bias will creep in). I suggest letting go of the app metaphor until the domain is understood. If you just can't, then extract the minimum viable product elements (the simplest or most unique things to be done) and prototype them (on paper, mockups, software, etc) and put them in front of the usersSteven A. Lowe– Steven A. Lowe2013年11月22日 01:13:55 +00:00Commented Nov 22, 2013 at 1:13
-
I'm sorry, but I'm still confused. The question was: do we design the API (of the domain model library) assuming that the user is the one using the objects and calling the methods, or that a "superior force" uses the models to simulate events occurring in real life? As I see it, assuming either of these positions would have an impact on the design. Do you agree with this? Understanding the domain doesn't really help me decide for one or the other approach. Do you think that the decision is application-dependent? If so, exactly how do you determine which path to take? Thanks again!user3013752– user30137522013年11月22日 15:50:52 +00:00Commented Nov 22, 2013 at 15:50
-
@user3013752: It's difficult to offer precise advice without more knowledge of the domain. At this point - and with extremely limited knowledge of what you're trying to do - I suspect that the two choices are functionally equivalent, and the distinction largely irrelevant. But perhaps I don't fully understand the question. If this is still an issue (I just saw your response today) please feel free to email me and I'll help if I can.Steven A. Lowe– Steven A. Lowe2013年11月29日 05:31:43 +00:00Commented Nov 29, 2013 at 5:31
Explore related questions
See similar questions with these tags.
Customer
class instead be represented as aProfile
. As is with your example, the user/customer can view and manipulate their profile. It's not clear what you're trying to "deal with" though.