Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:35:38+00:00 2026-06-12T17:35:38+00:00

My group and I are making a program, where we have a tree structure.

  • 0

My group and I are making a program, where we have a tree structure. In this tree structure we have made it such that a category can contain it self. The program is based on your expenses, so an example could be:

You have bought 4 milk. The 4 items of milk are placed in the category “Milk”. Each entry of milk has the price (along with other individual information) in another class which category aggregates.

The trick is that we want the category class to be able to contain it self, so:

The category “milk” is part of the category “Dairy Products”, which in terms are part of the category “Groceries”.

The reason we want it to be like that, is so we can move batches of products at the time. So if you want to move Milk to a category called “Morning Stuff” you wouldn’t have to move every single one, but instead just the entire category.

The picture is how our current category class is modelled, but we were told we couldn’t do it without much further explanation. Does UML allow this? If not, how can we model it with UML?

Category UML part

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:35:40+00:00Added an answer on June 12, 2026 at 5:35 pm

    Yes, UML allows associations from a class to itself. Likewise aggregations and even compositions are allowed this way.

    The image you posted shows an aggregation while from your description I would have chosen a composition (filled diamond): a category has one or no parent; a category is somewhat defined by its children; if a category gets deleted all children are deleted as well.

    A longer comparison between aggregation and composition can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a settings screen at the moment that will have a radiobutton group
I have a query that is making use of GROUP BY so that the
Im making a group table that is populated from an XML/RSS feed, ive managed
Making my way through the GAE documents. I have a question I can't find
I am making a website where users can vote on which category a page
I'm making a website for a organization that also has a facebook group, and
How can i fetch data with group page alias ? Take for example this
Our group is somewhat new to JVM based development. We are developing applications that
Making a simple program which will generate a multiple choice form. I have an
In a program I am making that generates anagrams for a given set of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.