<br><br><div class="gmail_quote">2011/5/24 Tim Carpenter <span dir="ltr"><<a href="mailto:amphibian.ltd@googlemail.com">amphibian.ltd@googlemail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
(am sending again as this did not seem to get through)<div class="im"><br>
<br>
Hi all,<br>
<br>
I am sticking to the request to not comment on other solutions but present my own thoughts...<br>
<br>
1. Some units of code only make sense as a collection. who would use part of gen_server in isolation? Well, you could,but to have it separate exposes it to modification that could distort the focused purpose of the unit.<br>
<br>
2. some functions have intentionally hidden aspects, private calls etc and these again are best left hidden or considered as a logical whole otherwise side effects or bloat may occur.<br>
<br></div>
3. I see no reason why we cannot logically group functions into modules but not have the code in there...i.e. the module contains references to functions that make it up. this allows logical handling of groups of functions for code management and can allow one function to appear in multiple modules without code duplication. it also allows one to add/delete/replace a function in a module knowing that the source code for the other functions have not been touched!<div class="im">
<br></div></blockquote><div><br>I checked some numbers.<br><br>The OTP release has 1793 modules and in these there are 56317 functions with different names.<br>11887 functions are defined in only one module, ie the for 11887 functions the name alone uniquely<br>
identifies the module. The distribution of functions over modules has a long tail with strange spikes,<br>ie most function names are in very small number of modules. But some function names like handle_call<br>etc and in a very large number of modules.<br>
<br>Searching for a function using the function name as a key would only lead to a small number of candidate module if we exclude names like handle_call.<br><br>it would be interesting to do this with type signatures ...<br>
<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
<br>
4. naming conventions should be given great thought for simplicity and intuitiveness. functions could be in n sets, so a strict hierarchy may not suit.<br>
<br>
5. if functions are named as being in modules, the need to provide abstraction to the full name may be advantageous, so modulename.sort/3 can be used and the module definition translates this to a unique longhand which can change over time. The programmer should also be able to use the longhand at will using the module as a convenient bulk import/compile vehicle that will break at compile time (one would hope). Some form of 'expects...' notation could allow a form of protection against inadvertent swapping of functions in shared modules altering behaviour.<br>
<br>
6. we may want 3 elements to naming of functions: shorthand, longhand, and version, so one can use the latest version of a longhand named function, lock to a specific version of a longhand named function or use the shorthand latest version or other such combinations.<br>
</div></blockquote><div><br>I've been thinking about this for a while - sometimes we need a very precise name (including an MD/SHA<br>checksum) othertimes a sloppy name - it depends upon the context. <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">
<br>
7. n- tier modules - modules of modules? possibly.<br></div></blockquote><div><br>I think these are "views" not names - we have functions and then different ways to view them,<br>in collections of different kinds<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
<br>
Tim<br></div><div><div></div><div class="h5">
Tim Carpenter<br>
Amphibian Ltd<br>
London<br>
ENGLAND<br>
<a href="tel:%2B44%280%297900%20888826" value="+447900888826" target="_blank">+44(0)7900 888826</a><br>
<a href="mailto:amphibian.ltd@gmail.com" target="_blank">amphibian.ltd@gmail.com</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br>