On 7/18/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
On Sun, July 15, 2007 2:25 pm, Wesley Acheson wrote: > 1. Does the answer below mean no global persistant objects? > (Application scope) I guess that it does. Pretty much, yes. PHP is more Unix-like in quickly spitting out an answer, rather than MS-like in having some monolithic "answer" object hanging around forever.
No I don't necessarily think that this is an ms way of doing things. The advantage though more trivial in this example that if anything is expensive to create (read uses a lot or resources be that time/database connections/memory) To use one object over and over again saves the webserver some load. I'll probably look at the op cache as this probably removes this worry in this specific instance
The problem with shoving all forms into one big pile is that you generally want to customize the validation and processing to such an extent the the only actual common share code for the form is, errr: echo "<FORM>"; :-)
This I just straight forward don't agree with. The point is more based on fields then anything else I just tend to wrap field objects in a form object. The point is not just for input type ="text" but also applies to dropdown lists, option groups (through a different class) etc. Doing it in this way makes a much better way to iterate over a database record set for example. ( like a list of countries) and add them into an object rather than mixing output with code. Believe me I've seen it done and It turns nasty very quickly.
Another nifty trick is to encrypt your session data, and if it's less than 4K, just make it be the value of a cookie. This cookie value will "travel" with the user even in a distributed server app. You then only need to read/write memcached for "large" session data. Some more info here: http://hostedlabs.com/
Nice hint but I won't be doing this at least at this point.
PPS Do give the PHP way a fair shot, and do some real-world testing before drawing any conclusions wrt the Java way. But if you're just going to "fight" PHP all the time and do it the Java way, just go back to Java and be happy :-)
Who's fighting. I like PHP. I've used it more than real JAVA although not so much as JSP which personally I hate. I'm one of the "web developers" at work. The point of asking these questions is not to fight but to get a feel for what other people like and don't like in an architecture. Understand that understanding the limitations of any system and I'm talking about within the rules of the system (i.e. no plugins and no hacks) are key to using a system more efficiently. Yeah JAVA is great for some things. In fact if I was wanting to write processes / crons and many other things then It would be a language of choice. However this is my personal stuff its not work related and I think that PHP is a far more appropiate language for the web for reasons I'm sure you'll all understand. So yes I like to have ways of working (more than code itself) validated by people who actually use the language. Sorry If I've explained this badly, Just trying to show why I asked these questions so publically. Its not that I couldn't do it simpler or couldn't do it. Regards, Wesley Acheson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php