Re: Take over of package Services_Webservice
| From: | Michael Camden | Date: | Thu, 17 Dec 2009 02:17:18 +0000 |
| Subject: | Re: Take over of package Services_Webservice | ||
| References: | 1 2 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-5551@lists.php.net to get a copy of this message | ||
Hello Matthew,
There are two changes to the code that I wanted to address in turn.
First however, let me say thank you for producing the code in the
first place. When I set out to create my first PHP SOAP server, I was
mortified to find out that I may have to write my own WSDL file. I
was, needless to say, extremely happy to find your code.
1. while/list/each vs foreach. Foreach's default operation is to
copy in to memory the array that is passed to it, and work with that
copied array within the loop. The speed difference between
while/list/each and foreach with smaller arrays is negligible, however
as the array gets larger the difference in speed becomes more clear.
It is absolutely easier to understand a foreach rather then a
while/list/each loop. The website you posted,
http://www.php.lt/benchmark/phpbench.php,
only seems to confirm that
while/list/each is faster then foreach. In the first section, the
tests use the same set of data. Tests 2, 4, and 6 complete within 3,
15, and 9ms respectively. The foreach mirror of those tests 1, 3, 5
complete in 6, 21, and 10ms respectively.
1a. Speaking of loops. I've also modified a couple of for loops to
remove the count from the loop definition. When writing for loops, if
you include the count($array) within the loop definition, then each
iteration recalculates the length of the array. This is also confirmed
in the third section of the website you have provided.
2. The other modification to the class I made, was to address bug
#15221. I set the value, formatOutput to true for the DOMDocument
objects. It adds the proper spacing, tabbing and new lines to the
outputted document.
I think that you idea of creating a service to automate the creation
of RESTful services would be very interesting. Were you thinking for
example,
http://www.example.com/parts
When viewed as such would return the standard view displaying a list
of parts for the user.
http://www.example.com/parts/?xml
Would produce the list of parts, but in an XML feed
http://www.example.com/parts/?json
Would produce the list of parts, but in javascript object notation.
If you were, I think it would remove a lot of clutter involved in back
end functions to support that. You mentioned that you may need help
with that, and as I have very few ideas of my own to work on
currently, I would love to assist.
Best regards,
Michael
On Wed, Dec 16, 2009 at 5:40 PM, Matthew Fonda <matthewfonda@gmail.com> wrote:
> On Wed, Dec 16, 2009 at 4:12 PM, Michael Camden
> <camden.michael@gmail.com> wrote:
>> Hello,
>>
>> My name is Michael Camden. I've been a Web Developer specializing
>> in PHP for several years now. My current position is Sr. Web Developer
>> for Holiday, a local Seattle company. There are a few changes that I
>> have implemented to this class in my own code, and would like to see
>> those changes posted. I would also be happy to take over as Lead
>> Developer for the project, should other bugs, or changes need to be
>> made. I've attached my new Webservice.php file, the main class in this
>> project, to this email as well as a diff output.
>>
>> Best regards,
>> Michael Camden
>
> Hello Michael,
>
> I am curious about what your ideas you have for future improvements of
> Services_Webservice.
>
> Services_Webservice is a rather outdated package, which was created
> before RESTful web services and AJAX were widely in use. RESTful web
> services have become much more common recently with the rise of Web
> 2.0, and nowadays seem to be the norm outside of enterprise level web
> services. A package which allows the easy creation of a web API, in a
> Services_Webservice like fashion, is currently not present in PEAR,
> and would definitely be useful for many people.
>
> I believe that this could be an ideal candidate for a pear2 package,
> and may perhaps be a better use of time than improving the outdated
> Services_Webservice package. It is something I have been planning to
> work on at some point when I get more time, and would love for any
> help or thoughts on the idea.
>
> As far as the patch goes, I am not sure I see too much benefit in it.
> Use of while/list/each does not offer much of a performance
> difference, and in fact may be slower (see
> http://www.php.lt/benchmark/phpbench.php), and foreach is
> generally
> easy to understand what is going on.
>
> Best Regards,
> --Matthew
>