[Prev][Next][Index][Thread]

Re: simple method dispatch question



in article Yd_O5.37450$n9.1230204@news2.rdc1.on.home.com, Michael T. Richter
at mtr@ottawa.com wrote on 2000.11.10 2:00 PM:

> This looks interesting, but it seems to me to obfuscate semi-trivial (and
> very conventional) conditional logic using the dispatch mechanism.  Doesn't
> this tend to make write-only code outside of trivial examples?

I suppose some very trivial examples could be better written as a
conditional expression, but I believe it's generally better to use method
dispatch than "manually" dispatching. At the very least, the code might
possibly perform better using the built-in method dispatch mechanism (or
not).

Certainly it seems cleaner to me to simply add/remove methods to change the
logic rather than modify some hairy expression. Furthermore, using method
dispatch allows you to modify the logic in multiple modules or libraries.
Really the only concern, I think, is that you need good tools to make it
easy to see all the methods if you're maintaining the code, but this is
essentially true for any code.

-- 
Chris Page

let mailto = concatenate( "page", "@", "best.com" );




References: