> -----Original Message-----
> From: Patrick Quinn [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 7:23 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Logic in switch vs. act_file include
> 
> 
> Thanks Patrick. Here's a code block from one of my developers that 
> really got me thinking about this (variables have been changed to 
> protect the innocent):
Because you change the variables I have no idea what the code is
actualy doing, so it's hard to comment. But it looks like this 
code could probably be clearer if you put some of it in an
act_ file.


> This used to be in an act_ file. The first reason I pulled it 
> out into  the switch was because it committed what I consider 
> a major sin in  Fusebox--fuses including other fuses. But 
> then I got to thinking about just how much code you could have 
> in your switch, vs. in includes. This is also an interesting 
> case, since the cfif results in an include, which  
> means, if you want to avoid fuses including other fuses, 
> you'd HAVE to put it in the case (unless you came up with some 
> other approach, like setting a flag and using the flag further 
> down the case block).
I use flags like that often. An act_ file that returns a flag
and a simple if statement is often much more readable than a
complex if statement. In addition to allowing me to hide 
complex logic, the name of the act file / variable communicate
what the complex if statement is actually determining.

BTW, I've been trying as much as possible lately to follow the
convention of having each fuse file output only one (if any)
variable, and making the name the file the same as the 
variable.

For example:
qry_user               returns attributes.user
act_isValidPassword    returns attributes.isValidPassword


Patrick

Patrick

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to