This is doable in Emacs, using org-mode and org-babel.
However, as soon as I start using noweb syntax for "out of order" programming, I stumble into long standing bugs (references are not always found, links in the tangled code are broken, detangling does not work, etc...)