I think there have been several good points raised here, which I'll try to highlight, and I have a bit of my own to add. YMMV.
First off: "one thought" per function. Time spent organizing your code into structure, data, and actions is always time well spent, especially in a long-running project that will evolve and morph. When I start making stupid coding mistakes at 11 pm, I go home and sleep. Then I start in the next morning on a structural re-write.
Second: data-driven programming. I totally agree with
tye that rolling up constraints and actions into data structures is a really good thing to do. Think in terms of the high-level activity you're trying to accomplish:
- recognize a pattern from this set, grab the pertinent data, and perform a corresponding action from another set
- perform a sequence of actions based on a sequence of tokens (little languages)
- parse a pattern and perform actions based on the state of the system (state machines)
- etc., etc., etc.
Finally: parameter globalization. One of the big bugaboos people run into while attempting to chop modules down to size is that they have been taught not to use global variables. Function parameter lists that are longer than the code are a Bad Idea. :) In web coding, especially with the better templating systems, persistent state variables can really simplify your code. In non-web code as well, global system objects and class variables can really help clarify what's going on.
In all of this, the goal is to help you abstract and understand your code so that you can zero in on the right place to tweak. Yes, you will have more modules, but if you lay them out properly, you'll also have clear categories of modules and be able to dive into the right directory and file to get to the code you need.
Don Wilde
"There's more than one level to any answer."