[Tutor] What is the best approach to organizing the order of functions in a module?

Alan Gauld alan.gauld at btinternet.com
Fri Mar 20 01:36:34 CET 2015


On 19/03/15 21:52, boB Stepp wrote:

> modules-in-progress,my collection of functions has gotten large enough
> that I feel I need to bring some sort of order to their positioning.


One thing that I meant to mention is that the best form of
organisation is splitting them into separate files. Trying
to maintain one enormous file of "useful functions" is
almost always the wrong thing to do.

You could create a package to contain the separate files/modules
though.

So the first decision is how to group the functions such that
they make useful (and reusable) modules. That usually is down
to dependency management. Things that must be used together
go together. (If everything depends on everything else then
you have a major design disaster to unpick and that should
be even higher priority that reorganising the functions!).


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list