SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39
  1. #26
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ASP was history as soon as Microsoft developed C# and ASP.NET, even if you don't like MS or believe that C# is a blatant Java copy its still a pretty good language.

    As for PHP, it would be pretty cool if they could drop the "function" keyword within classes altogether. I'd much rather type:
    PHP Code:
    class MyClass
    {
        static final 
    myMethod()
        {

        }

    Than:

    PHP Code:
    class MyClass
    {
        static final function 
    myMethod()
        {

        }

    But maybe thats just me.

  2. #27
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it me or is PHP 5 more complex and going to require a more advanced coder to code to the new standards and features?
    Garlic bread, I've tasted it, it's the future

  3. #28
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it me or is PHP 5 more complex and going to require a more advanced coder to code to the new standards and features?
    Yes and no. Hopefully what's going to happen as a result of all this new functionality is that people will start publishing well designed PHP classes that make it easy to solve common problems.

    For example PHP's mail() function is easy to use, but the moment you start wanting to add attachments and all the additional stuff, using procedural code all the time can easily take a very skillful coder to get it all right. phpmailer is a PHP 4 mail class that really does make it easy to do everything you'll ever need to with email.

    Writing classes may be something you can find massive tomes about but using classes should be a breeze to anyone who can already get by with functions like mail().

    And hey - don't think you actually have to use all the new OOP features.

  4. #29
    SitePoint Enthusiast BDKR's Avatar
    Join Date
    Sep 2002
    Location
    Clearwater, Florida
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by HarryF
    And hey - don't think you actually have to use all the new OOP features.
    Hey Harry, I agree with you 100% percent. The new capabilities of P5 are awesome. I know there are some I may not use much, but there are others that I will definitely take advantage of.

    I don't want to see the function keyword go away though. :-)

    Cheers,
    BDKR
    If you're not on the gas, you're off the gas!

  5. #30
    SitePoint Enthusiast BDKR's Avatar
    Join Date
    Sep 2002
    Location
    Clearwater, Florida
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DR_LaRRY_PEpPeR

    install PHP Accelerator and you'll probably definitely see it from what i've gathered at their forums. PHPA magnifies any memory problems PHP has (leaks, corruption, etc.). if you leave Apache and PHP run for long enough even without something like PHPA, you will eventually see problems too supposedly. i've seen someone say before that PHP was crashing like crazy (segfaults in the error log) without PHPA or anything. it probably does for a lot of other people too.

    so i guess they need to work on the memory management.
    This is the kind of information I'm looking for. I'm not running PHPA (though I'm thinking about looking into the possibility of one) and was curious under what operating conditions you were seeing stability issues. There are tons of things that affect stability. I've seen two identical boxes (hardware / software / OS) behave very differently for reasons that are beyond me (except that maybe the Super Micro Serverworks Motherboards are garbage!). It's not allways clear what the cause of a problem is.

    Cheers,
    BDKR
    If you're not on the gas, you're off the gas!

  6. #31
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't want to see the function keyword go away though. :-)
    Likewise

    And to be more perverse, I like that variables start with a $ - together with "function" they make PHP code more readable IMO (while in Java I have to play "hunt the method name").

    But that's just me - I see Java coders complain about $ and "function" when they have to use PHP.

    Perhaps an alternative syntax inside classes would be to allow "method" as an alternative to "function"?

  7. #32
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ditto on the $ for variables, it actually makes it much easier to spot variables when you're scanning through some code. As for Java people complaining, I program in Java quite a bit now, and you don't hear me complaining Stop complaining Java people and get a decent editor
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  8. #33
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope, I think we still need the 'function' in classes even with PHP5 - it's all about PHPs unique identity if you see what I mean ?

    We don't want PHP5 just to be 'another Java clone' do we ? I certainly don't anyway.

    Also, yes, PHP5 will be more complex and yes, it'll take longer to develop script; but the bonus is that only people with any half decent design/problem solving skills in the first place will be able to develop PHP to a certain level as expected by our clients.

    So out go the script kiddies for one, and out goes the lazy coders as well - OOP all the way is what we really need for PHP5 - if we want the professional businesses to sit up and recognise that anyway.

    Also, it'll be an assurance for continued development of script the proper way script should be developed.

    Expect an initial skills shortage once PHP5 is released later this year and the uptake increases early next year (2004), but this is a good thing as well, since us developer's can corner the market a bit more; get more cash and recognision as well. 8)

  9. #34
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think "OOP all the way" is the best idea simply becuase it would destroy years of backwards compatibility and result in thousands of developers abandoning PHP simply because PHP so soundly stomped on all their work.

    C++ allows for both procedural and OO coding. And as far as I know it never suffered from it.

  10. #35
    SitePoint Enthusiast BDKR's Avatar
    Join Date
    Sep 2002
    Location
    Clearwater, Florida
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Phil.Roberts
    I don't think "OOP all the way" is the best idea simply becuase it would destroy years of backwards compatibility and result in thousands of developers abandoning PHP simply because PHP so soundly stomped on all their work.

    C++ allows for both procedural and OO coding. And as far as I know it never suffered from it.
    I agree! Going OO all the way narrow focuses the language far too much. Hopefully, php will not devolve into some sort of high level new speak. The fact that 'choice' still remains with P5 is great(!). What does that mean? It means that PHP is not only a great procedural high level scripting language, but also a fantastic high level OO langauge with flexibility above and beyond pure languages.

    So, to the good Doctor Livingston, what is the "...proper way (a) script should be developed"? Lines like this are scary as far as I'm concerned. Even within the boundaries of what a language says is legal, there is a lot of room for variety and expression. Also, within the gray areas of this variety can be suprising optimizations. The greater the number of given options, the greater the number of potential (and legal) amalgamations of these options.

    At one level, this is what writing code is all about. If it's something that is too be strictly controlled all the time, then there is no more joy in coding as we are all reduced to the level of code monkeys slaving away without any input from the creative sides of our brains.

    Cheers,
    BDKR
    If you're not on the gas, you're off the gas!

  11. #36
    SitePoint Enthusiast BDKR's Avatar
    Join Date
    Sep 2002
    Location
    Clearwater, Florida
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    So out go the script kiddies for one, and out goes the lazy coders as well - OOP all the way is what we really need for PHP5 - if we want the professional businesses to sit up and recognise that anyway.
    Not to be too overbearing, but let me ask if OO is a good fit in this particular scenario.

    I run a cluster. The cluster managers are aware of the state of machines in the cluster. There is a transaction pool, a web pool, and a database pool. The database pool works in a fail over manner. All the transaction and web servers speak to one primary database. There are also slave databases that replicate from that master db.

    That said, if the primary database fails, the cluster manager senses this and sends a message to one of the slaves telling it to become the master. I wrote the piece of glue that sends this message to the database that is to become the master in PHP. It didn't need to do much or be much. Here it is:

    PHP Code:
    <?
    # Let's check the arguments before sending the command to the server
    if($_SERVER['argc']===4)
        { 
        
    $arg1=$_SERVER['argv'][1];
        
    $arg2=$_SERVER['argv'][2];
        
    $arg3=$_SERVER['argv'][3];
        }
    else
        {
        echo 
    "Didn't get the correct number of arguments!\n";
        exit;
        }


    $fp=fsockopen("$arg1"$arg2$errno$errstr10);
    if(!
    $fp
        { echo 
    "$errstr ($errno)"; } 
    else 
        {
        echo 
    "We connected\n";
      while(!
    feof($fp))
            { 
            
    $intake=fread($fp,5); 
            if(
    $intake=='Hello')
                {
                echo 
    "Got the acknowledgement: writing to socket\n";
                
    fputs($fp"/$arg3"); 
                
    fclose($fp);
                break;
                }
            }        
        }
    ?>
    Do you think I should've taken an OO approach for this? Methinks it would've been some serious overkill to use objects for this.

    Don't get me wrong, OO is awesome, but let's not make an idol out of it.

    Cheers,
    BDKR
    If you're not on the gas, you're off the gas!

  12. #37
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I wouldn't. That's looks fine the way it is. I only use objects for things that will either be used regularl or for a number of functions that are related.

  13. #38
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OOP has a place, and is a great idea, but it's not a replacement for procedural code, just an expansion. Both are useful in different situations, and I use both extensively.

    PHP5 will bring a ton of features I will use, without taking away any that I already like, what more can you ask for? It's awesome.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  14. #39
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by cyborg from dh
    PHP5 will bring a ton of features I will use, without taking away any that I already like, what more can you ask for? It's awesome.
    I couldn't agree more


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •