Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?




"Howard Brazee" <howard@xxxxxxxxxx> wrote in message
news:dbge55$gm2$1@xxxxxxxxxxxxxxxxxxxxxxx
>
> On 16-Jul-2005, "Pete Dashwood" <dashwood@xxxxxxxxxxxxxx> wrote:
>
>> Ansolutely :-). I wouldn't take the bet. Removal of duplicated code is a
>> very good benefit of structuring (whether a human gets to see/maintain it
>> or
>> not :-))
>
> I've worked in environments where duplicated code was desired.

I'd be interested to know what those environments were, Howard. Never
encountered it myself, and am having great difficulty imagining it.


>So I'll play
> Devil's advocate here and ask why an automated system should significantly
> benefit by eliminating duplicated code.

A very fair question. If no human is going to maintain it, you could well
argue that duplication is irrelevant. However, it isn't . Here are some
reasons why even a code generator might avoid duplicated code:

1. Isolation and reuse of functionality. Refactoring code into component
functions means that the code can be shared and reused. Even if you are not
maintaining it, you might want to export the functionality to other systems
or include it in new features of existing systems. (This is the main
advantage of component based systems.)

2. The less code that is generated, the faster it will run.

3. It is easier to maintain an inventory of discrete functions if their
functionality is not duplicated all over the place.

At a line-by-line level a code generator may well duplicate code because it
doesn't 'understand' the overall picture. However, subsequent passes of the
conversion process can analyse this generated code (because it is now in a
form where it is suitable for automated analysis), and recognise repeated
code. Optimization can create functions and replace the duplication with
function (or component) activation. (I didn't say CALLs, because it depends
on the environment...).

The bottom line is this:

Computer programming is well enough understood now that existing code can be
'rationalised' and refactored. (We haven't yet got AI generators that are
capable of creating code, but there are techniques that support this and it
is a 'next step' in system evolution. (Iterative interaction with a user is
one possible process whereby a computer could 'create' new functionality. -
I mentioned this years ago, right here in this forum. I even considered
actually doing it, but got sidetracked by the need to make a living... :-))
There are already tools that can do this in some limited spheres. As
processor and storage resources increase and become cheaper/faster,
techniques that were previously non-viable become feasible. As these
techniques are investigated, they get more refined and better.) Even without
going to Science Fiction, Computer Science has enabled refactoring tools,
such as the one Oliver is building, to become a reality.

It is no longer accurate to believe that only a human programmer, who has
full understanding of a process, can be capable of refactoring that process.
Indications are that smart software can do it faster, cheaper, and with
fewer errors.

Pete.



.



Relevant Pages