Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Composition??

Composition??

Scheduled Pinned Locked Moved The Lounge
tutorialquestion
39 Posts 7 Posters 0 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.
  • G Germyan

    Can I have your best example, to illustrate this relation with respect to OOP concepts? No physical world example please.. I have seen people go very wrong, when they try to explain this.. G.

    E Offline
    E Offline
    Ennis Ray Lynch Jr
    wrote on last edited by
    #2

    http://en.wikipedia.org/wiki/Object_composition[^]

    Need a C# Consultant? I'm available.
    Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

    G N 2 Replies Last reply
    0
    • G Germyan

      Can I have your best example, to illustrate this relation with respect to OOP concepts? No physical world example please.. I have seen people go very wrong, when they try to explain this.. G.

      L Offline
      L Offline
      Liam OHagan
      wrote on last edited by
      #3

      What are you talking about?

      I have no blog...

      G 1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        http://en.wikipedia.org/wiki/Object_composition[^]

        Need a C# Consultant? I'm available.
        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

        G Offline
        G Offline
        Germyan
        wrote on last edited by
        #4

        So the Carburetor and Car is a software world example??.. I don't think so.. But, again can the Carburetor exist without the car? I think Yes, so then why you say it is Composition it is Aggregation, doesn't it????? I think that WIKI example is a poor one and your answer is also a poor one.. :) G.

        E L 2 Replies Last reply
        0
        • L Liam OHagan

          What are you talking about?

          I have no blog...

          G Offline
          G Offline
          Germyan
          wrote on last edited by
          #5

          Is this your answer.. don't shoot off target... the question is a simple one.. your answer and the one who gave a 5 for your reply, both can be considered given poor answers :) G.

          L 1 Reply Last reply
          0
          • G Germyan

            So the Carburetor and Car is a software world example??.. I don't think so.. But, again can the Carburetor exist without the car? I think Yes, so then why you say it is Composition it is Aggregation, doesn't it????? I think that WIKI example is a poor one and your answer is also a poor one.. :) G.

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #6

            The fact that you can decompose the objects does not invalidate the scenario.

            Need a C# Consultant? I'm available.
            Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

            G 1 Reply Last reply
            0
            • G Germyan

              Can I have your best example, to illustrate this relation with respect to OOP concepts? No physical world example please.. I have seen people go very wrong, when they try to explain this.. G.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #7

              class car { }; class red { }; class RedCar : public red, public car { };

              G N 2 Replies Last reply
              0
              • G Germyan

                Can I have your best example, to illustrate this relation with respect to OOP concepts? No physical world example please.. I have seen people go very wrong, when they try to explain this.. G.

                S Offline
                S Offline
                Shog9 0
                wrote on last edited by
                #8

                I need a collection type that will store objects. It will let me iterate through the objects it contains, access them by ordinal, or retrieve a subset of them matching a given attribute. I might compose this type from an array (iteration, ordinal lookup) and a tree (attribute lookup - match a branch).

                G 1 Reply Last reply
                0
                • L Lost User

                  class car { }; class red { }; class RedCar : public red, public car { };

                  G Offline
                  G Offline
                  Germyan
                  wrote on last edited by
                  #9

                  That is rather a good one than the one at wiki.. but the practicality of the class red is questionable.. I think there are better ones.. G.

                  L 1 Reply Last reply
                  0
                  • E Ennis Ray Lynch Jr

                    The fact that you can decompose the objects does not invalidate the scenario.

                    Need a C# Consultant? I'm available.
                    Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                    G Offline
                    G Offline
                    Germyan
                    wrote on last edited by
                    #10

                    It does.. That is why you have three different relations named association, aggregation and composition.. You can cover all by aggregation and composition can cover with aggregation but when you defined a composition, it is special and cannot be covered by any of the other two. Your or the one you pointed comes under aggregation not composition.. so you cannot argue any longer with your example.. :(

                    E 1 Reply Last reply
                    0
                    • S Shog9 0

                      I need a collection type that will store objects. It will let me iterate through the objects it contains, access them by ordinal, or retrieve a subset of them matching a given attribute. I might compose this type from an array (iteration, ordinal lookup) and a tree (attribute lookup - match a branch).

                      G Offline
                      G Offline
                      Germyan
                      wrote on last edited by
                      #11

                      yes, that is also a good one.. when objects are not existing you will not have the collection defined. But when you have one to many relation in between the collection and object it again comes under aggregation.. so it is also not composition.. Additional object can exist without a collection.. I think you are also wrong ... :( G.

                      S 1 Reply Last reply
                      0
                      • G Germyan

                        It does.. That is why you have three different relations named association, aggregation and composition.. You can cover all by aggregation and composition can cover with aggregation but when you defined a composition, it is special and cannot be covered by any of the other two. Your or the one you pointed comes under aggregation not composition.. so you cannot argue any longer with your example.. :(

                        E Offline
                        E Offline
                        Ennis Ray Lynch Jr
                        wrote on last edited by
                        #12

                        From the Agile Definition: Sometimes an object is made up of other objects. For example, an airplane is made up of a fuselage, wings, engines, landing gear, flaps, and so on. A delivery shipment contains one or more packages. A team consists of two or more employees. These are all examples of the concept of aggregation, which represents “is part of” relationships. An engine is part of a plane, a package is part of a shipment, and an employee is part of a team. Aggregation is a specialization of association, specifying a whole-part relationship between two objects. Composition is a stronger form of aggregation where the whole and parts have coincident lifetimes, and it is very common for the whole to manage the lifecycle of its parts. From a stylistic point of view, because aggregation and composition are both specializations of association the guidelines for associations apply. I don't see what the big deal is.

                        Need a C# Consultant? I'm available.
                        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                        G 1 Reply Last reply
                        0
                        • G Germyan

                          So the Carburetor and Car is a software world example??.. I don't think so.. But, again can the Carburetor exist without the car? I think Yes, so then why you say it is Composition it is Aggregation, doesn't it????? I think that WIKI example is a poor one and your answer is also a poor one.. :) G.

                          L Offline
                          L Offline
                          led mike
                          wrote on last edited by
                          #13

                          Germyan wrote:

                          So the Carburetor and Car is a software world example??.. I don't think so..

                          Is the Carburetor and Car the only example on that page??.. I don't think so.. But, again I don't expect you are someone that reads technical information efficiently.

                          Germyan wrote:

                          I think that WIKI example is a poor one and your answer is also a poor one..

                          I think your effort is a poor one, your reply is a poor one, and it's a fair assumption you are a poor one.

                          led mike

                          G 1 Reply Last reply
                          0
                          • G Germyan

                            yes, that is also a good one.. when objects are not existing you will not have the collection defined. But when you have one to many relation in between the collection and object it again comes under aggregation.. so it is also not composition.. Additional object can exist without a collection.. I think you are also wrong ... :( G.

                            S Offline
                            S Offline
                            Shog9 0
                            wrote on last edited by
                            #14

                            Wait - just what do you think aggregation is? And why do you think composition isn't aggregation? :suss:

                            G 1 Reply Last reply
                            0
                            • G Germyan

                              That is rather a good one than the one at wiki.. but the practicality of the class red is questionable.. I think there are better ones.. G.

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #15

                              Germyan wrote:

                              but the practicality of the class red is questionable.. I think there are better ones..

                              you just cant please some people

                              G 1 Reply Last reply
                              0
                              • E Ennis Ray Lynch Jr

                                From the Agile Definition: Sometimes an object is made up of other objects. For example, an airplane is made up of a fuselage, wings, engines, landing gear, flaps, and so on. A delivery shipment contains one or more packages. A team consists of two or more employees. These are all examples of the concept of aggregation, which represents “is part of” relationships. An engine is part of a plane, a package is part of a shipment, and an employee is part of a team. Aggregation is a specialization of association, specifying a whole-part relationship between two objects. Composition is a stronger form of aggregation where the whole and parts have coincident lifetimes, and it is very common for the whole to manage the lifecycle of its parts. From a stylistic point of view, because aggregation and composition are both specializations of association the guidelines for associations apply. I don't see what the big deal is.

                                Need a C# Consultant? I'm available.
                                Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                                G Offline
                                G Offline
                                Germyan
                                wrote on last edited by
                                #16

                                You can bring up definition, but as a software developer and a one who visit code-project regularly, show me a real place where you have ever used this.. I can bring you thousand of cut and paste definitions as well as physical world's examples.. but the question is something else..

                                Ennis Ray Lynch, Jr. wrote:

                                I don't see what the big deal is.

                                Then you stay out of this.. This is a challenge if you are ready to accept it accept, if not you can go away.. I am sorry if it is rude :rolleyes:

                                E 1 Reply Last reply
                                0
                                • G Germyan

                                  You can bring up definition, but as a software developer and a one who visit code-project regularly, show me a real place where you have ever used this.. I can bring you thousand of cut and paste definitions as well as physical world's examples.. but the question is something else..

                                  Ennis Ray Lynch, Jr. wrote:

                                  I don't see what the big deal is.

                                  Then you stay out of this.. This is a challenge if you are ready to accept it accept, if not you can go away.. I am sorry if it is rude :rolleyes:

                                  E Offline
                                  E Offline
                                  Ennis Ray Lynch Jr
                                  wrote on last edited by
                                  #17

                                  Poor communication is a challenge best left to those with weak minds.

                                  Need a C# Consultant? I'm available.
                                  Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                                  G 1 Reply Last reply
                                  0
                                  • L led mike

                                    Germyan wrote:

                                    So the Carburetor and Car is a software world example??.. I don't think so..

                                    Is the Carburetor and Car the only example on that page??.. I don't think so.. But, again I don't expect you are someone that reads technical information efficiently.

                                    Germyan wrote:

                                    I think that WIKI example is a poor one and your answer is also a poor one..

                                    I think your effort is a poor one, your reply is a poor one, and it's a fair assumption you are a poor one.

                                    led mike

                                    G Offline
                                    G Offline
                                    Germyan
                                    wrote on last edited by
                                    #18

                                    Come up with valid facts.. I like to hear you. :~ Anyway, I like, if you can stick with the OP, rather than shooting off target to cover your not knowingness. :( You don't have an answer do you?? G.

                                    L 1 Reply Last reply
                                    0
                                    • E Ennis Ray Lynch Jr

                                      Poor communication is a challenge best left to those with weak minds.

                                      Need a C# Consultant? I'm available.
                                      Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                                      G Offline
                                      G Offline
                                      Germyan
                                      wrote on last edited by
                                      #19

                                      Ennis Ray Lynch, Jr. wrote:

                                      Poor communication is a challenge best left to those with weak minds.

                                      Don't shoot off target.. If the communication is the problem I will try my best to correct it. However the OP question is a simple one.. show me a example where you really used composition in any of your system. Isn't that not clear? G.

                                      1 Reply Last reply
                                      0
                                      • S Shog9 0

                                        Wait - just what do you think aggregation is? And why do you think composition isn't aggregation? :suss:

                                        G Offline
                                        G Offline
                                        Germyan
                                        wrote on last edited by
                                        #20

                                        I am referring to the definitions, composition is a special type of a aggregation, so I am not telling that composition is not aggregation. But what I said was that the example you gave does not have that specialty to recognize as it is composition. G.

                                        S 1 Reply Last reply
                                        0
                                        • G Germyan

                                          Come up with valid facts.. I like to hear you. :~ Anyway, I like, if you can stick with the OP, rather than shooting off target to cover your not knowingness. :( You don't have an answer do you?? G.

                                          L Offline
                                          L Offline
                                          led mike
                                          wrote on last edited by
                                          #21

                                          I believe the section of that wikipedia page on Aggregation covers the topic very clearly and correctly. But of course you would have to read it to know that wouldn't you now?

                                          Germyan wrote:

                                          You don't have an answer do you??

                                          I know I have an answer to the problem called Germyan. I won't read any more of your messages. X|

                                          led mike

                                          G 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups