tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent Tong <k...@cpttm.org.mo>
Subject Re: T5: default binding is prop even in template
Date Wed, 17 Jan 2007 15:19:53 GMT
Howard Lewis Ship <hlship <at> gmail.com> writes:

> I haven't gotten a lot of feedback ... Kent is very opposed to the
> idea.  Jesse and a few others are for it. I think it will be neat.

Here I'd like to explain why I am opposed to it. The supposed major
benefit of using default binding prefix is DRY. Why DRY? If there
is code duplication and for some reason I change this code, then I 
will have to change some other code. This is bad for maintenance.
Now, let's return to the issue. Consider the following example:

   <input type="text" t:type="TextField" value="prop:name"/>

The thinking behind default prefix is that there is linkage between 
TextField+value and prop. However, let's consider changing TextField to 
something else say PropertySelection, do we need to change prop? No. 
What if we need to change the parameter? There is seldom such need at 
all. What if we need to change from prop to say an imaginary ognl 
prefix, do we need to change TextField or value? No.

As you can see above, there is absolutely no ripple effect of changes. 
Therefore, this code is not violating DRY. So, what is the real benefit 
of default prefix? The only benefit is saving some typing for the programmer 
writing the code and less text to read for the programmer reading the code. 
What is the cost? As Ron said, it is the extra step in the mental process 
of a programmer writing or reading the code: "What is the default prefix 
here?". Obviously, mental process is the bottle neck in programming, not 
finger or eye ball movements.

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message