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
QtWS25 Last Chance

Find relationships in uml class diagram

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 4.8k Views
  • 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.
  • M Offline
    M Offline
    mark_ua_1999
    wrote on 2 Dec 2017, 11:42 last edited by A Former User 12 Feb 2017, 14:37
    #1

    Hi I m trying to find relationship between classes in my program , I am not sure enough that i am right, do you have any ideas what relationships should be between the classes, thanks.

    0_1512214862466_Capture1.PNG

    0_1512214875486_Capture2.PNG

    0_1512215081209_Capture4.PNG

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 2 Dec 2017, 12:10 last edited by mrjj 12 Feb 2017, 12:11
      #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 2 Dec 2017, 12:23
      0
      • M mrjj
        2 Dec 2017, 12:10

        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 2 Dec 2017, 12:23 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

        M 1 Reply Last reply 2 Dec 2017, 12:29
        0
        • M mark_ua_1999
          2 Dec 2017, 12:23

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

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 2 Dec 2017, 12:29 last edited by mrjj 12 Feb 2017, 12:34
          #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 2 Dec 2017, 12:50
          1
          • M mrjj
            2 Dec 2017, 12:29

            @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 2 Dec 2017, 12:50 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) )

            M 1 Reply Last reply 2 Dec 2017, 13:16
            0
            • M mark_ua_1999
              2 Dec 2017, 12:50

              @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) )

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 2 Dec 2017, 13:16 last edited by mrjj 12 Feb 2017, 13:19
              #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 2 Dec 2017, 13:47
              0
              • M mrjj
                2 Dec 2017, 13:16

                @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 2 Dec 2017, 13:47 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?

                M 1 Reply Last reply 2 Dec 2017, 14:02
                0
                • M mark_ua_1999
                  2 Dec 2017, 13:47

                  @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?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 2 Dec 2017, 14:02 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 2 Dec 2017, 14:24
                  0
                  • M mrjj
                    2 Dec 2017, 14:02

                    @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 2 Dec 2017, 14:24 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?

                    M 1 Reply Last reply 2 Dec 2017, 14:35
                    0
                    • M mark_ua_1999
                      2 Dec 2017, 14:24

                      @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?

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 2 Dec 2017, 14:35 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 13 Aug 2019, 16:55 last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        1
                        • M Offline
                          M Offline
                          Mereteran
                          Banned
                          wrote on 13 Aug 2019, 17:03 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