I couldn't understand why PHP is so popular. The PHP code looks sohorrible compared with Java.

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

    #16
    Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.

    On Tue, 29 Apr 2008 08:14:33 +0000, Kim André Akerø wrote:
    tenxian wrote:
    >
    >Could you put up with the horrible PHP code?
    Horrible code comes in all languages.
    Yes, I can. PHP is a language that's easy to learn and easy to use,
    which is why so many choose to use it.
    Actually I chose it because it's cross-platform, stable, powerful, tried
    and tested and specifically designed to do what I'm doing with it. I'd
    like to see where you collected your statistical data on PHP adoption.
    IMO, it's not much more horrible than C++ or Java; it all depends on the
    programmer who makes use of it.
    My PHP code is pretty... as is my C++ code.

    Blame the Indian not the arrows.

    --
    "Remain calm, we're here to protect you!"

    Comment

    • ZeldorBlat

      #17
      Re: I couldn't understand why PHP is so popular. The PHP code looksso horrible compared with Java.

      On Apr 29, 9:43 am, Captain Paralytic <paul_laut...@y ahoo.comwrote:
      >
      Wow, I never realised you could do Hello World without instantiating a
      custom class.
      You mean like this?

      public interface MessageStrategy {
      public void sendMessage();
      }

      public abstract class AbstractStrateg yFactory {
      public abstract MessageStrategy createStrategy( MessageBody mb);
      }

      public class MessageBody {
      Object payload;

      public Object getPayload() {
      return payload;
      }

      public void configure(Objec t obj) {
      payload = obj;
      }

      public void send(MessageStr ategy ms) {
      ms.sendMessage( );
      }
      }

      public class DefaultFactory extends AbstractStrateg yFactory {
      private DefaultFactory( ) {}

      static DefaultFactory instance;

      public static AbstractStrateg yFactory getInstance() {
      if (null==instance )
      instance = new DefaultFactory( );
      return instance;
      }

      public MessageStrategy createStrategy( final MessageBody mb) {
      return new MessageStrategy () {
      MessageBody body = mb;

      public void sendMessage() {
      Object obj = body.getPayload ();
      System.out.prin tln(obj.toStrin g());
      }
      };
      }
      }

      public class HelloWorld {
      public static void main(String[] args) {
      MessageBody mb = new MessageBody();
      mb.configure("H ello World!");
      AbstractStrateg yFactory asf = DefaultFactory. getInstance();
      MessageStrategy strategy = asf.createStrat egy(mb);
      mb.send(strateg y);
      }
      }

      Comment

      • Erwin Moller

        #18
        Re: I couldn't understand why PHP is so popular. The PHP code looksso horrible compared with Java.

        ZeldorBlat schreef:
        On Apr 29, 9:43 am, Captain Paralytic <paul_laut...@y ahoo.comwrote:
        >Wow, I never realised you could do Hello World without instantiating a
        >custom class.
        >
        You mean like this?
        >
        public interface MessageStrategy {
        public void sendMessage();
        }
        >
        public abstract class AbstractStrateg yFactory {
        public abstract MessageStrategy createStrategy( MessageBody mb);
        }
        >
        public class MessageBody {
        Object payload;
        >
        public Object getPayload() {
        return payload;
        }
        >
        public void configure(Objec t obj) {
        payload = obj;
        }
        >
        public void send(MessageStr ategy ms) {
        ms.sendMessage( );
        }
        }
        >
        public class DefaultFactory extends AbstractStrateg yFactory {
        private DefaultFactory( ) {}
        >
        static DefaultFactory instance;
        >
        public static AbstractStrateg yFactory getInstance() {
        if (null==instance )
        instance = new DefaultFactory( );
        return instance;
        }
        >
        public MessageStrategy createStrategy( final MessageBody mb) {
        return new MessageStrategy () {
        MessageBody body = mb;
        >
        public void sendMessage() {
        Object obj = body.getPayload ();
        System.out.prin tln(obj.toStrin g());
        }
        };
        }
        }
        >
        public class HelloWorld {
        public static void main(String[] args) {
        MessageBody mb = new MessageBody();
        mb.configure("H ello World!");
        AbstractStrateg yFactory asf = DefaultFactory. getInstance();
        MessageStrategy strategy = asf.createStrat egy(mb);
        mb.send(strateg y);
        }
        }
        LOL.
        ;-)

        Good job. :P

        Erwin Moller

        Comment

        • ZeldorBlat

          #19
          Re: I couldn't understand why PHP is so popular. The PHP code looksso horrible compared with Java.

          On Apr 29, 1:03 pm, Erwin Moller
          <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
          ZeldorBlat schreef:
          >
          >
          >
          On Apr 29, 9:43 am, Captain Paralytic <paul_laut...@y ahoo.comwrote:
          Wow, I never realised you could do Hello World without instantiating a
          custom class.
          >
          You mean like this?
          >
          public interface MessageStrategy {
          public void sendMessage();
          }
          >
          public abstract class AbstractStrateg yFactory {
          public abstract MessageStrategy createStrategy( MessageBody mb);
          }
          >
          public class MessageBody {
          Object payload;
          >
          public Object getPayload() {
          return payload;
          }
          >
          public void configure(Objec t obj) {
          payload = obj;
          }
          >
          public void send(MessageStr ategy ms) {
          ms.sendMessage( );
          }
          }
          >
          public class DefaultFactory extends AbstractStrateg yFactory {
          private DefaultFactory( ) {}
          >
          static DefaultFactory instance;
          >
          public static AbstractStrateg yFactory getInstance() {
          if (null==instance )
          instance = new DefaultFactory( );
          return instance;
          }
          >
          public MessageStrategy createStrategy( final MessageBody mb) {
          return new MessageStrategy () {
          MessageBody body = mb;
          >
          public void sendMessage() {
          Object obj = body.getPayload ();
          System.out.prin tln(obj.toStrin g());
          }
          };
          }
          }
          >
          public class HelloWorld {
          public static void main(String[] args) {
          MessageBody mb = new MessageBody();
          mb.configure("H ello World!");
          AbstractStrateg yFactory asf = DefaultFactory. getInstance();
          MessageStrategy strategy = asf.createStrat egy(mb);
          mb.send(strateg y);
          }
          }
          >
          LOL.
          ;-)
          >
          Good job. :P
          >
          Erwin Moller
          Sorry, I should have included my source:

          <http://ask.slashdot.or g/comments.pl?sid =250311&cid=198 62863>

          Somebody else referred to that as the "Gang of Four Job Security
          Strategy" pattern.

          Comment

          • Peter H. Coffin

            #20
            Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.

            On Tue, 29 Apr 2008 09:54:07 -0700 (PDT), ZeldorBlat wrote:
            On Apr 29, 9:43 am, Captain Paralytic <paul_laut...@y ahoo.comwrote:
            >>
            >Wow, I never realised you could do Hello World without instantiating a
            >custom class.
            >
            You mean like this?
            >
            public interface MessageStrategy {
            public void sendMessage();
            }
            >
            public abstract class AbstractStrateg yFactory {
            public abstract MessageStrategy createStrategy( MessageBody mb);
            }
            Ah, now THAT looks like some of the stuff some coworkers turn out...
            (;

            --
            19. I will not have a daughter. She would be as beautiful as she was evil, but
            one look at the hero's rugged countenance and she'd betray her own father.
            --Peter Anspach's list of things to do as an Evil Overlord

            Comment

            • Rik Wasmus

              #21
              Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.

              On Tue, 29 Apr 2008 08:00:47 +0200, tenxian <hi.steven.tu@g mail.comwrote:
              Could you put up with the horrible PHP code?
              I think we missed something guys. He says 'the PHP code is horrible', not
              'PHP code is horrible'. Now, if someone would like to point me to the
              source of the JRE, maybe we can get somewhere...
              --
              Rik Wasmus

              Comment

              • tenxian

                #22
                Re: I couldn't understand why PHP is so popular. The PHP code looksso horrible compared with Java.

                On Apr 30, 1:29 am, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
                On Tue, 29 Apr 2008 08:00:47 +0200, tenxian <hi.steven...@g mail.comwrote:
                Could you put up with the horrible PHP code?
                >
                I think we missed something guys. He says 'the PHP code is horrible', not
                'PHP code is horrible'. Now, if someone would like to point me to the
                source of the JRE, maybe we can get somewhere...
                --
                Rik Wasmus
                PHP code is horrible. Don't get me wrong.

                Comment

                • Jerry Stuckle

                  #23
                  Re: I couldn't understand why PHP is so popular. The PHP code looksso horrible compared with Java.

                  tenxian wrote:
                  On Apr 30, 1:29 am, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
                  >On Tue, 29 Apr 2008 08:00:47 +0200, tenxian <hi.steven...@g mail.comwrote:
                  >>Could you put up with the horrible PHP code?
                  >I think we missed something guys. He says 'the PHP code is horrible', not
                  >'PHP code is horrible'. Now, if someone would like to point me to the
                  >source of the JRE, maybe we can get somewhere...
                  >--
                  >Rik Wasmus
                  >
                  PHP code is horrible. Don't get me wrong.
                  >
                  Not at all. Horrible programmers write horrible code in any language.
                  Good programmers write good code in any language.

                  Your prejudice is showing.

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

                  Comment

                  Working...