cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: CForms - When do they make sense? Design question
Date Wed, 15 Jun 2005 20:20:57 GMT

Hi Jonny,

Hey, could you do a favor...?  When you want to start a new thread on 
this list, compose your post as a "new" message instead of using Reply. 
  Even though you change the Subject: line, the In-Reply-To: header 
still screws up the threading in our mailreaders.  That's a pain, but 
it's also bad for you, because if I did not happen to be interested in 
the thread "AW: CForms and Modular Database Actions", I might never 
have opened up that thread (which you replied on) and seen your post 
about "When do they make sense? Design question".  Then you would have 
been deprived of my priceless commentary :-) :-) (see below...)

On Jun 15, 2005, at 7:09 AM, Johannes Becker wrote:

> Hi,
>
> a general question.
> I've got a page with two textboxes. These two have to be filled in 
> (with whatever you want). Does it make sense to use CForms or just 
> check them in Flow?
> Other pages of my app use the CForms, because they're "more difficult".
>
> Now I wonder if its bad programming style to switch between two ways 
> of form-validation.

Well, I would consider it to be bad style! :-)

I use CForms for all forms, no matter how simple they are.  But I have 
some more framework of my own that I think makes this easier and 
reduces the amount of cut-n-pastage needed to get up and going, so 
YMMV.  But notwithstanding that... I would say you should definitely 
use Flowscript and the continuation model, whether or not you use 
CForms proper.  Otherwise, you'll be back in crappy "classic" webapp 
mode where you have to think about the resource that is going to be 
invoked by the form.  I never have to think about that, it's always the 
same — it's the continuation handler, which gets matched by a little 
pipeline that's in the sitemap of _all_  my apps as part of the 
"boilerplate" that goes in there whenever I start a new project.  Plus, 
I just really like having the code that displays the form in the same 
place as the code that handles the values.  I like the explicit control 
flow.

Also... is this your login form that you were asking about the other 
day?  If so, then aren't those fields required?  If they are, then you 
need form validation, and that right there makes it "complicated 
enough" that CForms is a win.

A final consideration... consistency is a good thing, because it 
reduces the number of Brain Cycles it takes to deal with anything.  So 
if I have to deal with some code, and something is done one way in one 
place and another way in another place, then I would like to be able to 
assume that the programmer did it that way for some Good Reason besides 
just being a lazy bastard, i.e. that they would not compromise the 
value of "consistency" unnecessarily, and so if when I see something 
that is different from something that it seems like it should be the 
same as :-), then I will probably spend Brain Cycles trying to 
understand why, i.e. searching for the Good Reason, and will be annoyed 
if the Good Reason turns out not to exist.

The more you use CForms the more second-nature it will become, until 
you won't even think "is this form really 'worth' using CForms for", 
because CForms will be easy for you.  You can hasten that day by 
starting to use CForms for everything now! :-)

HTH,
—ml—


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message