From: A E Lawrence <adrian.lawrence@oucs.ox.ac.uk>
Newsgroups: comp.editors,comp.sys.transputer
Subject: Re: Folding editors
Date: Fri, 13 Nov 1998 23:05:45 +0000
Organization: Not much
Message-Id: <364CBB49.ABE8624B@oucs.ox.ac.uk>
References: <36374B57.168B9492@pact.srf.ac.uk>
    <71aj0c$oc$1@fangorn.moria.de> <6r1znq7264.fsf@belhaven.spider.com>
    <3639BEFD.2CC25E3C@esgem.com> <6r4ssm59ay.fsf@belhaven.spider.com>
    <QuruoDADsfO2Ewhc@cawley.demon.co.uk>
    <y4n26clw5i.fsf@mailhost.neuroinformatik.ruhr-uni-bochum.de>
    <6rhfwi4ee6.fsf@belhaven.spider.com> <363EEB84.5CAD538B@roke.co.uk>
    <6rvhkw20nk.fsf@belhaven.spider.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Xref: ukc comp.editors:32225 comp.sys.transputer:8921


I have only just noticed this discussion, and can't resist making a
comment. I am a great fan of disciplined folding, and not just for
programs. But problems do arise when working with others who either
refuse to use folding, or use *inadequate* folding editors. I have in
mind here at least one set of folding macros for emacs which could not
support indentation properly, if at all.

Iain A F Fleming wrote:
> 
> The entity calling itself Richard Beton wrote:
> >
> >  Iain A F Fleming wrote:
> >
> >  > The Jan Vorbrueggen wrote:
> >  > >
> >  > >  My experience exactly. It's also great for starting a program,
> >  > >  document,...:
> >  >
> >  > Exactly my point: folding is great for *starting* a program, but lousy
> >  > for maintaining it.
> >
> >  I tend to disagree. Especially with languages like Java, program outlining
> >  is a great benefit. So folding has a considerable value when it comes to
> >  maintaining such programs.
> 
> Maybe it's because we're dealing with different kinds of programs?  I'm a
> (embedded) systems programmer - I do compilers, operating systems, and
> communication protocols. This kind of code tends to be both very non-linear,
[snip]
>
> Again, in short, my objection to folding is that it hinders clean and
> complete functional decomposition. It can also produce code with awful
> complexity metrics - it's very easy, when folding, to produce loops with
> loops within conditionals -- to several levels. And have several of these in
> a function. I have seen such functions, stretching over screens and screens.
> When bereft of folds, such functions are inscrutable.
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This surely is *exactly* the point. No-one should view the text without
a full folding editor. If a program is well structured and documented
by virtue of its folded structure, why should there be an objection per
se to "loops within loops within conditionals". The folding may well
make this comprehensible, efficient, and provably correct. I don't see
the relevance of the situation bereft of folds. External constraints
apart... And well designed folds often ensure that *no* view of a
program exceeds a single screen.

> >  So folding has a considerable value when it comes to maintaining such programs.

Folding an inherited mess can sometimes turn it into something
maintainable.

ael
--
Dr A E Lawrence (from home)

