Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

257
Views
UML and Code Relationship

I understand that the main goal of UML is to communicate. UML intends to provide a design of a system and Code really is the actual building block of the system.

My question is if code an uml are suppose to directly mirror each other. Let me explain:

  • I am working on a java program that uses a web service to display movie show times.
  • So far I have managed to make simple gui with AWT and Swing that displays show times.
  • The program has 16 classes and a friend of mine extended my code on a git however he added the following to all the classes.

package ShowTimesFrUSA;

I wanted to present my program with designs of UML with a package Diagram. However I already divided my classes into different packages differently from the way it is coded. Packages:UI (AWT and Swing) , Controllers, Moviemonitor, MovieService, USAmovies <<server>>

I just want to show the dependencies between the class groups in my code as part of the requirements for this presentation and the package diagram is really good for that. But I am unsure if the packages in the model should directly mirror the way packages are coded in java?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I am unsure if the packages in the model should directly mirror the way packages are coded in java?

Definitely yes. That's what UML packages are meant to represent. How would you think of code that is one huge "god object" class but the author models it as several distinct classes in UML?

If you divide your code into packages conceptually, why would you not want that to be reflected in the code using a mechanism intended for that purpose?

Besides, it sounds like you're currently not using a package statement at all, i.e. your code lives in the nameless default package. That's a bad practice for all but throwaway toy code because it causes several problems. For one thing, it's impossible to use your code from other code that does use packages.

I think the underlying problem may be that you are misunderstanding UML packages. They are not really meant as an abstract marker to show that a class is e.g. a UI class or a Controller. That is what UML stereotypes are for.

over 4 years ago · Santiago Trujillo Report

0

When you start thinking about a solution to your problem, and draw a class diagram to communicate, you are indeed designing the classes you will need in your program at the business logic level. At this level, UML and code should be in sync. Of course, the code will have more information, such as complete implemented methods. At the UI code level, usually UML classes do not help or communicate much.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!