Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Painting a masterpiece in PHP
In PHP, you can write a program that looks like a Rembrandt, or one that makes the dog's dinner look tidy. It's not only the mechanism of the language you need to learn to do a good job, but how to apply it.

This week, on my public PHP course, I have a group which is very IT professional in background, and very much concerned with writing good code efficiently, with easy maintainabiliy, enhancability, and element re-use across projects. So rather that use my mores standard "here is a program to ...", I've been writing new examples with a different twist as I go.

It's easy enough to code a box on a form to echo back what was on the previous form. But remember the user may enter all sorts of special characters that you need to deal with. And remember you need to do this multiple times. And remember that you need to be able to re-present the same form if the fields aren't correctly filled. And remember you would like to reuse near-identical logic on the next page. You're looking for nicely structured code - the Rembrandt not the dinner!
• Make good use of functions.
• Have common error handling logic.
• Put everything that varies into a single specification.
• Save the common code into an include file.
• Use good error messages.


I've put the example I finished with last night up on line - the source code is here and you can run it here. There ARE things still to be done ... - the error messages are common at the moment, and it's all in one file rather than using an include (a good way to do it for initial testing, after all!)
(written 2007-05-10 07:46:15)

 
Associated topics are indexed under
H115 - Designing PHP-Based Solutions: Best Practice

Back to
Good Programming practise - where to initialise variables
Previous and next
or
Horse's mouth home
Forward to
Improving searches - from OR to AND?

Some other Articles
Two new pages / sites
Themes for the web site
Finding resources - some pointers
Improving searches - from OR to AND?
Painting a masterpiece in PHP
Good Programming practise - where to initialise variables
Conjugation
Sizing sheets and other domestic issues
Ducking stool for Melksham?
Sorting out for a site map
1636 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho