My own experience has shown that separation of a presentation layer from an application layer, doesn't occur where we think it should. HTML as a language has no capability to be dynamic, and if we are going to ask that the page be dynamic, we are going to need to make sure we don't attempt to split layers along language boundaries. JavaScript, as we typically use it, adds some dynamic nature to our pages, but often is not based on database content. This is where PHP comes in and the split becomes more vague. If what the user sees, is controlled by database content, then splitting presentation and application layers becomes a frustrating exercise in theoretical purity, that often adds to response times of applications.
IMHO, the first test of any code, is does it do what is should accurately, and speedily (in that order), after that what you have left is a programmer's best effort at producing something that others can read. Adding cpu cycles so that it can be more easily read by someone who doesn't know the language too well, is not always in the best interest of the software user. When I hear someone criticizing someone else's code, I understand clearly that they are overwhelmed by what they see, and in every case it can be improved on, but a better improvement would be for the criticizer to become better at reading and understanding the code (never an easy process). What is spaghetti to one, could be lasagna to another. (groan). Warren Vail -----Original Message----- From: andu [mailto:[EMAIL PROTECTED] Sent: Monday, September 29, 2003 1:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Cleaning up my messy code On 29 Sep 2003 19:22:54 -0000 Chris <[EMAIL PROTECTED]> wrote: > I am working on a fairly large scale (for myself anyway) project using PHP > and MySQL. I am victim of teaching myself to program, not separating > presentation from my code-- all the things that lead to masses of spaghetti > code so atrocious even I can't figure out what I was doing an hour ago. > > I'm not looking for an IDE or code generator so much as some practical > advice for organization and framework when developing a larger app. I know > of PHP Fusebox, having programmed with Cold Fusion fusebox for a while, but > it seems like that might be too much. Maybe I just need a sensical, > practical approach to application layout. What do you all do? How can I > learn to be a better PHP programmer in this regard? So far I haven't heard of any school teaching php or a particularly recommended methodology so we are all more or less in the same boat. I used the book by Luke Wellington and Laura Thomson which aside from being a well written book uses the same programming approach for all examples. That is: keep all html in one file and access it as functions, split php code in logical components (build dynamic content, database access, etc.). Not very different from when I was using cgis. I looked at Smarty but having to learn almost a new language turned me off. So far I tried to stay away from OO which IMHO can add unnecessary complexity if used where functions would do just fine. If I were to advice someone on the most important thing to look for when choosing a method of programming that would be: don't trust anybody, don't use something just because a lot of people use it. Evaluate and judge for yourself. > > c > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > ____ Regards, Andu Novac -- 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