What's wrong the __autoload()? - PHP

This is a discussion on What's wrong the __autoload()? - PHP ; Greg Donald wrote: > On 3/12/08, Richard Heyes <richardh@phpguru.org> wrote: >> That's not quite the situation. Finding good developers isn't easy, so >> lots of companies will go for "acceptable" ones, who are less likely to >> know of __autoloads ...

+ Reply to Thread
Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 46

What's wrong the __autoload()?

  1. Default Re: [PHP] What's wrong the __autoload()?

    Greg Donald wrote:
    > On 3/12/08, Richard Heyes <richardh@phpguru.org> wrote:
    >> That's not quite the situation. Finding good developers isn't easy, so
    >> lots of companies will go for "acceptable" ones, who are less likely to
    >> know of __autoloads existence. Hence, using __autoload is unwise.

    >
    > A lesser developer should be paid less and should be expected to
    > produce less but he should not in any way be allowed to refrain from
    > learning.


    I agree. But having worked in the (then) fast paced environment of
    online DVD rental, time was not available.

    > How long does it take to understand __autoload() anyway? 5-10
    > minutes?


    I would say as long as it takes to read the manual page, which isn't
    that long at all.

    > You're
    > gonna restrict the entire development team from using a given feature
    > just because you don't want to invest 20 minutes in getting your
    > newbie developer up to spead? That's pure idiocy.


    No it's not. It's not like require_once() is a hassle to type/use
    anyhow. Things like editor macros and templates help out enormously and
    by using them over __auto load you (a business) could save yourself a
    lot of time and hence money.

    --
    Richard Heyes
    Employ me:
    http://www.phpguru.org/cv

  2. Default Re: [PHP] What's wrong the __autoload()?

    On 3/12/08, Zoltán Németh <znemeth@alterationx.hu> wrote:
    > but I strongly think that Ruby as a
    > language just plain sucks


    And exactly how many projects do you have under your belt to allow you
    to develop this opinion? What's the url to any one of them?

    Unlike you I actually have thousands of lines of Ruby code under my
    belt that allows me to properly develop an opinion of Ruby and Rails
    and how they both compare to every other programming language and
    framework I know and have developed in. Need a URL?


    --
    Greg Donald
    http://destiney.com/

  3. Default Re: [PHP] What's wrong the __autoload()?

    On 3/12/08, Richard Heyes <richardh@phpguru.org> wrote:
    > No it's not. It's not like require_once() is a hassle to type/use
    > anyhow. Things like editor macros and templates help out enormously and
    > by using them over __auto load you (a business) could save yourself a
    > lot of time and hence money.


    I'm not defending __autoload() specifically, I don't do much OO PHP
    anyway so I couldn't possibly care less about it. My argument is that
    asking other developers to not use specific language features simply
    because lesser developers may not know them very well is just plain
    dumb. I'm sorry you don't get it and I'm done trying to help you get
    it. Good luck codling your lesser developers. May they never learn
    jack on their own.

    *sigh*


    --
    Greg Donald
    http://destiney.com/

  4. Default Re: [PHP] What's wrong the __autoload()?

    2008. 03. 12, szerda keltezéssel 12.12-kor Greg Donald ezt írta:
    > On 3/12/08, Zoltán Németh <znemeth@alterationx.hu> wrote:
    > > but I strongly think that Ruby as a
    > > language just plain sucks

    >
    > And exactly how many projects do you have under your belt to allow you
    > to develop this opinion? What's the url to any one of them?
    >
    > Unlike you I actually have thousands of lines of Ruby code under my
    > belt that allows me to properly develop an opinion of Ruby and Rails
    > and how they both compare to every other programming language and
    > framework I know and have developed in. Need a URL?


    ok, I admit I don't have experience with Ruby but I have experience with
    php. and I don't have experience with Ruby because I read some manuals
    and example codes and whatnot and I just could not get to like it at
    all. it's just so strange and different from anything I know (php, c,
    java) - and I could not find out any good reasons for most of the
    differences... e.g. how come function definitions are between 'def' and
    'end'? I just don't like it and it's a matter of taste, so there is no
    need to argue about it more...

    however that's not about the framework, I admit that Rails had several
    new and useful concepts, and I know that the framework I currently use
    took a lot of ideas from there.

    greets,
    Zoltán Németh

    >
    >
    > --
    > Greg Donald
    > http://destiney.com/
    >



  5. Default Re: [PHP] What's wrong the __autoload()?

    On 3/12/08, Zoltán Németh <znemeth@alterationx.hu> wrote:
    > ok, I admit I don't have experience with Ruby but I have experience with
    > php. and I don't have experience with Ruby because I read some manuals
    > and example codes and whatnot and I just could not get to like it at
    > all.


    That's a lot different from your previous blanket statement of "Ruby
    as a language just plain sucks". I hate you less now that I know a
    bit more about you, see how that works?

    > it's just so strange and different from anything I know (php, c,
    > java) -


    Ruby has a lot of functional language influence. Once you use it you
    really start to like how much shorter your iterative loops are for
    example. The first two developers I worked with using Ruby also knew
    ML and Scheme. One of them suggested I go study Scheme so I would
    appreciate Ruby more. I did so for several weeks and now I do. Ruby
    provides everything from the procedural world we're currently used to
    seeing in PHP, C, and Java, but it also adds functional style that
    makes for some utterly beautiful, compact code.

    > and I could not find out any good reasons for most of the
    > differences...


    And you won't until you use it in practice more than once. But that's
    true of most any language. I worked in Python by day for the better
    part of last year and man was it fun seeing other ideas for how to do
    things.

    > e.g. how come function definitions are between 'def' and
    > 'end'?


    def is shorter than PHP's "function" qualifier? I give up. 'end' is
    optionally replacable with '}', as is 'do' and '{' but you probably
    didn't ever get to that page in the Ruby book you read.

    > I just don't like it and it's a matter of taste,


    In my experience "matter of taste" usually equates to "resistance to
    learning", but call it what you will.

    > so there is no
    > need to argue about it more...


    There's always reason to argue the features of a given language. For
    example you may need to try and convince me at some point that Zombie
    is a great language:

    http://www.dangermouse.net/esoteric/zombie.html

    Or not.

    > however that's not about the framework, I admit that Rails had several
    > new and useful concepts, and I know that the framework I currently use
    > took a lot of ideas from there.


    Those other frameworks can never be as powerful as Rails because they
    aren't written in something as meta-capable as Ruby. Can you do this
    in PHP?

    class Foo
    end

    f = Foo.new

    class Foo
    Resource.find( :all ).each do |r|
    res = r.name.downcase
    define_method( "op_cost_#{ res }".to_sym ) do
    self.properties.inject( 0 ){ |c,p| c + p.send( "op_cost_#{ res }" ) }
    end
    end
    end

    cost = f.op_cost_wheat

    No you can't. PHP doesn't support adding methods to classes at
    runtime, nor does it support adding methods to instantiated objects of
    those classes at runtime. And that's just one example. These sort of
    OO advantages exist throughout Ruby.

    You don't love these features because you don't know they exist. You
    don't know they exist because you haven't given the language more than
    a few minutes of your time. Running through some silly little 5
    minute Rails scaffolding tutorial will in no way teach you the real
    power that exists in Ruby.


    --
    Greg Donald
    http://destiney.com/

  6. Default Re: [PHP] What's wrong the __autoload()?

    2008. 03. 12, szerda keltezéssel 13.27-kor Greg Donald ezt írta:
    > On 3/12/08, Zoltán Németh <znemeth@alterationx.hu> wrote:
    > > ok, I admit I don't have experience with Ruby but I have experience with
    > > php. and I don't have experience with Ruby because I read some manuals
    > > and example codes and whatnot and I just could not get to like it at
    > > all.

    >
    > That's a lot different from your previous blanket statement of "Ruby
    > as a language just plain sucks". I hate you less now that I know a
    > bit more about you, see how that works?


    didn't you notice the smiley at the end of that line? that was not a
    serious plain statement but some mocking at you because you made a plain
    statement about RoR being better.

    >
    > > it's just so strange and different from anything I know (php, c,
    > > java) -

    >
    > Ruby has a lot of functional language influence. Once you use it you
    > really start to like how much shorter your iterative loops are for
    > example. The first two developers I worked with using Ruby also knew
    > ML and Scheme. One of them suggested I go study Scheme so I would
    > appreciate Ruby more. I did so for several weeks and now I do. Ruby
    > provides everything from the procedural world we're currently used to
    > seeing in PHP, C, and Java, but it also adds functional style that
    > makes for some utterly beautiful, compact code.


    'utterly beautiful' is again a matter of taste
    of course, I admit that Ruby would provide me all the features I
    currently use, it has to, otherwise noone would start using it instead
    of their current language. and yes, I see from the examples that it is
    shorter. but is shortness/compactness such a great advantage? I'm not at
    all sure about that.

    >
    > > and I could not find out any good reasons for most of the
    > > differences...

    >
    > And you won't until you use it in practice more than once. But that's
    > true of most any language. I worked in Python by day for the better
    > part of last year and man was it fun seeing other ideas for how to do
    > things.


    that might be true, but in the last year I've been working on the same
    big project, and it seems I will be working on it for this year too, you
    know, next versions and such, so at this moment I don't have serious
    amount of time to experiment with anything. in fact, I'm also a bit
    workaholic and also I'm attending some evening university so I hardly
    have time to read a manual completely...

    >
    > > e.g. how come function definitions are between 'def' and
    > > 'end'?

    >
    > def is shorter than PHP's "function" qualifier? I give up. 'end' is
    > optionally replacable with '}', as is 'do' and '{' but you probably
    > didn't ever get to that page in the Ruby book you read.


    as I said above, I had/have not much time, so my reading might have been
    sloppy... and is shortness that important?

    >
    > > I just don't like it and it's a matter of taste,

    >
    > In my experience "matter of taste" usually equates to "resistance to
    > learning", but call it what you will.


    well, there is difference between that. its like if you have a very
    limited time frame you can spend on learning, you choose to learn more
    of something you like already, no? sure, if I had more time, I would
    experiment more with things I don't like or I don't know really.

    >
    > > so there is no
    > > need to argue about it more...

    >
    > There's always reason to argue the features of a given language. For
    > example you may need to try and convince me at some point that Zombie
    > is a great language:
    >
    > http://www.dangermouse.net/esoteric/zombie.html
    >
    > Or not.




    >
    > > however that's not about the framework, I admit that Rails had several
    > > new and useful concepts, and I know that the framework I currently use
    > > took a lot of ideas from there.

    >
    > Those other frameworks can never be as powerful as Rails because they
    > aren't written in something as meta-capable as Ruby. Can you do this
    > in PHP?
    >
    > class Foo
    > end
    >
    > f = Foo.new
    >
    > class Foo
    > Resource.find( :all ).each do |r|
    > res = r.name.downcase
    > define_method( "op_cost_#{ res }".to_sym ) do
    > self.properties.inject( 0 ){ |c,p| c + p.send( "op_cost_#{ res }" ) }
    > end
    > end
    > end
    >
    > cost = f.op_cost_wheat
    >
    > No you can't. PHP doesn't support adding methods to classes at
    > runtime, nor does it support adding methods to instantiated objects of
    > those classes at runtime. And that's just one example. These sort of
    > OO advantages exist throughout Ruby.
    >
    > You don't love these features because you don't know they exist. You
    > don't know they exist because you haven't given the language more than
    > a few minutes of your time. Running through some silly little 5
    > minute Rails scaffolding tutorial will in no way teach you the real
    > power that exists in Ruby.


    hmm that feature looks interesting, however I can't really think of a
    case where I would want to modify the class definition of an
    instantiated object.... maybe later, when I'll have some more time I
    give Ruby a second run, and we'll see what comes out of that.

    greets,
    Zoltán Németh

    >
    >
    > --
    > Greg Donald
    > http://destiney.com/
    >



  7. Default Re: [PHP] What's wrong the __autoload()?

    On 3/12/08, Zoltán Németh <znemeth@alterationx.hu> wrote:
    > I can't really think of a
    > case where I would want to modify the class definition of an
    > instantiated object....


    You can't very well think to walk if you don't have legs.


    --
    Greg Donald
    http://destiney.com/

  8. Default Re: [PHP] What's wrong the __autoload()?

    On 3/12/08, Robert Cummings <robert@interjinn.com> wrote:
    > You make it sound like this stuff is new or something.


    Obviously to some it is. Just in this thread we had a person claim to
    only know PHP, C, and Java, none of which have any functional language
    capabilities built in.

    > Lisp and other
    > functional languages have had it for decades. Even JavaScript has it.


    I'm sorry, I lost context, what missing PHP language feature are you
    referring to as "it"?

    > Your ****ogy is also way off... ask any person without legs if they
    > think about walking.


    Here, let me dumb-it-down a bit:

    PHP doesn't have much in the way of meta-programming capabilities.
    Therefore one would not find it a natural thought to do much
    meta-programming in PHP, unless one already knew of a language where
    such support exists.

    A different example using the same logic: My Mustang doesn't have
    4-wheel drive so I don't often think much about taking it through the
    creeks and woods by my house like my old man and I do in his Bronco
    that does have 4-wheel drive. A person who has never climbed a really
    steep hill or ran through a waist-high creek in a 4-wheel drive auto
    might think such a thing impossible if they were unaware of 4-wheel
    drive.


    --
    Greg Donald
    http://destiney.com/

  9. Default Re: [PHP] What's wrong the __autoload()?

    Greg Donald wrote:
    > Here, let me dumb-it-down a bit:
    >
    > PHP doesn't have much in the way of meta-programming capabilities.
    > Therefore one would not find it a natural thought to do much
    > meta-programming in PHP, unless one already knew of a language where
    > such support exists.
    >
    > A different example using the same logic: My Mustang doesn't have
    > 4-wheel drive so I don't often think much about taking it through the
    > creeks and woods by my house like my old man and I do in his Bronco
    > that does have 4-wheel drive. A person who has never climbed a really
    > steep hill or ran through a waist-high creek in a 4-wheel drive auto
    > might think such a thing impossible if they were unaware of 4-wheel
    > drive.


    LOL.... well said.

    Aschwin Wesselius


  10. Default Re: [PHP] What's wrong the __autoload()?

    On Wed, Mar 12, 2008 at 3:59 PM, Greg Donald <gdonald@gmail.com> wrote:

    > > Lisp and other
    > > functional languages have had it for decades. Even JavaScript has it.

    >
    > I'm sorry, I lost context, what missing PHP language feature are you
    > referring to as "it"?



    functional capabilities, in particular the ability to dynamically add a
    method to an object at runtime which you highlighted earlier.

    -nathan


+ Reply to Thread
Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast