good form?

Andy Kriger andy.kriger@REDACTED
Thu Nov 25 01:25:34 CET 2010

I'm playing around with Webmachine and what I'm finding is that in my
resources (the handlers for RESTful dispatch targets), there's
duplicated functionality. Fine, no problem there - three approaches I
can take:
1) a library module that those Webmachine functions can call out to
2) have my resource modules extend a base resource module that
implements common functionality
3) setup a delegate module that those Webmachine functions can call
out (one benefit of this over #1 is that a change to which
implementation is needed is handled either in the delegate or by
changing delegates, not in each resource calling a library module)

Combinations of the approaches are possible too. I'm curious to hear
from more experienced Erlangers on if extends is an accepted practice,
if delegation is a common Erlang pattern (or just a pattern that I'm
carrying over from OO/Java), if there's a pattern I'm missing here
(I'm suspecting something with messaging is the real solution, but I
honestly don't know enough Erlang to know if I'm barking up the wrong
tree there).


More information about the erlang-questions mailing list