Hello,
I want to write some of my ideas about php performance and maintenance. Also
you may consider this response to Robert's template systems arguments.
I hope my english does not disturb too much.
As a uneducated php developer, I have open mind to anything. I try lots of
things. After so many projects, so many line of code here where I'm...
1-) Template systems
Are usesless, they are cpu hungry, they are complex, they are bloated. Every
template creator try to beat each other. And look that smarty. I wonder when
they start to write their own sql interpeter.
And of course I wrote one. Which can use sql, memcached and lots this that.
Sure it was very good one. With memcache support it was very fast.
So ? at end of the story, our html designers can't understand the system and
start to wheening. Lots of code goes to junk...
using inline php code for template is the best way. You can do what ever you
want.
Just use military grade dicipline yourself to do only read in template.php
files.
2-) Using XML and other kind of txt datastructure for storing someting...
Are nuts ? why you store that data in external data structure. Is PHP arrays
arent powerfull enought to store someting. ?
then guess what, if you use opcode cache (as APC). you dont need to spend any
cycle to open, parse, check ect.
(and I don't say anything exporting your data to 3rd party system. or
importing data from 3rd party system)
3-) You may apply number 2 to for sql operations.
If you got lots of read sql operations and if the data can store in php array.
(I mean if you don't need to sql language for searching data)
You may generate some kind of cache system, which produces php output
combining with apc your speed up was enormus.
4-) OO programming paradigm..
I still don't believe full blown oo programming under php. And there where
some areas to use php OO for fixin some design problems.
Php does not have namespaces, because of this you may got variable or function
name crashing.
Also you can access php objects anywhere from your code.
So ?
With public static keywors. you can give your code a pseudo name space and you
can access your data globally even doesn't write te everywhere like
global $this, $that, $bleh;
example
class evo {
public static $config = array(); // config array
public static $lang = array(); // language array
public static function get_module($o) {
.....
$return $array;
}
}
you can store data in your variables
evo::$config['this'] = 'bleh';
and call them
evo::$config['this'];
anywhere in your code no globals no fuss no buzz.
Of course there where lots of programmers around here to saying OO paradigm
much more on that.
I hope one the I found that much more :). for now all off them marketing
buzzword for me.
5-) function options...
function hede($name=hede,$this=true,$bleh=0){
}
well it nice but what if I want to expand this function ? But I use that thing
lots of location, shall I rewrite all of them... unh..!!!.
A yes OO programming right ?
but what about this.
function hede($o){
}
$o was an array we can store everthing what ever we want to use in the
function.
6-) array in array out in the functions
Well lets expand the number 5
function hede($o){
....
return $result;
}
$result was string containing our returns. But what if we want to return
someting different ?
So we have to create other function very similar to.
And if we return data in array format, we can put anything in the array. with
this we can even change behavior of the function for certain tasks
function hede($o){
....
return $o;
}
Regards
Sancar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php