I'm stuck updating other people's code at work. It's bad, bad code, and as such, it's hard to understand. It's not uncommon for me to stare at it glaze-eyed for several minutes before realizing that these 15 lines are just checking if a file exists.

So that gave me an idea. It sure would be nice if, once I figure out what a particular chunk of code does, I could somehow hide it from view, replaced by a one-line comment on what its function is. Then I could collapse the code one piece at a time, and when I'm all done, I'll have nothing but a big page of pseudocode explaining the whole process. Even better, if I could take those collapsed bits of pseudocode and collapse them together into a higher level of abstraction, and so on. In effect, I'd be generating the kind of comments that should have been placed there by the original programmer to begin with.

So I'm wondering. Does anything out there already do this? I can't see how it'd be useful for coding from scratch, but it'd be invaluable for making sense of legacy code, especially in big projects. Anybody know of such a beast?

---
I'm too sexy for my .sig.


In reply to Can your editor do this? by Sprad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.