Behaviour style question
Attila Rajmund Nohl
attila.r.nohl@REDACTED
Mon May 3 17:14:48 CEST 2010
Hello!
I have a behaviour implemented by 6 modules. The functions of these
modules are called by an other module (let's call it manager module).
Then it turned out that one of the 6 modules needs a slightly
different interface than the other five, it needs an extra function.
Of course, the manager module has to be modified, there's a case
statement in the code.
My question is what to do with the behaviour? If I add the extra
function to the behaviour, I'll get compilation warnings in 5 modules
and that's generally a bad idea, because due to the these warnings I
might not notice more important warnings.
I can implement the extra function in all 5 modules like
get_alarm_type_data(_) ->
erlang:error(this_should_not_be_called);
but I don't like this unnecessary code (I'd get a function_clause
without this and that's basically the same result) and I especially
don't like it in 5 files.
My gut feeling is that the 6th module with the extra function has a
different behaviour, so there should be a new behaviour for this
module (even if it's only implemented by one module). In this case I
should add to the documentation of the manager module that the Module
parameter to its functions must implement either the original or the
"extended" behaviour.
Any other ideas?
More information about the erlang-questions
mailing list