0

which of these 3 code styles do you like best?

ColdFusion

1)

2)

3)

4) other ideas?

Of course I have my preference and reasons, but don't want to influence answers to this question. So, any answers are welcome, and please explain why you chose a particular style.

TIA

UPDATE: thanks to Sam's zen mind, I can code happily again ;}

 

tags:
ColdFusion
cfZen said:
 
ugh. The indenting didn't come through as hoped, but you get the idea, and that's not the most important parts of the style preference that I'm interested in... ;)
 
posted 961 days ago
Add Comment Reply to: this comment OR this thread
 
 
Given the options above, I vote for #2. I personally try to make the views as dumb as possible without any decisioning. If it were my application, the CFML part would likely be a managed inside a listener that is called prior to the view.
 
posted 961 days ago
Add Comment Reply to: this comment OR this thread
 
cfZen said:
 
Dave - I wholeheartedly agree. However, I'm dealing with a legacy Fusebox 2-ish app, where we're not given the freedom for much re-factoring. Fun! ;-}
 
posted 961 days ago
Add Comment Reply to: this comment OR this thread
 
Jeff said:
 
I'm going out on a limb here and say I like #3. I know that #2 is probably the preferred one for not duplicating the form tag, but I still don't like it.

I'm not a big fan of building complex url's in variables and then outputting the result.

just my 2 cents
 
posted 961 days ago
Add Comment Reply to: this comment OR this thread
 
 
The cleanest is definitely #2. Think about readability 2 years from now when some other poor schmuck has to pick up the code.

Even though you can't extract the decisioning all togetehr, at least consolidate it within it's own block(s).
 
posted 961 days ago
Add Comment Reply to: this comment OR this thread
 
Sam Farmer said:
 
I would go with 2 but I might lean towards 4 and put follow fuse in a hidden form variable thus removing it from the URL.

Rob's point about readability is a great point.

I would also add to pick a style and do it throughout your whole application. That way the next coder can pick up your style real easy.
 
posted 960 days ago
Add Comment Reply to: this comment OR this thread
 
 
Good points guys (btw - why is the CF blog community mostly a bunch of white guys?)...

But I have to give Sam props here cuz of the simple, clean idea of putting the follow fuse in a hidden form. For this app/this situation, that's the best solution I've heard so far.

Thanks to all. BTW - before I blogged this, I had rewritten #1 into #2, but then a co-worker suggested he'd rather see it rewritten into #3. I personally didn't like #3, but thought I should see if I'm in the minority or majority in how I like my code organized in a FB 2ish app. ;}
 
posted 960 days ago
Add Comment Reply to: this comment OR this thread
 

Search

Aaron  Longnion

The Hague, NL