Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Find relationships in uml class diagram
Forum Updated to NodeBB v4.3 + New Features

Find relationships in uml class diagram

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #2

    Hi
    That was a new type of Question :)

    Do you mean UML Association ?
    or what relationships are we talking about ?

    alt text

    Like when to use Association versus Aggregation ?

    https://www.uml-diagrams.org/association.html

    M 1 Reply Last reply
    0
    • mrjjM mrjj

      Hi
      That was a new type of Question :)

      Do you mean UML Association ?
      or what relationships are we talking about ?

      alt text

      Like when to use Association versus Aggregation ?

      https://www.uml-diagrams.org/association.html

      M Offline
      M Offline
      mark_ua_1999
      wrote on last edited by
      #3

      @mrjj All relationships that i made as Composition i tend to think could be association also so I have asked to know your opinion

      mrjjM 1 Reply Last reply
      0
      • M mark_ua_1999

        @mrjj All relationships that i made as Composition i tend to think could be association also so I have asked to know your opinion

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #4

        @mark_ua_1999
        Well Association is the most used but it depends on how they exists and how they are really connected.
        if we have A and B
        then if A just uses B , its Association
        if B is part of A it would be aggregation/composition.
        If B is a type of A, inheritance might be used

        https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/

        So for Train and an Passager
        A train transports passagers. Both the train and the passenger could exists without the other so
        that is more of an Association than aggregation.

        Also for trainstops
        A train is not really made up of train_stops so its not a aggregation as such.

        M 1 Reply Last reply
        1
        • mrjjM mrjj

          @mark_ua_1999
          Well Association is the most used but it depends on how they exists and how they are really connected.
          if we have A and B
          then if A just uses B , its Association
          if B is part of A it would be aggregation/composition.
          If B is a type of A, inheritance might be used

          https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/

          So for Train and an Passager
          A train transports passagers. Both the train and the passenger could exists without the other so
          that is more of an Association than aggregation.

          Also for trainstops
          A train is not really made up of train_stops so its not a aggregation as such.

          M Offline
          M Offline
          mark_ua_1999
          wrote on last edited by
          #5

          @mrjj ok and what about available_routes and arrival_city and passenger_train and available routes
          (such the question confuse me about uml class diagrams when I use vector of some others items in any class should I think like in real (if the items could not exist without their container it is composition
          but if could this is association ) (but when container class will be deleted programmly this items also will be deleted although it could be association) )

          mrjjM 1 Reply Last reply
          0
          • M mark_ua_1999

            @mrjj ok and what about available_routes and arrival_city and passenger_train and available routes
            (such the question confuse me about uml class diagrams when I use vector of some others items in any class should I think like in real (if the items could not exist without their container it is composition
            but if could this is association ) (but when container class will be deleted programmly this items also will be deleted although it could be association) )

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #6

            @mark_ua_1999
            Well most of the time UML diagrams tries to describe/model the reality and not the implementation.
            So even you use a vector and its then seems sort of aggregated into the owning class, the diagram should show
            the type of association from the real life.
            You then choose to implement it with a vector but that an implementation detail.

            The association typed used tells how strong the association is but the programmer might implemented
            in different ways depending on the need of the program.

            Example:
            We have a room class and a house class.
            We model the it as the house have 1 or more rooms and a room can be in exactly one house.
            as a Composition. As in the real world room does not exists without a house.
            But this is Sims6 and in the program we actually have a list of reusable rooms we can assign to houses
            so in the programs the house just have a list of rooms that points to a list with available rooms.
            So here the implementation, its actually implemented as a association/aggregation.

            So what to use depends on what type of Diagram you are trying to make.
            Does it describe the real life world or does it describe implementation details ?

            M 1 Reply Last reply
            0
            • mrjjM mrjj

              @mark_ua_1999
              Well most of the time UML diagrams tries to describe/model the reality and not the implementation.
              So even you use a vector and its then seems sort of aggregated into the owning class, the diagram should show
              the type of association from the real life.
              You then choose to implement it with a vector but that an implementation detail.

              The association typed used tells how strong the association is but the programmer might implemented
              in different ways depending on the need of the program.

              Example:
              We have a room class and a house class.
              We model the it as the house have 1 or more rooms and a room can be in exactly one house.
              as a Composition. As in the real world room does not exists without a house.
              But this is Sims6 and in the program we actually have a list of reusable rooms we can assign to houses
              so in the programs the house just have a list of rooms that points to a list with available rooms.
              So here the implementation, its actually implemented as a association/aggregation.

              So what to use depends on what type of Diagram you are trying to make.
              Does it describe the real life world or does it describe implementation details ?

              M Offline
              M Offline
              mark_ua_1999
              wrote on last edited by
              #7

              @mrjj So I tend to think that arrival_city and available_rotes has relationship composition although arrival_city could exist like city without depart city(from) in available_routes, but route itself could not exist without arrival city is it good idea?
              And should i think so(composition) about available_routes in passenger_train?

              mrjjM 1 Reply Last reply
              0
              • M mark_ua_1999

                @mrjj So I tend to think that arrival_city and available_rotes has relationship composition although arrival_city could exist like city without depart city(from) in available_routes, but route itself could not exist without arrival city is it good idea?
                And should i think so(composition) about available_routes in passenger_train?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @mark_ua_1999
                Well a route is made of arrival_cities and its a strong association since it would not really be a route if
                it has no cites and hence aggregation/composition seems very valid.

                For available_routes and passenger_train , one could say that a train can have/use/run on 1 or more
                of the available_routes and hence the association is not that strong so its more of an Association
                than an aggregation.

                Note that a composition is a strong version of an aggregation and hints that the composited
                object is very tied to the owning class and would not exits on its own.

                M 1 Reply Last reply
                0
                • mrjjM mrjj

                  @mark_ua_1999
                  Well a route is made of arrival_cities and its a strong association since it would not really be a route if
                  it has no cites and hence aggregation/composition seems very valid.

                  For available_routes and passenger_train , one could say that a train can have/use/run on 1 or more
                  of the available_routes and hence the association is not that strong so its more of an Association
                  than an aggregation.

                  Note that a composition is a strong version of an aggregation and hints that the composited
                  object is very tied to the owning class and would not exits on its own.

                  M Offline
                  M Offline
                  mark_ua_1999
                  wrote on last edited by
                  #9

                  @mrjj thaks if we destroyed the train the route become also invalid (i mean about all routes saved in vector that belong to one big route f.e Kyiv-Lviv-Warsaw-Berlin-Paris, Kyiv-Lviv-Warsaw-Berlin, Kyiv-Lviv-Warsaw, Kyiv-Lviv, Lviv-Warsaw-Berlin-Paris, Lviv-Warsaw-Berlin, Lviv-Warsaw, Warsaw-Berlin-Paris, Warsaw-Berlin, Berlin-Paris) My program doesnt create one route 2 times so could i think
                  that my route depend on whether the train exist so it is possible to be composition?

                  mrjjM 1 Reply Last reply
                  0
                  • M mark_ua_1999

                    @mrjj thaks if we destroyed the train the route become also invalid (i mean about all routes saved in vector that belong to one big route f.e Kyiv-Lviv-Warsaw-Berlin-Paris, Kyiv-Lviv-Warsaw-Berlin, Kyiv-Lviv-Warsaw, Kyiv-Lviv, Lviv-Warsaw-Berlin-Paris, Lviv-Warsaw-Berlin, Lviv-Warsaw, Warsaw-Berlin-Paris, Warsaw-Berlin, Berlin-Paris) My program doesnt create one route 2 times so could i think
                    that my route depend on whether the train exist so it is possible to be composition?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @mark_ua_1999
                    Yes then the actual implementation will use composition and its up to show what you want to show on the diagram.
                    A diagram can be a Design specification or Implementation specification and it sounds like you want to show
                    implementation details.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Convaallaria
                      Banned
                      wrote on last edited by
                      #11
                      This post is deleted!
                      1 Reply Last reply
                      1
                      • M Offline
                        M Offline
                        Mereteran
                        Banned
                        wrote on last edited by Mereteran
                        #12
                        This post is deleted!
                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved