<div>hmm....</div><div>In fact, the module I use compile(expert_all) not like the big module give to others. just for cut the big file into small one. none of others will use the module, it just coupling to another module.</div><div>It just like some private function in some bigger module.(I know it's better to place all in one module, but too many old code just did like that)</div><div><div>And the program I design are always change.</div><div>Becase it's just like some private function in big module .</div><div>The function are always change, too.</div><div>And the change may out of my control.....</div><div>Everytime change the code I have to fix the export...</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Richard A. O'Keefe"<ok@cs.otago.ac.nz>;</div><div><b>发送时间:</b> 2013年6月20日(星期四) 下午2:31</div><div><b>收件人:</b> "goofansu"<goofan.su@gmail.com>; <wbr></div><div><b>抄送:</b> "饕餮"<249505968@qq.com>; "erlang-questions"<erlang-questions@erlang.org>; <wbr></div><div><b>主题:</b> Re: [erlang-questions] 回复:  Is export always better than complie(export_all)?</div></div><div><br></div>> 在 2013年6月20日星期四,下午1:57,饕餮 写道:<br>> <br>>> I'm working in a program as 10,000 line code.<br>>> Most of the time the function are changing.<br><br>So what's new?  It was ever thus.<br><br>>> And all the team member should read all of the code.<br>>> And I usually use compile expert_all because I feel it make the work easier to handle<br><br>For whom?<br><br>The more you export, the harder it is for someone to find the<br>one function they need.<br>The more you export, the more others will depend on exactly what<br>the current version does, so the less you will be able to change.<br><br>You should at all times have a *design* that says what<br>services a module is *intended* to provide to the rest of<br>the system.<br><br>You MUST export the minimal set of functions that are necessary<br>for *outside* code to use those services.<br>You MAY export some 'convenience' functions defined in terms<br>of the core functions.<br>You SHOULD NOT export anything else.<br><br>How often I've read "look, here are these neat undocumented features<br>of System X version N", followed a few years later by "Those wicked<br>builders of System X broke all my programs in version N+1 when the<br>undocumented functions changed/went away."<br><br>>> But one of my teammate said that I must never use export_all.<br><br>He's wrong too.  When debugging, it is useful to be able to refer<br>to anything in a module.  But you can do that with compiler command<br>line switches/option lists.<br><br>>> It's that necessary to use export() instead of compile(export_all)?<br>>> And what's the reason to use export?<br><br>To make it clear to yourself, to the system, and to other people<br>which functions are part of the interface and may be safely called<br>outside, and which other functions (by omission) are *not*, and may<br>be changed without anyone else having any right to complain.<br><br>If you export everything, you are promising everyone else who uses<br>your module that you'll try very hard to keep *all* of those<br>functions' interfaces unchanged for a rather long time -- as the<br>project counts time.<br><br><br></div>