Caution: I am not a good coder. That said....

Peter Sawczynec ps-at-sun-code.com |nyphp dev/internal group use| wrote:

The number one muck up I have observed in coding, is programmers
creating functions or tools that leave off the final "else" clause at
the end of a conditional logic tree.

The first thing I define when I create a control flow structure is the default condition. Set it up with the test and empty brackets, set the default action, and then go back to fill it in.

Every function you write, every tool you develop has to be prepared to
accept and deal with wrong information or input out of your expected
bounds.

A strict default action can go a long way towards letting you code what you need now to make progress, while leaving the rest for later. I see too many coders take all day to try and accommodate everything when all we needed was A and B (for now). Code the default case. Protect against anything that is not what is expected for A and B, then code A and B and move on.
Sure it will fail for tons of situations, but it will never let you down for A 
or B (and that is what I asked for ;-)


-=john

--
-------------------------------------------------------------
Your web server traffic log file is the most important source of web business 
information available. Do you know where your logs are right now? Do you know 
who else has access to your log files? When they were last archived? Where 
those archives are? --John Andrews Competitive Webmaster and SEO Blogging at 
http://www.johnon.com

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to