Methods of ordering function definitions in code
Posted
by
xralf
on Programmers
See other posts from Programmers
or by xralf
Published on 2012-03-05T07:33:49Z
Indexed on
2012/03/30
11:41 UTC
Read the original article
Hit count: 282
When I work on some programming project (usually command line application in Python with many switches), I'm usually creating about 30 and more functions. Most of the functions are in one file (except some helpers that I utilize in more projects).
Some of the functions are called on particular switch (like -p or --print) but many functions do some helper computations, print operations or database operations because I don't want to main functions be too large.
When I have an idea for a new functionality I often put new functions randomly to the file. Should I think more about it and place it to some particular place? Are there some methods for this?
© Programmers or respective owner