velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <ddek...@freemail.hu>
Subject Re: comparing monetary value
Date Tue, 15 Oct 2002 22:29:16 GMT
Tuesday, October 15, 2002, 8:38:03 PM, Tim Colson wrote:

> Jonathan wrote:
>> So, instead of simply having:
>> The price is: $price euros.
>> The price is: $price euros. (${price*6.556 FFR)
[snip]
> So, I will explicitly say that I personally would indeed expect a
> non-technical designer to ask the Developer for this feature, rather
> than hack it in directly because the template system made it possible.
>
> "some reason": I can propose several reasons why this situation could be
> bad in my opinion:
>
> 1) the conversion rate changes tomorrow to 5.998

Well, Jonathan's example was rather unlucky, but probably you see the
meat...

> 2) each user has customized preferences for selecting her preferred
> alternative currency (FFR, DM, USD, etc.)

(See above... this was not the point here.)

> 3) the result of $price * $conversionRate will still need to have the
> correct rounding and formatting for the resulting currency. (Ex. DM 6,03
> or $6.03 USD - not $6.0029999987 DM)

Well, this is a MVC View tool, right? The formatting is the task of
the view component (Velocity). So it should give a solution to do the
formatting. Something like ${foo*1.234|0.00}.

> Summary: my solution, using Velocity, would be to do this work in the
> controller and give the template designer simply $price and
> $preferredLocalPrice.  
[snip]

There is one BIG mistake in this reasoning. Basically you said here
that if the designer uses decimals, then he probably does the task of
the programmers, also probably he will do something silly. But in
fact, the designer can do stupid things with integers as well... and
with anything else. It is IMO not a valid argument that Velocity
doesn't support decimals because it may allow designer to do something
that is not his/her task. With this logic, Velocity should not support
#if, because the designer perhaps will do something silly with that...


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message