Object Oriented PHP

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

    #31
    Re: Object Oriented PHP


    "David Haynes" <david.haynes2@ sympatico.ca> wrote in message
    news:wawng.4605 4$dP1.24219@fe0 3.usenetserver. com...[color=blue]
    > Tim Van Wassenhove wrote:[color=green]
    >> On 2006-06-25, David Haynes <david.haynes2@ sympatico.ca> wrote:[color=darkred]
    >>> PHP5 has weak polymorphism but not true polymorphism in the sense that
    >>> it is used in OOP.[/color]
    >>
    >> So how would you define polymorphism? And what exactly are the
    >> differences between 'weak' and 'true' polymorphism?
    >>
    >> If i look at
    >> http://en.wikipedia.org/wiki/Polymor...ter_science%29
    >>
    >> "The concept of polymorphism applies to data types in addition to
    >> functions. A function that can evaluate to and be applied to values of
    >> different types is known as a polymorphic function. A data type that
    >> contains elements of different types is known as a polymorphic data
    >> type."[/color]
    >
    > Keep reading the article you referenced.
    >
    > "This type of polymorphism [overloading] is common in object-oriented
    > programming languages, many of which allow operators to be overloaded in a
    > manner similar to functions (see operator overloading). It is also used
    > extensively in the purely functional programming language Haskell in the
    > form of type classes. Many languages lacking ad-hoc polymorphism suffer
    > from long-winded names such as print_int, print_string, etc. (see C,
    > Objective Caml)."
    >[color=green][color=darkred]
    >>> function __construct($on e, $two="two", $three="three") {
    >>>
    >>> I cannot instantiate this object as new Foo($one, $three) since there is
    >>> no typing on the arguments and, therefore, no signature for a 'one,
    >>> three' contructor.[/color]
    >>
    >> Imho that's the same as saying: I'm standing with my back against a wall,
    >> and now i'm wondering why i can't step backwards anymore...
    >>
    >> Define your constructor as __constructor($ args) and handle with
    >> func_num_args and func_get_args(s ) any number of parameters...
    >>
    >> (I do agree that the language/compiler can, probably should, make this
    >> easier... But that's a different discussion.)[/color]
    >
    > What you have specified is a non-overloaded generic constructor. I view
    > this as a work-around due to the inability of the PHP interpreter to
    > handle overloading polymorphism.[/color]

    Just because PHP does not handle overloading in the way that other languages
    do does not mean that it does not support polymorphism. Overloading is not
    the same as polymorphism. They are different concepts that may or may not be
    employed at the same time.

    --
    Tony Marston

    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

    RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




    Comment

    • Tony Marston

      #32
      Re: Object Oriented PHP


      "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
      news:SY2dnb9_bL 74DQPZnZ2dnUVZ_ sadnZ2d@comcast .com...[color=blue]
      > Tim Van Wassenhove wrote:[color=green]
      >> On 2006-06-25, David Haynes <david.haynes2@ sympatico.ca> wrote:
      >>[color=darkred]
      >>>PHP5 has weak polymorphism but not true polymorphism in the sense that it
      >>>is used in OOP.[/color]
      >>
      >>
      >> So how would you define polymorphism? And what exactly are the
      >> differences between 'weak' and 'true' polymorphism?
      >>
      >> If i look at
      >> http://en.wikipedia.org/wiki/Polymor...ter_science%29
      >>
      >> "The concept of polymorphism applies to data types in addition to
      >> functions. A function that can evaluate to and be applied to values of
      >> different types is known as a polymorphic function. A data type that
      >> contains elements of different types is known as a polymorphic data
      >> type."
      >>
      >>[color=darkred]
      >>>function __construct($on e, $two="two", $three="three") {
      >>>
      >>>I cannot instantiate this object as new Foo($one, $three) since there is
      >>>no typing on the arguments and, therefore, no signature for a 'one,
      >>>three' contructor.[/color]
      >>
      >>
      >> Imho that's the same as saying: I'm standing with my back against a wall,
      >> and now i'm wondering why i can't step backwards anymore...
      >>
      >> Define your constructor as __constructor($ args) and handle with
      >> func_num_args and func_get_args(s ) any number of parameters...
      >>
      >> (I do agree that the language/compiler can, probably should, make this
      >> easier... But that's a different discussion.)
      >>[/color]
      >
      > The constructor overloading example isn't really polymorphism. It's just
      > function overloading.[/color]

      Absolutely correct. Polymorphism means "same interface, different
      implememtation" . You do not need overloading to make polymorphism work.

      --
      Tony Marston

      This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

      RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.



      [color=blue]
      > Polymorphism is the ability to operate on objects of derived classes,
      > without knowing what the derived classes are (or potentially even the
      > existence of the derived classes).
      >
      > For instance - let's say we have class "mammal" with function "eats". Now
      > all mammals eat something, but what the class of mammals eats is not
      > defines.
      >
      > So, derive from mammal the class "ape" and have eats return "bananas".
      > Also derive the class "horse" and have eats return "oats".
      >
      > Now - when you create an object of the class "ape" you can pass it to a
      > function which takes a "mammal". And you can print out what *this* mammal
      > eats. The same with a horse.
      >
      > Polymorphism is closely tied to inheritance. But while inheritance allows
      > the programmer to take advantage of the commonalities between classes,
      > polymorphism allows the program to take advantage of the differences.
      >
      >
      > --
      > =============== ===
      > Remove the "x" from my email address
      > Jerry Stuckle
      > JDS Computer Training Corp.
      > jstucklex@attgl obal.net
      > =============== ===[/color]


      Comment

      • Jerry Stuckle

        #33
        Re: Object Oriented PHP

        Tony Marston wrote:[color=blue]
        > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
        > news:l7mdnYUJ5O PIEwPZnZ2dnUVZ_ q-dnZ2d@comcast.c om...
        >[color=green]
        >>Tony Marston wrote:
        >>[color=darkred]
        >>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
        >>>news:4K2dnSM 18oD9YQDZnZ2dnU VZ_oWdnZ2d@comc ast.com...
        >>>
        >>>
        >>>>David Haynes wrote:
        >>>>
        >>>>
        >>>>>Jerry Stuckle wrote:
        >>>>>
        >>>
        >>>< snip >
        >>>
        >>>>I really don't know how hard it would be to add - but I would like to see
        >>>>it added. One thing I don't like all that much is the untyped variables.
        >>>>It makes things "easy" - but leads to some sloppy programming.
        >>>>
        >>>>It also means you can't overload functions - at least not with the same
        >>>>number of parms. Typing the constructor arguments is a good start. But
        >>>>expanding that to other functions without breaking existing code might be
        >>>>more difficult.
        >>>
        >>>
        >>>You don't need function overloading in PHP. Why? First you need to look
        >>>at why other languages need it:
        >>>(a) To accept arguments of different types.
        >>>(b) To make some arguments optional.
        >>>
        >>>With PHP you can accept an argument of any type and then cast it to the
        >>>one you want, so item (a) is irrelevant.
        >>>
        >>>With PHP you can define a default value for an argument if it is not
        >>>supplied, so item (b) is irrelevant.
        >>>[/color]
        >>
        >>Sure. I would love to be able to have a function which does different
        >>things based on the type of parameter passed. It would save a lot of work
        >>trying to sort out parameters and potentially having to change existing
        >>code when adding new parameter types.
        >>
        >>But we already know you don't understand or appreciate real OO
        >>programming , Tony. So quite frankly, I don't give a damn what you think.[/color]
        >
        >
        > Just because my understanding and implementation of OOP is different from
        > yours does not make you right and me wrong.
        >[/color]

        Other than the fact your understanding and implementation is different from
        every expert in the field.

        You *think* you understand OO. But you have no idea what *real* OO is about.
        Otherwise you wouldn't be making some of your comments.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Jerry Stuckle

          #34
          Re: Object Oriented PHP

          Tony Marston wrote:[color=blue]
          > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message[color=green]
          >>
          >>No, Tony, you really don't know what polymorphism is, do you?[/color]
          >
          >
          > The simplest definition of polymorphism is "same interface, different
          > implementation" . This means that different objects can share the same
          > interface but which do different things. What do you think it means?
          >[/color]

          I rest my case.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Tony Marston

            #35
            Re: Object Oriented PHP


            "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
            news:cY6dnZggTf rJJgPZnZ2dnUVZ_ oidnZ2d@comcast .com...[color=blue]
            > Tony Marston wrote:[color=green]
            >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message[/color][/color]

            <snip>
            [color=blue][color=green]
            >> Just because my understanding and implementation of OOP is different from
            >> yours does not make you right and me wrong.
            >>[/color]
            >
            > Other than the fact your understanding and implementation is different
            > from every expert in the field.[/color]

            What you mean is that people who think like you are the so-called *experts*
            while those who choose to think differently are *idiots*. What an arrogant
            pratt you are to think that YOUR brand of OO is the only true brand.
            [color=blue]
            > You *think* you understand OO. But you have no idea what *real* OO is
            > about. Otherwise you wouldn't be making some of your comments.[/color]

            OO is about encapsulation, polymorphism and inheritance. Nothing more,
            nothing less. What you choose to call *real* OO I call *bastardised* OO
            because some people of low intelligence are trying to make it more difficult
            than it really is.

            --
            Tony Marston

            This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

            RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




            Comment

            • Tony Marston

              #36
              Re: Object Oriented PHP


              "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
              news:ms-dnS6A-pd2JgPZnZ2dnUVZ _radnZ2d@comcas t.com...[color=blue]
              > Tony Marston wrote:[color=green]
              >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message[color=darkred]
              >>>
              >>>No, Tony, you really don't know what polymorphism is, do you?[/color]
              >>
              >>
              >> The simplest definition of polymorphism is "same interface, different
              >> implementation" . This means that different objects can share the same
              >> interface but which do different things. What do you think it means?
              >>[/color]
              >
              > I rest my case.[/color]

              Without answering the question, I notice. Is it too difficult for you? I
              take my definition from http://c2.com/cgi/wiki?PolyMorphism and
              http://en.wikipedia.org/wiki/Polymor...mputer_science) Where did you
              get yours? The toilet?

              --
              Tony Marston

              This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

              RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




              Comment

              • Jerry Stuckle

                #37
                Re: Object Oriented PHP

                Tony Marston wrote:[color=blue]
                > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                > news:cY6dnZggTf rJJgPZnZ2dnUVZ_ oidnZ2d@comcast .com...
                >[color=green]
                >>Tony Marston wrote:
                >>[color=darkred]
                >>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message[/color][/color]
                >
                >
                > <snip>
                >[color=green][color=darkred]
                >>>Just because my understanding and implementation of OOP is different from
                >>>yours does not make you right and me wrong.
                >>>[/color]
                >>
                >>Other than the fact your understanding and implementation is different
                >>from every expert in the field.[/color]
                >
                >
                > What you mean is that people who think like you are the so-called *experts*
                > while those who choose to think differently are *idiots*. What an arrogant
                > pratt you are to think that YOUR brand of OO is the only true brand.
                >[/color]

                My understanding comes from people like Grady Booch, James Rumbaugh and Ivar
                Jacobson - and is in complete agreement with these people. But of course, they
                disagree with you, so you'll call them idiots, also.[color=blue]
                >[color=green]
                >>You *think* you understand OO. But you have no idea what *real* OO is
                >>about. Otherwise you wouldn't be making some of your comments.[/color]
                >
                >
                > OO is about encapsulation, polymorphism and inheritance. Nothing more,
                > nothing less. What you choose to call *real* OO I call *bastardised* OO
                > because some people of low intelligence are trying to make it more difficult
                > than it really is.
                >[/color]

                Also message passing - which you seem to conveniently forget. And YOU are the
                one "bastardizi ng" OO. Your sloppy approach to programming is just what *real*
                OO is designed to eliminate. And it makes the coding much more maintainable,
                expandable and modifiable.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Jerry Stuckle

                  #38
                  Re: Object Oriented PHP

                  Tony Marston wrote:[color=blue]
                  > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                  > news:ms-dnS6A-pd2JgPZnZ2dnUVZ _radnZ2d@comcas t.com...
                  >[color=green]
                  >>Tony Marston wrote:
                  >>[color=darkred]
                  >>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                  >>>
                  >>>>No, Tony, you really don't know what polymorphism is, do you?
                  >>>
                  >>>
                  >>>The simplest definition of polymorphism is "same interface, different
                  >>>implementati on". This means that different objects can share the same
                  >>>interface but which do different things. What do you think it means?
                  >>>[/color]
                  >>
                  >>I rest my case.[/color]
                  >
                  >
                  > Without answering the question, I notice. Is it too difficult for you? I
                  > take my definition from http://c2.com/cgi/wiki?PolyMorphism and
                  > http://en.wikipedia.org/wiki/Polymor...mputer_science) Where did you
                  > get yours? The toilet?
                  >[/color]

                  No need to answer your question. You're "definition " speaks for itself.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Tony Marston

                    #39
                    Re: Object Oriented PHP


                    "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                    news:ceOdneIn6a 2GTgPZnZ2dnUVZ_ oWdnZ2d@comcast .com...[color=blue]
                    > Tony Marston wrote:[color=green]
                    >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                    >> news:ms-dnS6A-pd2JgPZnZ2dnUVZ _radnZ2d@comcas t.com...
                    >>[color=darkred]
                    >>>Tony Marston wrote:
                    >>>
                    >>>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                    >>>>
                    >>>>>No, Tony, you really don't know what polymorphism is, do you?
                    >>>>
                    >>>>
                    >>>>The simplest definition of polymorphism is "same interface, different
                    >>>>implementat ion". This means that different objects can share the same
                    >>>>interface but which do different things. What do you think it means?
                    >>>>
                    >>>
                    >>>I rest my case.[/color]
                    >>
                    >>
                    >> Without answering the question, I notice. Is it too difficult for you? I
                    >> take my definition from http://c2.com/cgi/wiki?PolyMorphism and
                    >> http://en.wikipedia.org/wiki/Polymor...mputer_science) Where did
                    >> you get yours? The toilet?
                    >>[/color]
                    >
                    > No need to answer your question. You're "definition " speaks for itself.[/color]

                    You mean that the definition I use is correct while yours is a pile a poo?

                    My definition is shared by experts. Your definition is shared by people who
                    think they're experts.

                    --
                    Tony Marston

                    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

                    RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




                    Comment

                    • Tony Marston

                      #40
                      Re: Object Oriented PHP


                      "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                      news:ceOdneMn6a 1vTwPZnZ2dnUVZ_ oWdnZ2d@comcast .com...[color=blue]
                      > Tony Marston wrote:[color=green]
                      >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                      >> news:cY6dnZggTf rJJgPZnZ2dnUVZ_ oidnZ2d@comcast .com...
                      >>[color=darkred]
                      >>>Tony Marston wrote:
                      >>>
                      >>>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message[/color]
                      >>
                      >>
                      >> <snip>
                      >>[color=darkred]
                      >>>>Just because my understanding and implementation of OOP is different
                      >>>>from yours does not make you right and me wrong.
                      >>>>
                      >>>
                      >>>Other than the fact your understanding and implementation is different
                      >>>from every expert in the field.[/color]
                      >>
                      >>
                      >> What you mean is that people who think like you are the so-called
                      >> *experts* while those who choose to think differently are *idiots*. What
                      >> an arrogant pratt you are to think that YOUR brand of OO is the only true
                      >> brand.
                      >>[/color]
                      >
                      > My understanding comes from people like Grady Booch, James Rumbaugh and
                      > Ivar Jacobson - and is in complete agreement with these people. But of
                      > course, they disagree with you, so you'll call them idiots, also.[color=green]
                      >>[color=darkred]
                      >>>You *think* you understand OO. But you have no idea what *real* OO is
                      >>>about. Otherwise you wouldn't be making some of your comments.[/color]
                      >>
                      >>
                      >> OO is about encapsulation, polymorphism and inheritance. Nothing more,
                      >> nothing less. What you choose to call *real* OO I call *bastardised* OO
                      >> because some people of low intelligence are trying to make it more
                      >> difficult than it really is.
                      >>[/color]
                      >
                      > Also message passing - which you seem to conveniently forget.[/color]

                      OO is about encapsulation, polymorphism and inheritance. Message passing is
                      incidental.
                      [color=blue]
                      > And YOU are the one "bastardizi ng" OO. Your sloppy approach to
                      > programming is just what *real* OO is designed to eliminate. And it makes
                      > the coding much more maintainable, expandable and modifiable.[/color]

                      Not the way some people use OO. They deliberately make it more complicated
                      than it need be, while I keep it as simple as possible.

                      --
                      Tony Marston

                      This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

                      RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




                      Comment

                      • Jerry Stuckle

                        #41
                        Re: Object Oriented PHP

                        Tony Marston wrote:[color=blue]
                        > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                        > news:ceOdneMn6a 1vTwPZnZ2dnUVZ_ oWdnZ2d@comcast .com...
                        >[color=green]
                        >>Tony Marston wrote:
                        >>[color=darkred]
                        >>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                        >>>news:cY6dnZg gTfrJJgPZnZ2dnU VZ_oidnZ2d@comc ast.com...
                        >>>
                        >>>
                        >>>>Tony Marston wrote:
                        >>>>
                        >>>>
                        >>>>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                        >>>
                        >>>
                        >>><snip>
                        >>>
                        >>>>>Just because my understanding and implementation of OOP is different
                        >>>>
                        >>>>>from yours does not make you right and me wrong.
                        >>>>
                        >>>>Other than the fact your understanding and implementation is different
                        >>>
                        >>>>from every expert in the field.
                        >>>
                        >>>
                        >>>What you mean is that people who think like you are the so-called
                        >>>*experts* while those who choose to think differently are *idiots*. What
                        >>>an arrogant pratt you are to think that YOUR brand of OO is the only true
                        >>>brand.
                        >>>[/color]
                        >>
                        >>My understanding comes from people like Grady Booch, James Rumbaugh and
                        >>Ivar Jacobson - and is in complete agreement with these people. But of
                        >>course, they disagree with you, so you'll call them idiots, also.
                        >>[color=darkred]
                        >>>>You *think* you understand OO. But you have no idea what *real* OO is
                        >>>>about. Otherwise you wouldn't be making some of your comments.
                        >>>
                        >>>
                        >>>OO is about encapsulation, polymorphism and inheritance. Nothing more,
                        >>>nothing less. What you choose to call *real* OO I call *bastardised* OO
                        >>>because some people of low intelligence are trying to make it more
                        >>>difficult than it really is.
                        >>>[/color]
                        >>
                        >>Also message passing - which you seem to conveniently forget.[/color]
                        >
                        >
                        > OO is about encapsulation, polymorphism and inheritance. Message passing is
                        > incidental.
                        >
                        >[color=green]
                        >> And YOU are the one "bastardizi ng" OO. Your sloppy approach to
                        >>programming is just what *real* OO is designed to eliminate. And it makes
                        >>the coding much more maintainable, expandable and modifiable.[/color]
                        >
                        >
                        > Not the way some people use OO. They deliberately make it more complicated
                        > than it need be, while I keep it as simple as possible.
                        >[/color]

                        And that is where you are 100% wrong. Message passing is an integral part of
                        both object-based and object-oriented languages.

                        One bit of wisdom, Tony. Tis better to remain silent and have everyone thing
                        you might be a fool than to open your mouth and remove all doubt.

                        In the OO world you have removed all doubt.


                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstucklex@attgl obal.net
                        =============== ===

                        Comment

                        • Jerry Stuckle

                          #42
                          Re: Object Oriented PHP

                          Tony Marston wrote:[color=blue]
                          > "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                          > news:ceOdneMn6a 1vTwPZnZ2dnUVZ_ oWdnZ2d@comcast .com...
                          >[color=green]
                          >>Tony Marston wrote:
                          >>[color=darkred]
                          >>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                          >>>news:cY6dnZg gTfrJJgPZnZ2dnU VZ_oidnZ2d@comc ast.com...
                          >>>
                          >>>
                          >>>>Tony Marston wrote:
                          >>>>
                          >>>>
                          >>>>>"Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                          >>>
                          >>>
                          >>><snip>
                          >>>
                          >>>>>Just because my understanding and implementation of OOP is different
                          >>>>
                          >>>>>from yours does not make you right and me wrong.
                          >>>>
                          >>>>Other than the fact your understanding and implementation is different
                          >>>
                          >>>>from every expert in the field.
                          >>>
                          >>>
                          >>>What you mean is that people who think like you are the so-called
                          >>>*experts* while those who choose to think differently are *idiots*. What
                          >>>an arrogant pratt you are to think that YOUR brand of OO is the only true
                          >>>brand.
                          >>>[/color]
                          >>
                          >>My understanding comes from people like Grady Booch, James Rumbaugh and
                          >>Ivar Jacobson - and is in complete agreement with these people. But of
                          >>course, they disagree with you, so you'll call them idiots, also.
                          >>[color=darkred]
                          >>>>You *think* you understand OO. But you have no idea what *real* OO is
                          >>>>about. Otherwise you wouldn't be making some of your comments.
                          >>>
                          >>>
                          >>>OO is about encapsulation, polymorphism and inheritance. Nothing more,
                          >>>nothing less. What you choose to call *real* OO I call *bastardised* OO
                          >>>because some people of low intelligence are trying to make it more
                          >>>difficult than it really is.
                          >>>[/color]
                          >>
                          >>Also message passing - which you seem to conveniently forget.[/color]
                          >
                          >
                          > OO is about encapsulation, polymorphism and inheritance. Message passing is
                          > incidental.
                          >
                          >[color=green]
                          >> And YOU are the one "bastardizi ng" OO. Your sloppy approach to
                          >>programming is just what *real* OO is designed to eliminate. And it makes
                          >>the coding much more maintainable, expandable and modifiable.[/color]
                          >
                          >
                          > Not the way some people use OO. They deliberately make it more complicated
                          > than it need be, while I keep it as simple as possible.
                          >[/color]

                          And the way you use OO is a bastardization of OO techniques.


                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          • Richard Levasseur

                            #43
                            Re: Object Oriented PHP

                            Tim Van Wassenhove wrote:[color=blue]
                            > On 2006-06-25, David Haynes <david.haynes2@ sympatico.ca> wrote:[color=green]
                            > > PHP5 has weak polymorphism but not true polymorphism in the sense that
                            > > it is used in OOP.[/color]
                            >
                            > So how would you define polymorphism? And what exactly are the
                            > differences between 'weak' and 'true' polymorphism?
                            >
                            > If i look at http://en.wikipedia.org/wiki/Polymor...ter_science%29
                            >
                            > "The concept of polymorphism applies to data types in addition to
                            > functions. A function that can evaluate to and be applied to values of
                            > different types is known as a polymorphic function. A data type that
                            > contains elements of different types is known as a polymorphic data
                            > type."
                            >[color=green]
                            > > function __construct($on e, $two="two", $three="three") {
                            > >
                            > > I cannot instantiate this object as new Foo($one, $three) since there is
                            > > no typing on the arguments and, therefore, no signature for a 'one,
                            > > three' contructor. .[/color]
                            >
                            > Imho that's the same as saying: I'm standing with my back against a wall,
                            > and now i'm wondering why i can't step backwards anymore...
                            >
                            > Define your constructor as __constructor($ args) and handle with
                            > func_num_args and func_get_args(s ) any number of parameters...
                            >
                            > (I do agree that the language/compiler can, probably should, make this
                            > easier... But that's a different discussion.)
                            >
                            > --
                            > Met vriendelijke groeten,
                            > Tim Van Wassenhove <http://timvw.madoka.be >[/color]


                            There are two annoying problems with this, which is why its such a nice
                            feature to have:

                            1) It is a pain in the but to have to order out and determine the types
                            of the passed variables. Whenever I make classes i always end up
                            having to spend 100+ lines trying to figure out the types of variables
                            passed to sort out what goes where. Why? One object returns an
                            indexed array, another an associative array, other return other objects
                            of various types. The reason for being able to call the function with
                            any of these types is so that I don't have to pre-process the data and
                            can operate more efficently on the passed value. What ends up
                            happening is converting everything to an array, or string, or object,
                            or what not. A lot of extra work on my part and the program's part
                            that would otherwise be handled by a compiler.

                            They have type hints in PHP5, but they are more like type requirements,
                            as it causes a fatal error and is largely useless unless you
                            pre-process things to match that definition. I'd much rather be able
                            to create multiple methods with different signatures that could be
                            called if the parameters match, but thats not really feasible in a
                            typeless language.

                            2) It makes overriding methods harder in derived classes. Why?
                            Because the overridden method is completely hidden and you must convert
                            parameters to what it expects to be able to use its functionality.
                            This happened to me while extending HTML_Table from pear. Its addRow
                            method accepts 2 types of arrays, and invokes different completely code
                            paths depending on the array type, which is determined by a private
                            method thats not (well, shouldn't be) accesible from the derived class.


                            Ideally, all i would have to do is override addRow, modify the incoming
                            data to match what the original addRow expects, then pass it up.
                            Extension with minimum effort. However, because the addRow method uses
                            several private methods and a bunch of code and logic to determine what
                            to do, I either have to:
                            - Duplicate all that logic and code (including the private methods,
                            default values, etc), then pass it up to addRow to have it done again,
                            which is a lot of redunant work, or
                            - Pass it up to addRow then modify the object accordingly, which
                            performs several of the same operations addRow did originally (as well
                            as introducing a caveat of overwriting instead of updating certain
                            attributes, which limits the functionality in a few cases).

                            If i could just override the method to accept the single object i
                            wanted to pass it, while the original method existed and could be
                            called directly, all of that could have been avoided.

                            Then there is the lack of multiple inheritence in PHP. Considering the
                            wide breadth of small operations a single object should be able to do,
                            its completely insane to have to rewrite the exact same interface code
                            again and again for the smallest of operations (a problem that rears
                            its head in java gui programing, when you have to implement an
                            interface then manually delegate all methods to an instance of a class
                            that has a handle back to the container, more needless complication
                            that could have been handled by MI). I'm getting off topic though.
                            Please, continue the flame war.

                            Comment

                            • Tony Marston

                              #44
                              Re: Object Oriented PHP


                              "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                              news:GcmdnahZBu oluALZnZ2dnUVZ_ vednZ2d@comcast .com...[color=blue]
                              > Tony Marston wrote:[color=green]
                              >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                              >> news:ceOdneMn6a 1vTwPZnZ2dnUVZ_ oWdnZ2d@comcast .com...
                              >>[/color][/color]
                              <snip>[color=blue][color=green]
                              >>[color=darkred]
                              >>>>OO is about encapsulation, polymorphism and inheritance. Nothing more,
                              >>>>nothing less. What you choose to call *real* OO I call *bastardised* OO
                              >>>>because some people of low intelligence are trying to make it more
                              >>>>difficult than it really is.
                              >>>>
                              >>>
                              >>>Also message passing - which you seem to conveniently forget.[/color]
                              >>
                              >>
                              >> OO is about encapsulation, polymorphism and inheritance. Message passing
                              >> is incidental.
                              >>
                              >>[color=darkred]
                              >>> And YOU are the one "bastardizi ng" OO. Your sloppy approach to
                              >>> programming is just what *real* OO is designed to eliminate. And it
                              >>> makes the coding much more maintainable, expandable and modifiable.[/color]
                              >>
                              >>
                              >> Not the way some people use OO. They deliberately make it more
                              >> complicated than it need be, while I keep it as simple as possible.
                              >>[/color]
                              >
                              > And the way you use OO is a bastardization of OO techniques.[/color]

                              That's just your opinion. Just because my implementation of OO is different
                              from yours does not make it wrong, merely different. If you believe that
                              YOUR way is the ONLY way then you are just being arrogant.

                              --
                              Tony Marston

                              This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

                              RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




                              Comment

                              • Tony Marston

                                #45
                                Re: Object Oriented PHP


                                "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                                news:tMydnfBVrd _suQLZnZ2dnUVZ_ o6dnZ2d@comcast .com...[color=blue]
                                > Tony Marston wrote:[color=green]
                                >> "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                                >> news:ceOdneMn6a 1vTwPZnZ2dnUVZ_ oWdnZ2d@comcast .com...
                                >>[/color][/color]
                                <snip>[color=blue][color=green]
                                >>
                                >> OO is about encapsulation, polymorphism and inheritance. Message passing
                                >> is incidental.
                                >>
                                >>[color=darkred]
                                >>> And YOU are the one "bastardizi ng" OO. Your sloppy approach to
                                >>> programming is just what *real* OO is designed to eliminate. And it
                                >>> makes the coding much more maintainable, expandable and modifiable.[/color]
                                >>
                                >>
                                >> Not the way some people use OO. They deliberately make it more
                                >> complicated than it need be, while I keep it as simple as possible.
                                >>[/color]
                                >
                                > And that is where you are 100% wrong. Message passing is an integral part
                                > of both object-based and object-oriented languages.
                                >
                                > One bit of wisdom, Tony. Tis better to remain silent and have everyone
                                > thing you might be a fool than to open your mouth and remove all doubt.
                                >
                                > In the OO world you have removed all doubt.[/color]

                                The three principles of OO are encapsulation, polymorphism and inheritance.
                                Message passing does not appear in that list, so it is a minor detail.

                                --
                                Tony Marston

                                This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

                                RADICORE is a Rapid Application Development Toolkit for building Administrative Web Applications which are platform independent, browser independent and database independent.




                                Comment

                                Working...