Note that I said "deprecate", not "remove", so the interface is not
really changing (in the sense that existing applications won't
suddenly break), just some new methods are added to deal with an
ambiguity that has cropped up since design time. So apps could
continue to call getGasLeft(), but they should be changed to call
getGasLeftGallons() (which is the same thing), to avoid the ambiguity.
At some point, the getGasLeft() method might actually be removed (at
which point non-updated apps would flat-out break), but that's often
not the way deprecation works.
So your example is correct, though I'd recommend not putting UI stuff
(the I18N call) in your business logic; that's a UI concern, and
should stay there. However, now that the application supports both
english and metric, the UI's call to gas() is ambigious, so I'd hope
that you'd change it to gasGallons() (which will return the identical
result, since the gas() should simply be <cfreturn getGallons() />).
You don't HAVE to, but it'll ease maintenance down the road.
cheers,
barneyb
On 8/30/05, Kerry <[EMAIL PROTECTED]> wrote:
> > So you'd deprecate that method, and then add getGasLeftGallons() and
> getGasLeftLitres() or something
>
> I know its only an example off the top of your head, but this does change
> the interface! So I can see why John would question the benefit.
>
> Heres my take on the example - off the top of my head (feel free to pick
> holes in it...)
>
> car.gas returns a int, so then the presentation layer has to decide wether
> its litres or gallons.
> and its just a variable name, so all it can really ever do is return a
> variable.
>
> car.Gas() could at first only return a variable as well, but then when your
> app grows, you have the option make it call several other functions within
> itself. which makes the app more flexible.
>
> so in the future, car.gas() might actually do something like:
>
> var fuel =
> math.convert("liquid","metric",country.getLiquidMeasurement(),gasamount);
> return i18n.formatLiquid(fuel,country.getISOAlpha3());
>
> all that, and your presentation layer is still only calling car.gas(), no
> need to change anything except the contents of the function.
>
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 100 invites.
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]