简体   繁体   中英

UML and analysis

I understand UML but it seems I have trouble doing some basic analysis. Here is an example of a project:

The aim is to design a page or facebook application where registered users can buy another user to own them and modify their status message.

Each user starts off with a 1000 points and can buy another user for 500 points. This prevents other users buying a user for a half hour. After the transaction is complete, the buyer gets 200 points and the bought user gets 200 points. Each time a 100 points are spent 20 points are earned. Each time a user is bought their value increases by 200. 300 points are given each day.

A member can find other members through a search function or list.

An administrator can see user information, get information about the game and give bonus points.

I can spot the Use Case Actors User and Administrator . The Use Cases would be Search , Buy , Modify (for a User) and View user information , View game information , Give bonus points (for an Administrator). I'm stuck when it comes to sequence diagrams, determining what classes are needed and operations though.

What advice or what approach can you give to get started with this example? I've tried reading a few books on the subject but I'm confused.

No sense doing a sequence diagram until you have some classes.

You sound like you're too hung up on the notation. Worry more about your problem. UML is nothing more than a standard notation for capturing your ideas about how to describe an object-oriented software system. It's the ideas that matter, not the notation.

Worry more about getting a good object representation of the problem you're trying to solve. The problem needs to be first and foremost. If you get "what does my system need to do?" right, no one will ask you who the actors were in your use case diagrams.

Yes, it looks like you have User and Admin as two actors. I see operations like "search for users" and "add game points". (Is there a "play game" hiding in there somewhere?)

If it's an option, you might look into using SysML instead of UML. SysML was designed for systems analysis / design and as a consequence does not have all the modelling elements to represent fine detail that UML has. But it does have Requirements (which UML does not), and of course Use Cases, Activities, etc.

More importantly, however, I don't think you can arrive at a class design from a set of use cases. Or you can, but it will most likely be bad.

This is because a design is not a refinement of an analysis, it is a qualitatively different thing: the analysis is input into the design (ie, what should the system do?), but no use case model will tell you what error reporting strategy your code should employ. Or in your case, the number one design driver isn't actually a use case at all, but the fact that you will be implementing this on the Facebook API.

So the best advice I can give is not to worry about the design when you are doing the analysis. Forget about the classes and decide what the system should do, not how it should be implemented.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM