Object Oriented PHP vs Java

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

    #16
    Re: Object Oriented PHP vs Java

    Jerry wrote:
    [color=blue]
    > What are the advantages and disadvantages of using Object Oriented
    > PHP vs Java?[/color]

    If you've ever had training in software development, then you would not
    be asking this question.


    --
    Amir Khawaja.

    ----------------------------------
    Rules are written for those who lack the ability to truly reason, But
    for those who can, the rules become nothing more than guidelines, And
    live their lives governed not by rules but by reason.
    - James McGuigan

    Comment

    • Jaron \Ronamo\ Hendrix

      #17
      Re: Object Oriented PHP vs Java

      The date was 21 Jan 2004 10:31:04 -0800, and weinstei@nova.e du (Jerry)
      created the following morsel of goodness:
      [color=blue]
      >What are the advantages and disadvantages of using Object Oriented
      >PHP vs Java?[/color]

      It all depends on what type of project you will be working on. If you
      want to create a page templating engine, go with PHP. If you want to
      create an online game, use Java.

      Whether you use one or the other for OOP is a moot point. You
      wouldn't use PHP to create a side-scrolling adventure game, and Java,
      IMHO at least, certainly is NOT the best suited language for parsing
      text. They both have a reasonable OOP model to work with, but the
      languages just don't seem to have the same intended uses.


      Comment

      • Dave Benjamin

        #18
        Re: Object Oriented PHP vs Java

        In article <bun77t$k8f2g$1 @ID-30799.news.uni-berlin.de>, Agelmar wrote:[color=blue]
        > Bruno Desthuilliers wrote:[color=green]
        >> Savut wrote:[color=darkred]
        >>> "Jerry" <weinstei@nova. edu> wrote in message
        >>> news:69fca47c.0 401211031.539ef 63f@posting.goo gle.com...
        >>>
        >>>> What are the advantages and disadvantages of using Object Oriented
        >>>> PHP vs Java?
        >>>
        >>> >> PHP is not fully OO, even the PHP5... but Java is OO
        >>>>[/color]
        >>
        >> As there is *no* commonly accepted definition of OO, I just dont
        >> understand how you can claim such a thing.
        >>
        >> BTW, Smalltalkers could tell you why Java is not OO !-)[/color]
        >
        > Actually, there is a commonly accepted definition...
        > OO implies:
        > polymorphism, encapsulation, and inheritance.[/color]

        Polymorphism is available in non-OO languages. Many, including the
        authors of Design Patterns, advocate delegation over inheritance.
        Encapsulation can be easily achieved with modules and records.

        Alan Kay defines OOP as late binding and messaging. He also noted that Java
        is not what he had in mind when he coined the term, "OO".

        Robert Martin sees OOP as a dependency management technique; no more, no less.

        Ruby claims to be "pure-OO", but doesn't effectively enforce "informatio n
        hiding", which to some is a crucial part of "encapsulation" , and to others,
        a totally separate topic.

        But there's one thing for sure: OO == good. So, start with "good" and
        extrapolate "OO". It's much easier. =)

        --
        ..:[ dave benjamin (rameny sp00) -:- spoomusic.com -:- ramenfest.com ]:.
        : d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :

        Comment

        • Tony Marston

          #19
          Re: Object Oriented PHP vs Java


          "Dave Benjamin" <ramen@lackingt alent.com> wrote in message
          news:slrnc0v21b .pop.ramen@lack ingtalent.com.. .[color=blue]
          > In article <bun77t$k8f2g$1 @ID-30799.news.uni-berlin.de>, Agelmar wrote:[color=green]
          > > Bruno Desthuilliers wrote:[color=darkred]
          > >> Savut wrote:
          > >>> "Jerry" <weinstei@nova. edu> wrote in message
          > >>> news:69fca47c.0 401211031.539ef 63f@posting.goo gle.com...
          > >>>[/color][/color][/color]

          <snip>
          [color=blue]
          > But there's one thing for sure: OO == good. So, start with "good" and
          > extrapolate "OO". It's much easier. =)
          >[/color]

          I disagree entirely. You are implying that if it is OO then it must be good,
          and if it is not OO then it must be bad.

          It is possible to have an OO solution that is a pile of crap, and it is also
          possible to have a non-OO solution that is not.

          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



          Comment

          • Tony Marston

            #20
            Re: Object Oriented PHP vs Java


            "Amir Khawaja" <amir@gorebels. net> wrote in message
            news:y5HPb.5660 3$zs4.37656@fed 1read01...[color=blue]
            > Tony Marston wrote:[color=green]
            > > "Savut" <webki@hotmail. com> wrote in message
            > > news:UEzPb.1514 9$U77.1028473@n ews20.bellgloba l.com...
            > >[color=darkred]
            > >>PHP is not fully OO, even the PHP5... but Java is OO
            > >>[/color]
            > >
            > >
            > > Not according to some people as it does not support multiple[/color][/color]
            inheritance.[color=blue]
            >
            > Multiple inheritance can be problematic and is not a staple of OOP.
            >[color=green]
            > >[/color][/color]

            Which is precisely why it was left out of Java, and also left out of PHP 5.

            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



            Comment

            • Bruno Desthuilliers

              #21
              Re: Object Oriented PHP vs Java

              Agelmar wrote:[color=blue]
              > Bruno Desthuilliers wrote:
              >[color=green]
              >>Savut wrote:
              >>[color=darkred]
              >>>"Jerry" <weinstei@nova. edu> wrote in message
              >>>news:69fca47 c.0401211031.53 9ef63f@posting. google.com...
              >>>
              >>>
              >>>>What are the advantages and disadvantages of using Object Oriented
              >>>>PHP vs Java?
              >>>
              >>> >> PHP is not fully OO, even the PHP5... but Java is OO
              >>>[/color]
              >>As there is *no* commonly accepted definition of OO, I just dont
              >>understand how you can claim such a thing.
              >>
              >>BTW, Smalltalkers could tell you why Java is not OO !-)[/color]
              >
              >
              > Actually, there is a commonly accepted definition...
              > OO implies:
              > polymorphism, encapsulation, and inheritance.[/color]

              Not so commonly accepted...
              inheritence have two meanings :
              - type/interface inheritence, which is about subtyping
              - implementation inheritence, which is about code reuse

              The first one doesn't make sens in a dynamically-typed language nor in
              statically-typed-with-type-inference language (like OCaml). So it is
              only useful for 'rigidly-typed' languages like Java and C++ - which BTW
              are not 'pure' OOPLs (if this has any meaning) since they have
              'non-object' types.

              The second one is handy for code-reuse but can - and in many cases would
              better - be replaced by composition/delegation.

              Encapsulation largely predates OO and is of common use in procedural
              (never wrote an ADT in C ?) and functional languages (ever heard of
              closures ?).

              Polymorphism is also independant of OO, and exists in procedural and/or
              functional languages too.

              So much for your 'commonly accepted definition', which doesnt define
              anything IMHO : I just can't see how anyone could connect this with the
              concept of objects that did not ever mentionned.

              But dont take it wrong, I agree that these 3 concepts are commonly used
              in OO and do have a meaning in a somewhat wider perspective.

              What strikes me is that you missed the 2 real key points : objects, and
              message passing with dynamic dispatch. OO is mostly and primarily about
              things that we call 'objects' that have state and send messages to each
              others. How some particular object react to a message depends on its
              particular behavior and state.

              And now this brings back the notions of encapsulation (each object carry
              it's own state) and polymorphism (two different object can accept the
              same message, each one reacting in it's own way).

              The concept of 'type' could then be defined by the LSP : two objects
              that accepts the same messages are of the same type. And the notion of
              class could be defined in an almost mathematic way : a class is the set
              of objects that a/ are of the same type and b/ have the same behavior
              (which usually implies having the same internal structure when it comes
              to implementation) .

              Note that inheritance has no particular meaning wrt this definition, and
              so is only a code reuse facility in a dynamically typed language and a
              'necessary evil' (no flame please) to support dynamic dispatch of
              messages (ie polymorphism) in rigidly-typed languages.

              <disclaimer>
              Please note also that I would never pretend this definition being the
              One And Only Revealed Truth(tm) about OO !-)
              <disclaimer/>

              My 2 cents...
              Bruno


              Comment

              • Bruno Desthuilliers

                #22
                Re: Object Oriented PHP vs Java

                Amir Khawaja wrote:[color=blue]
                > Daniel Tryba wrote:
                >[color=green]
                >> Savut <webki@hotmail. com> wrote:
                >>[color=darkred]
                >>> PHP is not fully OO, even the PHP5... but Java is OO[/color]
                >>
                >> But even java isn't fully OO. PHP is OO, just like javascript is OO to
                >> some degree.
                >>[/color]
                >
                > PHP4 has some OOP support. PHP5 has better OOP support. JavaScript is
                > not really OO since it uses anonymous functions to define methods.[/color]

                And ? Why would this make Javascript less OO ?
                (BTW, note that you can also use named functions to define methods).
                [color=blue]
                > Not
                > to mention, inheritance can be tricky in JavaScript.[/color]

                For sure, unless you have a good grasp on prototype-based OOPLs !-).

                But since Javascript is dynamically typed, inheritence is not needed to
                support polymorphism and thus is nothing more than a code-reuse
                facility, so it does not affect the 'OOness' of Javascript IMHO.

                Bruno

                Comment

                • Bruno Desthuilliers

                  #23
                  Re: Object Oriented PHP vs Java

                  Amir Khawaja wrote:[color=blue]
                  > Jerry wrote:
                  >[color=green]
                  >> What are the advantages and disadvantages of using Object Oriented
                  >> PHP vs Java?[/color]
                  >
                  >
                  > If you've ever had training in software development, then you would not
                  > be asking this question.
                  >[/color]
                  A very useful answer. Thanks for your contribution.




                  Comment

                  • Savut

                    #24
                    Re: Object Oriented PHP vs Java

                    Javascript is not at all OO because there is no concept of private and
                    public variable method, metamorphis and object inherence. You guys are real
                    newbs in programming to say so. When I said Java I mean Java like JSP not
                    Javascript.

                    Savut

                    "Bruno Desthuilliers" <bdesth.quelque chose@free.quel quepart.fr> wrote in
                    message news:400fb42b$0 $7152$626a54ce@ news.free.fr...[color=blue]
                    > Amir Khawaja wrote:[color=green]
                    > > Daniel Tryba wrote:
                    > >[color=darkred]
                    > >> Savut <webki@hotmail. com> wrote:
                    > >>
                    > >>> PHP is not fully OO, even the PHP5... but Java is OO
                    > >>
                    > >> But even java isn't fully OO. PHP is OO, just like javascript is OO to
                    > >> some degree.
                    > >>[/color]
                    > >
                    > > PHP4 has some OOP support. PHP5 has better OOP support. JavaScript is
                    > > not really OO since it uses anonymous functions to define methods.[/color]
                    >
                    > And ? Why would this make Javascript less OO ?
                    > (BTW, note that you can also use named functions to define methods).
                    >[color=green]
                    > > Not
                    > > to mention, inheritance can be tricky in JavaScript.[/color]
                    >
                    > For sure, unless you have a good grasp on prototype-based OOPLs !-).
                    >
                    > But since Javascript is dynamically typed, inheritence is not needed to
                    > support polymorphism and thus is nothing more than a code-reuse
                    > facility, so it does not affect the 'OOness' of Javascript IMHO.
                    >
                    > Bruno
                    >[/color]


                    Comment

                    • Jochen Buennagel

                      #25
                      Re: Object Oriented PHP vs Java

                      Savut wrote:
                      [color=blue]
                      > Javascript is not at all OO because there is no concept of private and
                      > public variable method, metamorphis and object inherence.[/color]

                      The only things that you need for OO are objects/classes that can have
                      methods and properties. PHP4 has all those, as does Javascript.

                      (Strictly OT and just out of interest: What are "metamorphi s" and
                      "inherence" ? How do they relate to the concepts of polymorphism and
                      inheritance?)

                      Jochen

                      Comment

                      • Lothar Scholz

                        #26
                        Re: Object Oriented PHP vs Java

                        Amir Khawaja <amir@gorebels. net> wrote in message news:<R9HPb.566 04$zs4.43705@fe d1read01>...[color=blue]
                        > Daniel Tryba wrote:
                        >[color=green]
                        > > Savut <webki@hotmail. com> wrote:
                        > >[color=darkred]
                        > >>PHP is not fully OO, even the PHP5... but Java is OO[/color]
                        > >
                        > >
                        > > But even java isn't fully OO. PHP is OO, just like javascript is OO to
                        > > some degree.
                        > >[/color]
                        >
                        > PHP4 has some OOP support. PHP5 has better OOP support. JavaScript is
                        > not really OO since it uses anonymous functions to define methods. Not
                        > to mention, inheritance can be tricky in JavaScript.[/color]

                        Java Script is has full OO support. Maybe the class less
                        implementation is different then what you think. A system that has
                        more then only OO features can always be called real OO.

                        But 'real' OO is a pure marketing slogan. Maybe pure'ness is far from
                        being a good.

                        Comment

                        • Lothar Scholz

                          #27
                          Re: Object Oriented PHP vs Java

                          "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message news:<buobb9$jt t$1$8300dec7@ne ws.demon.co.uk> ...[color=blue]
                          >
                          > Which is precisely why it was left out of Java, and also left out of PHP 5.
                          >[/color]

                          No because they were to lazy to provide a good multiple inheritance
                          implementation like eiffel has. Java is a hacked language and not
                          technically a good one - no matter how many people use it.

                          Comment

                          • Bruno Desthuilliers

                            #28
                            Re: Object Oriented PHP vs Java

                            Savut wrote:
                            (please don't top-post. Corrected)
                            [color=blue]
                            > "Bruno Desthuilliers" <bdesth.quelque chose@free.quel quepart.fr> wrote in
                            > message news:400fb42b$0 $7152$626a54ce@ news.free.fr...
                            >[color=green]
                            >>Amir Khawaja wrote:
                            >>[color=darkred]
                            >>>Daniel Tryba wrote:
                            >>>
                            >>>
                            >>>>Savut <webki@hotmail. com> wrote:
                            >>>>
                            >>>>
                            >>>>>PHP is not fully OO, even the PHP5... but Java is OO
                            >>>>
                            >>>>But even java isn't fully OO. PHP is OO, just like javascript is OO to
                            >>>>some degree.
                            >>>>
                            >>>
                            >>>PHP4 has some OOP support. PHP5 has better OOP support. JavaScript is
                            >>>not really OO since it uses anonymous functions to define methods.[/color]
                            >>
                            >>And ? Why would this make Javascript less OO ?
                            >>(BTW, note that you can also use named functions to define methods).
                            >>
                            >>[color=darkred]
                            >>>Not
                            >>>to mention, inheritance can be tricky in JavaScript.[/color]
                            >>
                            >>For sure, unless you have a good grasp on prototype-based OOPLs !-).
                            >>
                            >>But since Javascript is dynamically typed, inheritence is not needed to
                            >>support polymorphism and thus is nothing more than a code-reuse
                            >>facility, so it does not affect the 'OOness' of Javascript IMHO.
                            >>
                            >> Javascript is not at all OO because there is no concept of private and
                            >> public variable method,[/color][/color]

                            You forgot 'protected' !-)

                            But this is *absolutely not* needed for a language to support OO.
                            [color=blue]
                            > metamorphis[/color]

                            Never heard of this word...

                            Oh, you meant "polymorphi sm" ?
                            So you're plain wraong. Javascript support polymorphism, as any
                            dynamically typed OOPL.
                            [color=blue]
                            > and object inherence.[/color]
                            I suppose you mean "inheritanc e" ?

                            Fisrt thing is that Javascript does support inheritence, since in a way
                            that may be somewhat special for someone that doesn't grasp the
                            prototype-based OO paradigm.

                            The second thing is that, except for polymorphism support in
                            'rigidly-typed'[1] languages like C++ or Java, inheritance is by no mean
                            necessary to OO*P* (it's a different thing when it comes to OOA/OOD).

                            [1] which is a shortcut for 'statically typed with no type inference
                            mechanism', not a value judgement.
                            [color=blue]
                            > You guys are real[color=green]
                            >> newbs in programming to say so.[/color][/color]

                            Er... Well, it's true that even if I started programming (for fun) in
                            1990, I'm only a professionnal programmer since late 1999, so one could
                            say I'm still a newbie.

                            Now, on the basis of your writing, I'd suggest that learning more about
                            OO, it's history, and languages like Smalltalk, CLOS, Ruby and Io would
                            be a good idea...
                            [color=blue][color=green]
                            >> When I said Java I mean Java like JSP not
                            >> Javascript.[/color][/color]

                            I use Java and Javascript since 1999, so be assured that I do know the
                            difference between the two languages.

                            Regards
                            Bruno

                            Comment

                            • Erwin Moller

                              #29
                              Re: Object Oriented PHP vs Java

                              Lothar Scholz wrote:
                              [color=blue]
                              > "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message
                              > news:<buobb9$jt t$1$8300dec7@ne ws.demon.co.uk> ...[color=green]
                              >>
                              >> Which is precisely why it was left out of Java, and also left out of PHP
                              >> 5.
                              >>[/color]
                              >
                              > No because they were to lazy to provide a good multiple inheritance
                              > implementation like eiffel has. Java is a hacked language and not
                              > technically a good one - no matter how many people use it.[/color]

                              Lothar,

                              Do you actually use Java?
                              Are you an experienced Javaprogrammer?
                              I ask this because you would be the first person I meet who actually uses
                              Java, understand the language, AND doesn't like it.

                              I heard people complain a lot on a lot of languages, often with good
                              arguments, but the only complaint about Java I heard is a steep
                              learningcurve in the beginning.
                              Most complaint about Java from programmers comes from C++ programmers, who
                              miss their precious functionpointer s.

                              In my opinion Java is a great language, you guessed that probably.

                              I have to admit I do not know eiffel, so maybe you are just completely right
                              and I am wrong. But I just had to make a stand for Java here. :P

                              Regards,
                              Erwin Moller


                              Comment

                              • Erwin Moller

                                #30
                                Re: Object Oriented PHP vs Java

                                Amir Khawaja wrote:
                                [color=blue]
                                > Jerry wrote:
                                >[color=green]
                                >> What are the advantages and disadvantages of using Object Oriented
                                >> PHP vs Java?[/color]
                                >
                                > If you've ever had training in software development, then you would not
                                > be asking this question.
                                >
                                >[/color]

                                Amir,

                                Judging by the number of interesting posts in this thread, I think things
                                might be a bit more complicated.

                                I like this discussion a lot, because I use both languages and like them
                                both.

                                I also find your posting a bit out-of-sync with your (excellent) signature:
                                "Rules are written for those who lack the ability to truly reason, But
                                for those who can, the rules become nothing more than guidelines, And
                                live their lives governed not by rules but by reason."

                                Regards,
                                Erwin Moller

                                Comment

                                Working...