I would like your guidance on how to create classes and their relationships (generalization, association, aggregation and composition) accurately from my USE case diagram (please see below).
I am trying to create this class diagram so I can use it to create a simple online PHP application that allows the user to register an account, login and logout, and store, search and retrieve data from a MySQL database.
Are my classes correct? Or should I create more classes? And if so, what classes are missing? What relationships should I use when connecting the register, login, logout, search_database and add_to_database to the users?
I'm new to design patterns and UML class diagrams but from my understanding, the association relationship relates one object with another object; the aggregation relationship is a special kind of association that allows "a part" to belong to more than one "whole" (e.g. a credit card and its PIN - the PIN class can also be used in a debit card class); and a composition relationship is a special form of aggregation that allows each part to belong to only one whole at a time.
I feel like I have left out some classes or something because I just can't seem to find the relationships from my understanding of relationships.
Any assistance will be really appreciated. Thanks in advance.
USE CASE DIAGRAM
USE case explanation:
Register Any users can create an account by registering. The system will validate the user name and password and will reject them if either they are missing or if the user name is already taken.
Login Any users can login only if they have already registered. Their user name and password will be validated in the same manner as when registering an account.
Search Database Any users will beable to input a searchkey of datatype string and the system will open the database, search for the searchkey, and return true or false depending on whether or not the searchkey was found, and close the database.
Add data to database All users will be able to input some data, the system will open the database, store the data, return true or false depending on whether or not the data was stored, and close the database.
Logout The user will press the logout button, and the system will logout the user
Delete from database Only the administrator can delete data from the database.
Delete regular users Only the administrator can delete a regular user
CLASS DIAGRAM
The class diagram in UML is often generated from the use case diagram of a system through a use-case driven process.
Use cases are represented with a labeled oval shape. Stick figures represent actors in the process, and the actor's participation in the system is modeled with a line between the actor and use case.
What can be specified with use case diagrams and class diagrams? Use case diagrams to Specify the behavior (what system will do?) Class diagrams to Specify the internal structure that will help to complete a functionality mentioned in use cases.
First, if you're determined to go down a modeling path, then I'd recommend a book by Rosenberg and Stephens, Use Case Driven Object Modeling with UML. This goes through a process exactly what you're describing: how to write good use cases, build class diagrams from them, build sequence diagrams from that, and (ta-da!) code it up into working software. You might be able to Google for the ICONIX process and find details online.
Some casual comments:
Add_data_to_database
, Logout
, ...) are classes instead of methods.
User
's and those data classes.It seems that there's no problem with the UC diagram.
I agree with the comment from Dave. Beside, i also want to show you my idea to make corresponding class diagram for such a UC diagram. (Just the main point shown.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With