Re: Function caching...

From: Date: Tue, 12 Dec 2000 11:04:37 +0000
Subject: Re: Function caching...
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.dev 
Request: Send a blank email to php-dev+get-40947@lists.php.net to get a copy of this message
Ron Chmara wrote: > 2. Optimizing PHP code. Re-loading 8000 of the *same* lines, every page, is > something that PHP does very poorly. Unfortunately, nobody's really pointing > out why coding PHP this way is a Bad Thing (tm), so I wouldn't be surprised if there It's not a bad think. I have an abstraction for multiple page forms. These abstraction takes XML files as an input. It generates me the HTML form elements, the JavaScript validation code, cares on the serverside validation (even complex conditions), automatically highlights invalid form elements, joins the form elements with a template, draws the tabs for the tab pane, cares on the tab switching and all the session issues. By help of this abstraction the time it takes me to write a comfortable, easy to configure, userfriendly 5 pages wizard with more than 50 input fields goes down to less than 2 hours. How long do you need to code a full-flegded 5 page wizard? By the way it's an ease for me to use different skins. My buissiness logic scripts get rid of all this presentation logic needed to handle a wizard. Embedding a wizard into a script takes me no more than five lines of code and helps me to get small, eays to read code. It's a very good idea to use library code (tm). If we had an AppServer that offers the features Kritian requested the time "lost" in my bad-nobody-needs-that abstraction would go down from now roughly 1.4s to less than 0.15s . I don't care a shit on this remaining 0.15s. But I do care on the compiling/loading time and I do worry the time the session stuff needs to rebuild my complex datastructures from scratch on every request. By help of a (still no avaiable but long time promised) Zend Cache I can avoid the 1.2s of compilation time but I still loose lots of time ~0.05s of the 0.20s (25%!) to rebuild my datastructures. We all spend lots of time every day for "select data from a datasource - display as a form - write back to the datasource". When we talk about rapid application development and seperating buissiness and presentation logic we have to search for a way to reduce the time spent for such a task. Joining my form abstraction with Jan Kneschkes table proxie would make us at NetUSE over night real rich. Jan gets well payed to build masks to edit lots of LDAP and SQL sources. Not really a job he likes very much, he preferrs KDE core hacking. If we could join our sources we would end up with something even better than this sketch: $tpl = new Template_Bridge(); $con = new SQL_Form(); $con->set_tpl($tpl); $con->set_sql( "..."); $con->set_conditional_validator("myfunc"); $con->print_form(); This is rapid appication development. All I have to do is typing my SQL query an add the code for conditional validations if there're any. Add the suggestion of Kristian to use a table proxy beside the simple SQL to Form bridge I used in the example. By help of such a proxy we'd not even care wheter the request gets done to an LDAP or SQL source. Yes, we do need this as our customers tend to mix LDAP and SQL. Microsoft names the WebForms as one of the major improvements of ASP+ and .Net makes over ASP. It would be an ease to rebuild the functionality with PHP and even be better if I only had an AppServer. Is the M$ shooting themselfes in the foot. VB and a form generator are really hard to learn. Is there any need for an solution on web forms? The twisd AG (http://www.twisd.de - CMS) switched to C++ and build APL, Inubit (http://www.inubit.de - high traffic B2B marketplaces) uses lots of html widget code others use custom Java Tools to build their PHP Code... Many companies I talked to (BP, Globalpark - http://www.globalpark.de, ...) are desperatly seeking for a solution. Does anybody want to switch to Java? No. Is anybody looking forward to get an AppServer to be able to use advanced abstractions, not really... > are quite a few people suffering for these same problems. Perhaps we need > more words/articles/doc chapters/whatever spread to the community on various > ways of writing code *with PHP's abilities and limitations in mind*. Of course, > a frequent complaint in any language is "XYZ does it better, why can't PHP", > so there are people who will want it to be more OO, others will want a GOTO, > others want an app server, etc.. etc.. Including the basic PHPlib files (perm + sess + user + sql) takes 0.4 seconds on a Netra T1. Ok, let's say that all these guys using one of the most popular library for everydays tasks must be idiots, because they do not know how to write web applications. And I damn Till Gerken and Tobias Ratschiller for mentioning PHPLib in their book "Web Application development with PHP 4.0", because it's bullshit to use library code. I have seen big applications not using any abstractions. Well, they run. But the code looks like a big chunk of randomly selected characters. Sad enough, there's no GOTO in PHP to make this code readable. Ulf

« previous php.dev (#40947) next »