rudeus123
rudeus123

Reputation: 47

Incoherence in my MVC UML diagram for java app

I am making an app in java. I decided to go with an MVC architecture.

My app has a login page. The database is accessed with JDBC. The app has a graphical user interface (gui) that I will do with netbeans gui builder and swing.

The user uses the GUI, the GUI sends the form to the controller, the controller contacts the database, the database responds, the controller relay to the gui etc.

So far my uml diagram looks like this :

current MVC diagram

My friend told me, that there is inconsistency in my diagram because the database is external to the architecture. Plus my controller is too vague. And it is better to put the button_handler in the view. If I do that, what shall I put in my model ? And how to be more precise about the controller to make it easier to implement in JAVA ?

Upvotes: 2

Views: 428

Answers (1)

Christophe
Christophe

Reputation: 73490

The diagram is indeed inconsistent, confusing and incorret:

  • is inconsistent because it uses packages to group several classes, but tries to show a kind of relation that UML does not support between packages.

  • is confusing, because it shows in one diagram elements that correspond to very different views: on one side classes, which are typical of a class diagram, and on the other side processing nodes (DB) that you'd normally expect in a deployment diagram.

  • it is wrong, because your <<login>> package is made out of information that are not relevant for UML.

But I think your friend is right for the wrong reasons. You could very well show a DB in your model (provided you did it correctly), even if it is an independent interchangeable component and even if you don't develop it yourself. Your system, your boundaries!

Now, to get your diagram right, you need to decide what you want to show:

  • If it is about classes, use a simple class diagram. If you show a package, be careful to keep the associations between the classes. You could even have a class that represents a DB connection as proxy for the DB.
  • If you want to show the high-level components you could go for a component diagram.
  • But if you want to show an overview on components with a zoom on what's in, you could give the composite structure a trial.

Upvotes: 1

Related Questions