Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 2:42 PM, Eddie Drapkin  wrote:

> autoloading doesn't do anything but follow a set of logic rules to decide
> what file to require, so it doesn't mess with opcode caches at all.


umm.., right, but what do you think happens at the center of that logic ?

require / include calls.

which obviously hits the opcode cache, if one is running.

i did however draw an inaccurate equivalence between dynamic loading and
autoloading, which is a misnomer, since dynamic loading such as
$this->load() in ci must be done explicitly, whereas the autoloader will do
those lookups on your behalf when needed.  its a step beyond $this->load()
really.

essentially all ci is doing for a performance boost is something like this

case 1


case 2 (ci style)


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Eddie Drapkin
autoloading doesn't do anything but follow a set of logic rules to decide
what file to require, so it doesn't mess with opcode caches at all.

On Thu, May 28, 2009 at 4:02 PM, Nathan Nobbe wrote:

> On Thu, May 28, 2009 at 9:25 AM, Tony Marston <
> t...@marston-home.demon.co.uk
> > wrote:
>
> >
> > "Eddie Drapkin"  wrote in message
> > news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com...
> > > There's a huge difference between laziness and opting in to use an
> > > incredibly useful (and easy to properly deploy) feature to save myself
> > > time
> > > so that I can spend more time writing that structured and efficient
> code
> > > of
> > > which you speak.  And the problem with what you're saying is that you
> > > still
> > > have to include 'singleton.php' somewhere in order to call its static
> > > methods,
> >
> > I have a single general purpose include file which autmatically includes
> > all
> > other standard files, so I never have to explicity load my singleton
> class.
> >
> > > and I'd rather just spend 30 minutes writing an autoloader object
> > > and letting it deal with finding any of the classes I use then trying
> to
> > > keep track of legacy code I didn't write and require'ing them all over
> > the
> > > place.
> >
> > I'd rather not waste 30 minutes of my time writing a feature that I don't
> > need.
> >
> > The difference between using and not using the autoload feature does not
> > have any measurable impact on either my development times, nor the
> > execution
> > of my code, so I choose to not use it. That's my choice, and I'm sticking
> > to
> > it.
> >
> > > The way I look at it, if you spend all your time handling things that
> you
> > > could automate - and if written properly, will always work as expected
> > > (it's
> > > called unit testing and debugging) - then you have no time to write
> that
> > > structured and efficient code in order to meet your deadlines! :)
> >
> > Not using autoload does not have any noticeable effect on my deadlines,
> so
> > I
> > have no incentive to use it. Just because you say that I *should* use it
> > carries no weight at all.
>
>
> this simple fact is that autoloading is something anyone can implement
> themselves.  take a look at code igniters $this->load() arrangement.
> basically they do dynamic loading rather than requires, and thats part of
> the reason for the massive performance advantage it has over other
> frameworks.
>
> autoloading is nice because it affords a somewhat standard approach to a
> common issue.  sure, you could do something like ci, but i say why bother,
> why not just use __autoload() and freinds now that php offers it as a
> feature.  then again, if you already have some dynamic loading system, of
> course theres no real call to move to __autoload().  (and of course ci is
> written w/ php4 support in mind, which obviously eliminates __autoload in
> their scenario)
>
> im also skeptical of the advantages dynamic loading offers in systems
> running an opcode cache.  essentially after initially caching a scripts
> opcodes, successive include/require calls are a hit to the cache to see its
> already there.  im sure dynamic loading is offers dramatic performance
> gains
> systems not running opcode caches though.
>
> -nathan
>


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Nathan Nobbe
On Thu, May 28, 2009 at 9:25 AM, Tony Marston  wrote:

>
> "Eddie Drapkin"  wrote in message
> news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com...
> > There's a huge difference between laziness and opting in to use an
> > incredibly useful (and easy to properly deploy) feature to save myself
> > time
> > so that I can spend more time writing that structured and efficient code
> > of
> > which you speak.  And the problem with what you're saying is that you
> > still
> > have to include 'singleton.php' somewhere in order to call its static
> > methods,
>
> I have a single general purpose include file which autmatically includes
> all
> other standard files, so I never have to explicity load my singleton class.
>
> > and I'd rather just spend 30 minutes writing an autoloader object
> > and letting it deal with finding any of the classes I use then trying to
> > keep track of legacy code I didn't write and require'ing them all over
> the
> > place.
>
> I'd rather not waste 30 minutes of my time writing a feature that I don't
> need.
>
> The difference between using and not using the autoload feature does not
> have any measurable impact on either my development times, nor the
> execution
> of my code, so I choose to not use it. That's my choice, and I'm sticking
> to
> it.
>
> > The way I look at it, if you spend all your time handling things that you
> > could automate - and if written properly, will always work as expected
> > (it's
> > called unit testing and debugging) - then you have no time to write that
> > structured and efficient code in order to meet your deadlines! :)
>
> Not using autoload does not have any noticeable effect on my deadlines, so
> I
> have no incentive to use it. Just because you say that I *should* use it
> carries no weight at all.


this simple fact is that autoloading is something anyone can implement
themselves.  take a look at code igniters $this->load() arrangement.
basically they do dynamic loading rather than requires, and thats part of
the reason for the massive performance advantage it has over other
frameworks.

autoloading is nice because it affords a somewhat standard approach to a
common issue.  sure, you could do something like ci, but i say why bother,
why not just use __autoload() and freinds now that php offers it as a
feature.  then again, if you already have some dynamic loading system, of
course theres no real call to move to __autoload().  (and of course ci is
written w/ php4 support in mind, which obviously eliminates __autoload in
their scenario)

im also skeptical of the advantages dynamic loading offers in systems
running an opcode cache.  essentially after initially caching a scripts
opcodes, successive include/require calls are a hit to the cache to see its
already there.  im sure dynamic loading is offers dramatic performance gains
systems not running opcode caches though.

-nathan


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

"Eddie Drapkin"  wrote in message 
news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com...
> There's a huge difference between laziness and opting in to use an
> incredibly useful (and easy to properly deploy) feature to save myself 
> time
> so that I can spend more time writing that structured and efficient code 
> of
> which you speak.  And the problem with what you're saying is that you 
> still
> have to include 'singleton.php' somewhere in order to call its static
> methods,

I have a single general purpose include file which autmatically includes all 
other standard files, so I never have to explicity load my singleton class.

> and I'd rather just spend 30 minutes writing an autoloader object
> and letting it deal with finding any of the classes I use then trying to
> keep track of legacy code I didn't write and require'ing them all over the
> place.

I'd rather not waste 30 minutes of my time writing a feature that I don't 
need.

The difference between using and not using the autoload feature does not 
have any measurable impact on either my development times, nor the execution 
of my code, so I choose to not use it. That's my choice, and I'm sticking to 
it.

> The way I look at it, if you spend all your time handling things that you
> could automate - and if written properly, will always work as expected 
> (it's
> called unit testing and debugging) - then you have no time to write that
> structured and efficient code in order to meet your deadlines! :)

Not using autoload does not have any noticeable effect on my deadlines, so I 
have no incentive to use it. Just because you say that I *should* use it 
carries no weight at all.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> On Thu, May 28, 2009 at 10:53 AM, Tony Marston <
> t...@marston-home.demon.co.uk> wrote:
>
>> "Eddie Drapkin"  wrote in message
>> news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
>> > Your code might not, but you sure do!  Spending all that time writing
>> > require statements = :(
>>
>> If you are too lazy to write "require" statements then you are probably 
>> too
>> lazy to write readable, well structured and efficient code. Besides, I
>> don't
>> use "require" statements, I use
>>$dbobject =& singleton::getInstance('classname');
>>
>> I don't use autoload because *I* want to be in control. I prefer not to
>> rely
>> on automatuic features which may not work as expected.
>>
>> --
>> Tony Marston
>> http://www.tonymarston.net
>> http://www.radicore.org
>>
>> > On Thu, May 28, 2009 at 9:49 AM, Tony Marston
>> > > >> wrote:
>> >
>> >>
>> >>  wrote in message
>> >> news:000e0cd6ad1a9f7d3d046af89...@google.com...
>> >> > Two things:
>> >> >
>> >> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php 
>> >> > instead
>> >> > of
>> >> > foo/bar.php)
>> >> > 2. Look at setting up autoloading so you don't need to manually
>> include
>> >> > anyway. If you're going OOP, autoloading is a must!
>> >>
>> >> I totally disagree. I have been doing OOP with PHP for years, and I 
>> >> have
>> >> never used autoloading. It is just a feature that can be used, misused
>> or
>> >> abused just like any other. I choose not to use it, and my code does 
>> >> not
>> >> suffer in the least!
>> >>
>> >> --
>> >> Tony Marston
>> >> http://www.tonymarston.net
>> >> http://www.radicore.org
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Eddie Drapkin
There's a huge difference between laziness and opting in to use an
incredibly useful (and easy to properly deploy) feature to save myself time
so that I can spend more time writing that structured and efficient code of
which you speak.  And the problem with what you're saying is that you still
have to include 'singleton.php' somewhere in order to call its static
methods, and I'd rather just spend 30 minutes writing an autoloader object
and letting it deal with finding any of the classes I use then trying to
keep track of legacy code I didn't write and require'ing them all over the
place.

The way I look at it, if you spend all your time handling things that you
could automate - and if written properly, will always work as expected (it's
called unit testing and debugging) - then you have no time to write that
structured and efficient code in order to meet your deadlines! :)

On Thu, May 28, 2009 at 10:53 AM, Tony Marston <
t...@marston-home.demon.co.uk> wrote:

> "Eddie Drapkin"  wrote in message
> news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
> > Your code might not, but you sure do!  Spending all that time writing
> > require statements = :(
>
> If you are too lazy to write "require" statements then you are probably too
> lazy to write readable, well structured and efficient code. Besides, I
> don't
> use "require" statements, I use
>$dbobject =& singleton::getInstance('classname');
>
> I don't use autoload because *I* want to be in control. I prefer not to
> rely
> on automatuic features which may not work as expected.
>
> --
> Tony Marston
> http://www.tonymarston.net
> http://www.radicore.org
>
> > On Thu, May 28, 2009 at 9:49 AM, Tony Marston
> >  >> wrote:
> >
> >>
> >>  wrote in message
> >> news:000e0cd6ad1a9f7d3d046af89...@google.com...
> >> > Two things:
> >> >
> >> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead
> >> > of
> >> > foo/bar.php)
> >> > 2. Look at setting up autoloading so you don't need to manually
> include
> >> > anyway. If you're going OOP, autoloading is a must!
> >>
> >> I totally disagree. I have been doing OOP with PHP for years, and I have
> >> never used autoloading. It is just a feature that can be used, misused
> or
> >> abused just like any other. I choose not to use it, and my code does not
> >> suffer in the least!
> >>
> >> --
> >> Tony Marston
> >> http://www.tonymarston.net
> >> http://www.radicore.org
> >>
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston
"Eddie Drapkin"  wrote in message 
news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
> Your code might not, but you sure do!  Spending all that time writing
> require statements = :(

If you are too lazy to write "require" statements then you are probably too 
lazy to write readable, well structured and efficient code. Besides, I don't 
use "require" statements, I use
$dbobject =& singleton::getInstance('classname');

I don't use autoload because *I* want to be in control. I prefer not to rely 
on automatuic features which may not work as expected.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

> On Thu, May 28, 2009 at 9:49 AM, Tony Marston 
> > wrote:
>
>>
>>  wrote in message
>> news:000e0cd6ad1a9f7d3d046af89...@google.com...
>> > Two things:
>> >
>> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead 
>> > of
>> > foo/bar.php)
>> > 2. Look at setting up autoloading so you don't need to manually include
>> > anyway. If you're going OOP, autoloading is a must!
>>
>> I totally disagree. I have been doing OOP with PHP for years, and I have
>> never used autoloading. It is just a feature that can be used, misused or
>> abused just like any other. I choose not to use it, and my code does not
>> suffer in the least!
>>
>> --
>> Tony Marston
>> http://www.tonymarston.net
>> http://www.radicore.org
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Eddie Drapkin
Your code might not, but you sure do!  Spending all that time writing
require statements = :(

On Thu, May 28, 2009 at 9:49 AM, Tony Marston  wrote:

>
>  wrote in message
> news:000e0cd6ad1a9f7d3d046af89...@google.com...
> > Two things:
> >
> > 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of
> > foo/bar.php)
> > 2. Look at setting up autoloading so you don't need to manually include
> > anyway. If you're going OOP, autoloading is a must!
>
> I totally disagree. I have been doing OOP with PHP for years, and I have
> never used autoloading. It is just a feature that can be used, misused or
> abused just like any other. I choose not to use it, and my code does not
> suffer in the least!
>
> --
> Tony Marston
> http://www.tonymarston.net
> http://www.radicore.org
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

 wrote in message 
news:000e0cd6ad1a9f7d3d046af89...@google.com...
> Two things:
>
> 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of
> foo/bar.php)
> 2. Look at setting up autoloading so you don't need to manually include
> anyway. If you're going OOP, autoloading is a must!

I totally disagree. I have been doing OOP with PHP for years, and I have 
never used autoloading. It is just a feature that can be used, misused or 
abused just like any other. I choose not to use it, and my code does not 
suffer in the least!

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread oorza2k5

Two things:

1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of  
foo/bar.php)
2. Look at setting up autoloading so you don't need to manually include  
anyway. If you're going OOP, autoloading is a must!


On May 28, 2009 8:49am, kranthi  wrote:

i never faced such a problem and i can assure you that it will never



happen. try...





main.php




require('second.php');



?>





second.php



test





call main.php via AJAX and see the responseText.



many things can go wrong in your coding. dont come to the conclusion



that this particular thing is not working.





i recommend you firebug firefox adddon (just go to the net tab and you



can see all the details of the communication between client and



server)



and i find it helpful to use a standard javascript(jQuery in my case)



library instead of highly limited plain javascript language





and for you case its difficult to comment without seeing your actual code.





--



PHP General Mailing List (http://www.php.net/)



To unsubscribe, visit: http://www.php.net/unsub.php