Announcement

Collapse
No announcement yet.

PHP As A Next-Generation Programming Language?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #51
    5 minuted:

    Something like Hack needed to be done, but also to completely disregard the whole execute entire script on load concept. It needs to go. If you have an actual application that responds and can manage it's own variables that will inherently perform much better because on top of it not having to constantly compile code it simply runs the relevant sections of code that a programmer can designate. Something like

    Code:
    <?php
    
    class my_application : web_handler {
    function handle($request, $response) {
    $response->write_head(200); // 200 by default, this is just an example, the write method could detect if the header was written and if not it could write 200 automatically
    $response->write("HI, YOU SENT THE POST PARAMETER" . $request->post["post_parameter"]);
    // if the request is still open the server could close it after it returns
    }
    }
    
    ?>
    apologies for the formatting but I wrote it in this editor. It's not pretty (and not necessarily valid PHP because I haven't touched PHP in a while) but it's not unachievable and you probably understand what I mean. Use non-blocking IO for the write stuff (hence why it calls a method instead of returning a response). You could even alias $response->write to something, but that model of programming needs to happen because at the moment PHP does not scale well. HHVM is a gigantic hack that fixes that issue for Facebook, but it's not entirely practical right now and it's not part of the official PHP stuff. I'm not taking anything away from HHVM, I'm just saying that it has to deal with that stuff for compatibility.

    PHP needs to have a request / response system with a half-decent standard library, otherwise it will continue to suck, period.

    You could even adopt HHVM and apply those principles to it, and it would be significantly better. Also, disable arbitrary string stuff in the MySQL(i) modules and only allow prepared statements and make a HUGE deal about how important they are.
    Last edited by jimbohale; 07 October 2014, 11:24 PM.

    Comment


    • #52
      Originally posted by jimbohale View Post
      5 minuted:

      Something like Hack needed to be done, but also to completely disregard the whole execute entire script on load concept. It needs to go. If you have an actual application that responds and can manage it's own variables that will inherently perform much better because on top of it not having to constantly compile code it simply runs the relevant sections of code that a programmer can designate.
      Isn't that the job of an opcode cache?
      APC module is pretty standard and stable from long time now and does exactly that: avoid the recompilation of the script on each request. Now there's the new Zend OPCode cache, but I don't now details and benchmarks about it.

      Comment


      • #53
        Originally posted by jimbohale View Post
        Again, <?php echo "HELLO"; ?> can't handle more than like 100 requests a second on a decent server (quad core xeon w/ hyperthreadding, much RAM).
        Dude, you are either lying out of hatred or you aren't capable of properly configuring a server, on my small arm exynos quad core machine PHP hello world can serve more than 1000 requests per second... and thats arm... x86 should go much faster...

        Comment


        • #54
          Originally posted by Cyber Killer View Post
          The day when python or ruby can be ran as fastcgi on nginx or lighttpd instead of implementing their own webservers and running through proxy_pass + will use the system provided libs instead of having their own repositories is the day we can start considering them as replacements for php on the popular web.




          Ummm... It's already a known thing how to do it. Flup FastCGI Support has been around for a LONG time. I'm confused by the second thing entirely. Django makes sure to support I believe all supported versions in the repositories of RHEL.

          Comment


          • #55
            Originally posted by blackshard View Post
            Oh god, no... python has the same pitfalls php has and many more. It's a nice language and has nice feature and data handling, but in my opinion it is completely unsuitable for large cooperative projects due to its characteristics (duck typing, dynamically and strongly typed). Also PHP is born to be used as a template language, python isn't at all.
            So here's the difference. In the C or Java world, you know your code is good because "it compiled". If you're good, you may have written a couple tests that are most likely completely inadequate to prove it works and find anything but the most rudimentary issues.

            In Python, you'll notice most library tutorials teach you to write decent tests to test your code and point you to using a code coverage tool (typically https://pypi.python.org/pypi/coverage) to know that you have good coverage of what your code does. Is it perfect, no. Is it better than "it compiled"... YES. A good project will also add a regression test for every bug that is written against it.

            Comment


            • #56
              Originally posted by JoeTennies View Post
              So here's the difference. In the C or Java world, you know your code is good because "it compiled". If you're good, you may have written a couple tests that are most likely completely inadequate to prove it works and find anything but the most rudimentary issues.

              In Python, you'll notice most library tutorials teach you to write decent tests to test your code and point you to using a code coverage tool (typically https://pypi.python.org/pypi/coverage) to know that you have good coverage of what your code does. Is it perfect, no. Is it better than "it compiled"... YES. A good project will also add a regression test for every bug that is written against it.
              You can do unit tests, coverage analysis and regression tests for C and Java too. I don't see the point.

              Comment


              • #57
                Originally posted by blackshard View Post
                Oh god, no... python has the same pitfalls php has and many more. It's a nice language and has nice feature and data handling, but in my opinion it is completely unsuitable for large cooperative projects due to its characteristics (duck typing, dynamically and strongly typed).
                Why, exactly, does that make it "completely unsuitable for large cooperative projects"?

                Comment


                • #58
                  Originally posted by TheBlackCat View Post
                  Why, exactly, does that make it "completely unsuitable for large cooperative projects"?
                  Premise: for large cooperative project I intend large corporative project where 10 or more developers work on it, and not some open source project living on github where x people sometimes commit something.

                  So said, since python, by design, lacks a "rigid" object oriented paradigm and encapsulation in favor of duck typing, looks to me more prone to misbehaving bugs due to scope and inheritance overlapping of attributes, runtime errors due to dynamic typing.

                  Comment

                  Working...
                  X