Getting the right module structure: finding and fixing problems in your projects

Low coupling between modules and high cohesion inside each module are the key features of good software architecture. Systems written in modern programming languages generally start with some reasonably well-designed module structure, however with continuous feature additions, modifications and bug fixes, software modularity gradually deteriorates. So, there is a need for incrementally improving modularity to avoid the situation when the structure of the system becomes too complex to maintain.

We demonstrate how Wrangler, a general-purpose refactoring tool for Erlang, can be used to maintain and improve the modularity of programs written in Erlang without dramatically changing the existing module structure. We show how we identify a set of "modularity smells" and then demonstrate how they are detected by Wrangler and removed by way of a variety of refactorings implemented in Wrangler.