UML class diagram for simple web portal [closed] - uml

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to ask you about my class diagram. I'm making a class diagram for simple web portal for my weekend university studies. Is it made correctly? What would you change if I you were mine? Use cases you can find here Class diagram from use case diagram.
Should I create each user class separately? I mean Admin class, Redactor class, Moderator class etc. I've used privileges field (see User class) to simulate each user's role. Is it correct?
I imagine that ContentManager class holds User class instance and it is used inside Article, Announcement, Advertisement and Comment class to check whether these action is allowed.
I would be very glad for your answers. Here you can find XML file for WhiteStarUML program my XML file

What you should do is create an analysis model of your domain. That model would contain classes like Article, Announcement, etc., as you have in your current diagram. For an example, please refer to another answer I recently posted to someone else's question. The diagram for that answer is shown again here for your convenience:
Notice how the model I provided in that answer has nothing like a UserManager or a ContentManager that just contains code to manipulate other classes. You don't want those, unless people actually play those roles. Notice how it has verb phrases and multiplicities at the ends of every association to tell you why things are related. Notice how there are no mundane CRUD operations on those classes, like create, update, and delete.
Once you have an analysis model in place, then you should allocate actions to the appropriate classes, which will usually mirror your use cases. For example, your Comment class might have an edit() operation. But it might not. You might consider having an operation called replaceComment() in the Article class (if that's how your domain works). I don't know how your domain should work because you are missing an analysis model that teaches it to me!
After you complete an analysis model, then I would make a design model that augments it with solution-domain concerns, such as logging a user into the system. Here is an answer to another question that you may find helpful for moving from analysis to design.

Related

How to model a simple Workout app (Class diagram) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I've developed a simple Workout Android app without uml class diagram in mind. Now I want to refactor it.
How the app works
On the home screen, there's just a button to start an workout session. By clicking on it, a countdown of 10 seconds is fired, waiting for the person to get ready.
Then, the app will display several exercises, one at a time, with a break interval between them. Each exercise takes 30 seconds; and each break interval, 10 seconds. On each exercise/break, the app shows the following information:
A countdown timer of the current exercise/break;
The name of the current exercise or, in the case of a break interval, the name of the next exercise;
An image that illustrates the current (or the next) exercise;
A pause button.
Finally, when the workout session finishes, the app shows a GIF as a celebration. On this last screen there's also a "Go home" button.
The UML class diagram
I've made the following UML class diagram to model this app:
My doubts
However, I'm not so sure if this is the proper way to model the scenario described. I'd appreciate if I could get some feedback/review about it.
One of the main things that I'm in doubt of has to deal with the WorkoutActivity class. It has no attributes in the diagram because I couldn't think of any attribute for it in the way that I'm modeling this problem. And because it's empty, it's a little weird to me. I thought about using a list class (e.g. ExercisesList) to model the set of exercises, but I'm kind of stuck with this diagram.
Another issue is about the buttons, should I include them in the diagram?
It all depends on what you want to represent.
If your model is meant for the domain of workouts, keep it simple: the buttons (the user interface objects) and the timer (execution context) would not be needed.
In the narrative you mentioned a "workout session". I assume that this is what the WorkoutActivity is about. So better be consistent with the naming.
You can think easily of attributes: it’s the date and time (and user account?) of the session: this could allow the user to follow his/her regularity in the training.
A more general approach would be to have a WorkoutSession composed of several abstract WorkoutActivity (caution: different meaning than in your current diagram). Each WorkoutActivity would be a specialisation: either an Exercise, a BreakInterval or a InfoActivity (e.g. FinalActivity, but why not also a StartActivity activity to encourage new users, and other occasional activities such as tips&tricks, or advertisement). Something like:
The constraint of having one break after each exercise does not need to be structural: it can be a constraint that you enforce when the session is composed or generated. This gives you more flexibility, if in the future you’d line to have a break every 2 or 3 exercises (e.g.:advanced users).

Designing Domain model [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have scenerio like librarian searches for the phone in the computer directory, selects student id and retreives the student record. After that she updates and saves the record. How could I draw the domain model for it.
The objects would be:
1) Librarian
2) Computer Directory
3) Student Record
What else? How would I represent all the associations?
A domain model represents actual business logic ignoring any system behind. For instance while you might have a directory (or register) of students, it didn't matter if it's a computer system or data written on small sheets of paper.
A common method to start creating the domain is to underline all nouns in the written down description of business. They are potential names for your classes and attributes. Similarly verbs will be your potential names for associations and operations.
Next step is to decide what is the role of each underlined object and logic between them. Based on that you define your classes and their attributes. Note that sometimes the name will not be exactly the same as the one initially written down. In your example you should use register of students rather than computer directory. Also some names might not be needed at all or you might discover something that is missing in writing, but you can guess that from logic.
Note that even though it's not explicitly listed, you have a student in your business environment (linked to a Student Record, association might be named represents). Also you can clearly see that Student Record is a part of Register of Students (it'll pose a composite aggregation that might be discouraged at system level but definitely can be used on such business level) finally Student Record should have attributes id and phone.

How to depict the "include" & "extend" link between use cases in sequence and activity diagrams [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have a problem in "include" & "extend" relation between my principal use cases.
I`m using IBM Rational harmony-SE in IBM rhapsody tools. The issue is, how to depict the link between them self, in activity or in sequence diagrams?
In rhapsody, when you want to create a sequence diagram of a use cases, you can use Harmony Toolkit that draws automatically do that, but in a generated Sequence diagram, Harmony Toolkit doesn't consider the "include" and "extend" relation between use cases.
How can I solve this?
Disclaimer
There is no definite answer to this question. This is only one of possibilities, however fully conforming UML and working quite well. Moreover it doesn't provide redundancy in models (each UC flow is defined at most once and the included/extending ones are the only referenced).
Activity diagram
On UC Activity Diagram use Action that is a call to included/extending UC Activity (as part of your flow). Depending if it's includes or extends the action will either have to happen for includes (i.e. it'll be on a flow that is always executed or on all alternative flows) or will be possible to use either a flow containing it or not for extends (i.e. it will be on only some but not all of alternative flows).
Sequence diagram
On UC Sequence Diagram use Interaction Use block (ref), referencing the included/extending UC Sequence Diagram. Like for Activity Diagram it will either have to happen for includes or be on only some of Combined Fragment sections allowing to pass the whole sequence either including or omitting the referenced part for extends.
Note about automated generation
I don't think there is any diagram generation tool that will automatically support inclusion/extension on Activity Diagram or Sequence Diagram of a UC and there are many reasons for that. You'll have to draw diagrams yourself or correct the automatically generated ones accordingly.

How are Boundary, Entity and Control classes defined? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm referencing a book by bennet, s et al (2002). Object-orientated systems analysis and design 2nd ed. McgraawHill:Maidenhead.
In the book when describing requirements analysis Bennet refers to three types of 'analysis class stereotypes' as a way of breaking down use case diagrams into defined classes.
The first two seem fairly straight forward : an boundary class is the terminus between the user and the system, or the system and other systems that it relies on. An entity class is the 'information and associated behaviour of some phenomenon or concepts such as an individual, a real life object, or a real life event' i.e. the data that you're trying to model or store, such as a person.
Finally, there are control classes which 'represent co-ordination sequencing, transactions and control of other objects'. This definition isn't as clear as Bennet states:
"meanwhile, the boundary class represents interaction with the user and the entity clases
represent the behaviour of things in the application domain and storage of information that
is directly associated with these things"
This rather begs the question what exactly is an application or software domain in this context? How does the control class fit in with these other two definitions?
I think this offers a best case solution :
http://epf.eclipse.org/wikis/openuppt/openup%5Fbasic/guidances/concepts/entity%5Fcontrol%5Fboundary%5Fpattern,%5FuF-QYEAhEdq%5FUJTvM1DM2Q.html
Entity objects represent the persistent information tracked by the system.
Boundary objects represent the interactions between the actors and the system.
Control objects are in charge of realizing use cases.
Modeling the system with entity, boundary, and control objects provides developers with simple heuristics to distinguish different, but related concepts.

Help understanding the Single Responsibility Principle [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to understand what a responsibility actually is so I want to use an example of something I'm currently working on. I have a app that imports product information from one system to another system. The user of the apps gets to choose various settings for which product fields in one system that want to use in the other system.
So I have a class, say ProductImporter and it's responsibility is to import products. This class is large, probably too large.
The methods in this class are complex and would be for example, getDescription. This method doesn't simply grab a description from the other system but sets a product description based on various settings set by the user. If I were to add a setting and a new way to get a description, this class could change.
So, is that two responsibilities? Is there one that imports products and one that gets a description. It would seem this way, almost every method I have would be in it's own class and that seems like overkill.
I really need a good description of this principle because it's hard for me to completely understand. I don't want needless complexity.
The 'responsibility' is defined in this principle as a reason to change. In this case the single responsibility of your class would be to import products. If the way of importing product changes, then the class should change.
The intention is to avoid having different things changing the same class at the same time. For example if your product importer class also defined its output format, it would then have two responsibilities, as likely the output format is totally unrelated to the mechanism of importing the data.
Now, that the class is huge and that getDescription() also sets a description are not a direct violation of the SRP, but of different principles. Namely, that you should avoid having huge classes (shows a lack of design) and each method should do a single thing (which would be kind of a more concrete version of the SRP.)

Resources