How we build code:
In-page processes are identified, and where small function are observed, we build independent functions with the capability to interlock, to deliver that output.
Then, parameters are passed through and between the pages, many are session variables - and so allow a smooth streamlining of data flow.
More recently, we introduced a significant emphasis to minimise the number of calls to the database (fewer than 3 per in-page query).
This is difficult, and requires a broad minded approach to coding - but it delivers a fantastically quick user experience.