language agnostic - Ideas for automatic refactoring of modules -


i have problem function , type definitions aggregate on time in single module (we can assume module corresponds source file). @ point source file big barely maintenable anymore. example, 1 realizes module contains lot of functions logically related handful of different topics, , 1 feels should in own modules.

the idea have tool suggests ways split such module. actual creation of new source files old ones made automatically.

i have follwoing:

  • list of functions , data types, along direct dependencies on other functions , types in module.
  • from this, can compute dependencies every item
  • we can topological sort, make dependency groups. example

    (a, (b,c,d), e)

    • an item more left in outer list not depend on ones further right
    • inner grouped items (b,c,d) depend recursively on each other

the modules must form acyclic hierarchy, i.e. not possible module imports module b when b or 1 of modules imports imports a. follows (b, c, d) example above must not splitted across different modules.

now somehow stuck , looking strategy make sensible suggestions based on information found far.

of course, 1 possibility split according topologically sorted list of dependency groups. however, let assume list starts thus:

(a, b, c, ....) 

where c depends on b , a, b on , on nothing. here following:

  • module abc defines a, b , c
  • module defines a, module bc imports , defines b , c
  • module c imports , b , defines c, module b imports , defines b

if map dependencies between functions dependencies between modules may end module hierarchy complex , fine grained.

somehow must take further factors account. maybe desired module size, or number of imports.

any advice, pointers existing software doing welcome.

it sounds describing efferent , afferent couplings http://en.wikipedia.org/wiki/software_package_metrics

this language agnostic question know of few tools in java such jdepend (http://clarkware.com/software/jdepend.html) compute these metrics guide future refactorings.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -