Passing Parameters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sonia

    #16
    Re: Passing Parameters


    "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
    news:bj3u6r$jk0 @dispatch.conce ntric.net...[color=blue]
    > John Harrison wrote:[color=green]
    > > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
    > > news:bj3k2j$21t @dispatch.conce ntric.net...
    > >[/color]
    > ...[color=green]
    > >
    > > Deriving CrapsGame from Dice? Poor design surely, there's no obvious
    > > releationship.
    > >
    > > Make Dice a freestanding function and class it from CrapsGame (or[/color][/color]
    anywhere[color=blue][color=green]
    > > else).[/color]
    >
    > Craps is a game of dice. It's 100% obvious to me that this is a IS-A
    > relationship. For example if I wanted to simulate "loaded" dice ?
    >
    > Anyhow, this particular function rolls twice and returns the sum. It's
    > very particular to craps and potentially other similar games. In
    > hindsight, it should give you both values and not the sum.
    >
    > Sonia, this is an excellent example of how 2 people can come up with
    > wildly different opinions even though they've been at it for a while.
    > It really does not matter either way how you do this. There are more
    > obvious and clearer examples of where you need to inherit vs have a[/color]
    member.[color=blue]
    >
    > I suggest you keey your threshhold for creating a class is very low.
    > Small interesting chunks are much easier to understand and maintain that
    > large spaghetti plates.
    >
    >
    >
    >
    >
    >[/color]

    I understand what you are saying, and agree that small chunks are easier to
    manipulate than "large plates". I will get to classes very soon. :) Thanks


    Comment

    • Gianni Mariani

      #17
      Re: Passing Parameters

      David White wrote:[color=blue]
      > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
      > news:bj3u6r$jk0 @dispatch.conce ntric.net...
      >[color=green]
      >>John Harrison wrote:
      >>[color=darkred]
      >>>"Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
      >>>news:bj3k2j$ 21t@dispatch.co ncentric.net...
      >>>[/color]
      >>
      >>...
      >>[color=darkred]
      >>>Deriving CrapsGame from Dice? Poor design surely, there's no obvious
      >>>releationshi p.
      >>>
      >>>Make Dice a freestanding function and class it from CrapsGame (or[/color][/color]
      >
      > anywhere
      >[color=green][color=darkred]
      >>>else).[/color]
      >>
      >>Craps is a game of dice.[/color]
      >
      >
      > But your class Dice is not a dice game. It's the dice themselves. A dice
      > game _uses_, or _has_, dice. It also has players and rules etc.[/color]

      Well, it's obvious this design does not make sense because there are
      multiple players in a game and as written, there is only one player.

      That aside, there is nothing wrong with the model of the game. Dice is a
      game by itself, any property of Dice is also a property of a Craps game.

      Unfortunately this example is a really good to show the different ways
      you can design somthing but very bad because there is no *right* answer.
      [color=blue]
      >
      >[color=green]
      >>It's 100% obvious to me that this is a IS-A
      >>relationship. For example if I wanted to simulate "loaded" dice ?[/color]
      >
      >
      > Then you might derive a class LoadedDice from Dice, and have your Craps
      > game - an object of an unrelated class - contain a LoadedDice object instead
      > of a Dice object.
      >[/color]

      But how does one now manage LoadedCrapsGame ? A loaded dice will have
      methods for managing how to "load" the game. I suspect that the same
      interface to load dice could be used to load the game.

      Well sure - I can make everything a member and never use inheritance,
      it's not very useful to do that and it makes a whole bunch of work for
      nothing.






      Comment

      • Peter van Merkerk

        #18
        Re: Passing Parameters

        > > Craps is a game. It certainly is *not* a dice[color=blue]
        >
        > So certain are you ?
        >[color=green]
        > > For it to play you need dice.
        > > So craps *has-a* dice.
        > >
        > > class craps
        > > {
        > > dice the_dice;
        > > };
        > >
        > > Same with cars and engines. A car is not an engine, but a car[/color][/color]
        contains[color=blue][color=green]
        > > an engine.
        > >[/color]
        >
        > Cars are built around an engine. I can see how some designs would
        > inherit from engine. Why not ?[/color]

        A car has not a "is a" relationship with an engine, but "has a"
        relationship. Since a car is not a engine, inheriting Car from Engine
        would be a rather illogical choice for most people I know.
        [color=blue]
        > It depends on what you're trying to model with your design.[/color]

        If you disagree on the definition, than you will also disagree on the
        design. However for the Car/Engine example the choice seems to be rather
        clear to me.

        --
        Peter van Merkerk
        peter.van.merke rk(at)dse.nl




        Comment

        • jeffc

          #19
          Re: Passing Parameters


          "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
          news:bj4us1$o69 @dispatch.conce ntric.net...[color=blue]
          > Karl Heinz Buchegger wrote:
          >[color=green]
          > >
          > > Huch.
          > > Craps is a game. It certainly is *not* a dice[/color]
          >
          > So certain are you ?[/color]

          I am certain.
          [color=blue]
          > Cars are built around an engine. I can see how some designs would
          > inherit from engine. Why not ?[/color]

          Because it's incorrect use of inheritance from all accepted standards of OO
          design. Your relationship is most definitely not IS-A.


          Comment

          • Gianni Mariani

            #20
            Re: Passing Parameters

            Peter van Merkerk wrote:
            [color=blue]
            >
            > If you disagree on the definition, than you will also disagree on the
            > design. However for the Car/Engine example the choice seems to be rather
            > clear to me.[/color]

            Clear ? Great, what are you trying to model ?

            Since we have NO idea what is being modelled, your clarity perplexes me.

            Comment

            • Gianni Mariani

              #21
              Re: Passing Parameters

              jeffc wrote:
              [color=blue][color=green]
              >>Cars are built around an engine. I can see how some designs would
              >>inherit from engine. Why not ?[/color]
              >
              >
              > Because it's incorrect use of inheritance from all accepted standards of OO
              > design. Your relationship is most definitely not IS-A.[/color]

              Bogus. Since we don't have any design goals your comments are nonsense.

              G

              Comment

              • jeffc

                #22
                Re: Passing Parameters


                "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                news:bj50l7$o6i @dispatch.conce ntric.net...[color=blue]
                >
                > That aside, there is nothing wrong with the model of the game. Dice is a
                > game by itself, any property of Dice is also a property of a Craps game.[/color]

                You are using the word differently than anyone else here, and how any
                reasonable person would understand it in this context. For example, what is
                basketball? Basketball is a game. It is also a round orange ball. If I
                say "throw the basketball through the hoop", then we know the meaning is
                "round orange ball". If I say "let's play basketball", then we know the
                meaning is "game". From the context of the original question, Sonia was
                rolling dice, therefore dice meant white squares, not the game of dice. To
                distinguish them, you'd have to have a class called DiceGame or GameOfDice.
                [color=blue]
                > But how does one now manage LoadedCrapsGame ? A loaded dice will have
                > methods for managing how to "load" the game. I suspect that the same
                > interface to load dice could be used to load the game.[/color]

                Again you are twisting language badly and confusingly. No one would refer
                to a Loaded Craps Game. You could have loaded dice, which are a special
                kind of dice (LoadedDice IS-A Dice, with different behavior). Loading a
                game has nothing at all to do with this meaning.


                Comment

                • jeffc

                  #23
                  Re: Passing Parameters


                  "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                  news:bj57sm$o6a @dispatch.conce ntric.net...[color=blue][color=green]
                  > >
                  > > It's an excellent example of at least one wild idea, but in this case[/color][/color]
                  yours[color=blue][color=green]
                  > > is wrong. If you've been at OO design for "a while", then you ought to
                  > > revisit some of the fundamentals.[/color]
                  >
                  > That's nice. What exactly are these fundamental religions do you
                  > proscribe to ?
                  >
                  > I have developed my own ideas because the "fundamenta ls" I think you
                  > allude to do not allways make sense when applied to the real world.
                  >
                  > My goal is to make it so that building software is easier. One of the
                  > tools is inheritance. If "easier" (huge overloaded term warning)
                  > implies inheritance then we're done, inheritance it is.
                  >
                  > The IS-A and CONTAINS-A giudelines are just that, guidelines. It's not
                  > a law of physics.[/color]

                  You're backtracking, and badly. You said, "Craps is a game of dice. It's
                  100% obvious to me that this is a IS-A relationship." That is plain wrong,
                  and not many people here will sit silently while you give that sort of
                  advice. If you want to IGNORE clearly defined OO concepts, that's fine, but
                  don't try and advise someone on something wrong. If your goal is to make
                  building software easier, and you use inheritance when you should have used
                  composition, then you have made your software very confusing and difficult
                  to maintain. Again, no one here will concur no matter how hip you try to
                  sound.


                  Comment

                  • jeffc

                    #24
                    Re: Passing Parameters


                    "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                    news:bj577b$o69 @dispatch.conce ntric.net...[color=blue]
                    > Peter van Merkerk wrote:
                    >[color=green]
                    > >
                    > > If you disagree on the definition, than you will also disagree on the
                    > > design. However for the Car/Engine example the choice seems to be rather
                    > > clear to me.[/color]
                    >
                    > Clear ? Great, what are you trying to model ?
                    >
                    > Since we have NO idea what is being modelled, your clarity perplexes me.[/color]

                    We are modeling the relationship between a car and an engine. This is clear
                    to any 8 year old, if not you.


                    Comment

                    • Gianni Mariani

                      #25
                      Re: Passing Parameters

                      jeffc wrote:[color=blue]
                      > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                      > news:bj50l7$o6i @dispatch.conce ntric.net...
                      >[color=green]
                      >>That aside, there is nothing wrong with the model of the game. Dice is a
                      >>game by itself, any property of Dice is also a property of a Craps game.[/color]
                      >
                      >
                      > You are using the word differently than anyone else here, and how any
                      > reasonable person would understand it in this context. For example, what is
                      > basketball? Basketball is a game. It is also a round orange ball. If I
                      > say "throw the basketball through the hoop", then we know the meaning is
                      > "round orange ball". If I say "let's play basketball", then we know the
                      > meaning is "game". From the context of the original question, Sonia was
                      > rolling dice, therefore dice meant white squares, not the game of dice. To
                      > distinguish them, you'd have to have a class called DiceGame or GameOfDice.[/color]

                      I don't see any modelling of a cube with little white dots anywhere in
                      this thread. What are you talking about ?
                      [color=blue]
                      >
                      >[color=green]
                      >>But how does one now manage LoadedCrapsGame ? A loaded dice will have
                      >>methods for managing how to "load" the game. I suspect that the same
                      >>interface to load dice could be used to load the game.[/color]
                      >
                      >
                      > Again you are twisting language badly and confusingly. No one would refer
                      > to a Loaded Craps Game.[/color]

                      Why not ? I just did ? Am I not a person ? Last time I checked I was.
                      You're making me feel like chopped liver with comments like these !

                      You could have loaded dice, which are a special[color=blue]
                      > kind of dice (LoadedDice IS-A Dice, with different behavior). Loading a
                      > game has nothing at all to do with this meaning.[/color]

                      Maybe I'm not twisting at all. Maybe that IS my perspective. Take a
                      few moments to look at it from my point of view. You seem to have
                      grasped the concepts rather easily since you can argue them so well.
                      Hence, from a perspective of communication of my ideas, you seem to have
                      grasped them rather quickly, yet you seem to argue more from a
                      perspective of dislike rather than anything else. My suggestion for
                      you: Get over it. Programs are an ABSTRACTION. Anything that I write
                      that models the way I want to model it is correct. I'm not going to
                      subscribe to a "my god is better that your god" kind of argument.

                      When designing software, you need to enable any abstraction that makes
                      it easier to create your software. Sometimes these model physical
                      concepts nicely and sometimes they don't, it really has no bearing on
                      the result. There are many paths to get to the top of the proverbial
                      mountain, whatever works for you is best for you.


                      Comment

                      • Gianni Mariani

                        #26
                        Re: Passing Parameters

                        jeffc wrote:[color=blue]
                        > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                        > news:bj577b$o69 @dispatch.conce ntric.net...
                        >[color=green]
                        >>Peter van Merkerk wrote:
                        >>
                        >>[color=darkred]
                        >>>If you disagree on the definition, than you will also disagree on the
                        >>>design. However for the Car/Engine example the choice seems to be rather
                        >>>clear to me.[/color]
                        >>
                        >>Clear ? Great, what are you trying to model ?
                        >>
                        >>Since we have NO idea what is being modelled, your clarity perplexes me.[/color]
                        >
                        >
                        > We are modeling the relationship between a car and an engine. This is clear
                        > to any 8 year old, if not you.
                        >
                        >[/color]

                        Oh really !

                        Vibration ?
                        Noise ?
                        Energy ?
                        Power ?
                        Shape ?
                        Handling ?
                        Manufacture ?
                        Simulation ?
                        Game piece ?
                        Consituency ?
                        Decay ?
                        Acceleration ?
                        Fuel economy ?

                        I'm sure there are more things we can model that I can't think of right
                        now. Some of these make sense to use inheritance, some do not.

                        Any 8 year old would know that !


                        Comment

                        • Gianni Mariani

                          #27
                          Re: Passing Parameters

                          jeffc wrote:[color=blue]
                          > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                          > news:bj57sm$o6a @dispatch.conce ntric.net...
                          >[color=green][color=darkred]
                          >>>It's an excellent example of at least one wild idea, but in this case[/color][/color]
                          >
                          > yours
                          >[color=green][color=darkred]
                          >>>is wrong. If you've been at OO design for "a while", then you ought to
                          >>>revisit some of the fundamentals.[/color]
                          >>
                          >>That's nice. What exactly are these fundamental religions do you
                          >>proscribe to ?
                          >>
                          >>I have developed my own ideas because the "fundamenta ls" I think you
                          >>allude to do not allways make sense when applied to the real world.
                          >>
                          >>My goal is to make it so that building software is easier. One of the
                          >>tools is inheritance. If "easier" (huge overloaded term warning)
                          >>implies inheritance then we're done, inheritance it is.
                          >>
                          >>The IS-A and CONTAINS-A giudelines are just that, guidelines. It's not
                          >>a law of physics.[/color]
                          >
                          >
                          > You're backtracking, and badly. You said, "Craps is a game of dice. It's
                          > 100% obvious to me that this is a IS-A relationship."[/color]

                          And ? That still makes sense to me.

                          That is plain wrong,[color=blue]
                          > and not many people here will sit silently while you give that sort of
                          > advice. If you want to IGNORE clearly defined OO concepts, that's fine, but
                          > don't try and advise someone on something wrong.[/color]

                          Explain what is "wrong" without spouting religion.


                          If your goal is to make[color=blue]
                          > building software easier, and you use inheritance when you should have used
                          > composition, then you have made your software very confusing and difficult
                          > to maintain.[/color]

                          How do you know I "should have" done anything ?



                          Comment

                          • jeffc

                            #28
                            Re: Passing Parameters


                            "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                            news:bj595j$o6i @dispatch.conce ntric.net...[color=blue][color=green]
                            > >
                            > > You are using the word differently than anyone else here, and how any
                            > > reasonable person would understand it in this context. For example,[/color][/color]
                            what is[color=blue][color=green]
                            > > basketball? Basketball is a game. It is also a round orange ball. If[/color][/color]
                            I[color=blue][color=green]
                            > > say "throw the basketball through the hoop", then we know the meaning is
                            > > "round orange ball". If I say "let's play basketball", then we know the
                            > > meaning is "game". From the context of the original question, Sonia was
                            > > rolling dice, therefore dice meant white squares, not the game of dice.[/color][/color]
                            To[color=blue][color=green]
                            > > distinguish them, you'd have to have a class called DiceGame or[/color][/color]
                            GameOfDice.[color=blue]
                            >
                            > I don't see any modelling of a cube with little white dots anywhere in
                            > this thread. What are you talking about ?[/color]

                            Sonia had a function called rollDice(). The Dice being referred to is the
                            objects - the white cubes. Not the game of Dice. Two completely different
                            things.
                            [color=blue][color=green]
                            > > Again you are twisting language badly and confusingly. No one would[/color][/color]
                            refer[color=blue][color=green]
                            > > to a Loaded Craps Game.[/color]
                            >
                            > Why not ? I just did ? Am I not a person ? Last time I checked I was.
                            > You're making me feel like chopped liver with comments like these ![/color]

                            Check again. You're a cyborg troll.


                            Comment

                            • jeffc

                              #29
                              Re: Passing Parameters


                              "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                              news:bj59p5$o6i @dispatch.conce ntric.net...[color=blue]
                              >
                              > If your goal is to make[color=green]
                              > > building software easier, and you use inheritance when you should have[/color][/color]
                              used[color=blue][color=green]
                              > > composition, then you have made your software very confusing and[/color][/color]
                              difficult[color=blue][color=green]
                              > > to maintain.[/color]
                              >
                              > How do you know I "should have" done anything ?[/color]

                              Have fun in your little dream world, Gianni.


                              Comment

                              • Gianni Mariani

                                #30
                                Re: Passing Parameters

                                jeffc wrote:[color=blue]
                                > "Gianni Mariani" <gi2nospam@mari ani.ws> wrote in message
                                > news:bj595j$o6i @dispatch.conce ntric.net...[/color]
                                ....[color=blue]
                                >
                                > Check again. You're a cyborg troll.
                                >[/color]

                                And what would that make you ?

                                *PLONK*

                                Comment

                                Working...