According to many experiments, for cognitive tasks, the main factors for better performance (and, incidentally, personal satisfaction) are:
- Autonomy
- Mastery
- Purpose
The vision is that, well before the seventies have run to completion, we shall be able to design and implement the kind of systems that are now straining our programming ability, at the expense of only a few percent in man-years of what they cost us now, and that besides that, these systems will be virtually free of bugs.I summarize them here:
These two improvements go hand in hand. In the latter respect software seems to be different from many other products, where as a rule a higher quality implies a higher price. Those who want really reliable software will discover that they must find means of avoiding the majority of bugs to start with, and as a result the programming process will become cheaper. If you want more effective programmers, you will discover that they should not waste their time debugging; they should not introduce the bugs to start with. [Emphasis added.] In other words: both goals point to the same change.
...
I shall give you six arguments in support of ... the technical feasibility of the revolution which might take place [in the reliability of software]...
The analysis of the influence that programming languages have on the thinking habits of its users, and the recognition that, by now, brainpower is by far our scarcest resource, they together give us a new collection of yardsticks for comparing the relative merits of various programming languages.
The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. In the case of a well-known conversational programming language I have been told from various sides that as soon as a programming community is equipped with a terminal for it, a specific phenomenon occurs that even has a well-established name: it is called "the one-liners".
It takes one of two different forms: one programmer places a one-line program on the desk of another and either he proudly tells what it does and adds the question "Can you code this in less symbols?" —- as if this were of any conceptual relevance! -— or he just asks "Guess what it does!". From this observation we must conclude that this language as a tool is an open invitation for clever tricks; and while exactly this may be the explanation for some of its appeal, viz. to those who like to show how clever they are, I am sorry, but I must regard this as one of the most damning things that can be said about a programming language.
p4 diff files*
Here are several flavors of 'p4 diff':ls non-existent not-added unmapped-but-changed opened-up-to-date unopened-up-to-date [STDOUT] not-added unmapped-but-changed opened-up-to-date unopened-up-to-date [STDERR] ls: non-existent: No such file or directory
It is very difficult to match each section of output to the corresponding file on the command-line. First, you have to parse stderr and stdout. Then, you have to figure out how to map the filename listed in the output back to the filename on the command-line, which can be very tricky in sub-directories.p4 diff -sa non-existent not-added unmapped-but-changed opened-up-to-date unopened-up-to-date [STDOUT] /home/wshakes/work/opened-up-to-date [STDERR] non-existent - file(s) not opened on this client. not-added - file(s) not opened on this client. unmapped-but-changed - file(s) not opened on this client.p4 diff -sr non-existent not-added unmapped-but-changed opened-up-to-date unopened-up-to-date [STDOUT] /home/wshakes/work/unopened-up-to-date [STDERR] non-existent - file(s) not opened on this client. not-added - file(s) not opened on this client. unmapped-but-changed - file(s) not opened on this client.p4 diff -se non-existent not-added unmapped-but-changed opened-up-to-date unopened-up-to-date [STDOUT] not-added - file(s) not on client. unmapped-but-changed - file(s) not on client. opened-up-to-date - file(s) up-to-date. unopened-up-to-date - file(s) up-to-date. [STDERR] unmapped-but-changed
But soft! For large numbers of files, that will take minutes, or worse. So you decide to use a Perl API. (The C API does not prove to be any more helpful.)for f in files*; do p4 diff -sa $f > $f.diff-sa done
Most excellent, i' faith! $fdiffs is a hash of the fields that would have gone to stdout. You still have the pesky stderr output, but you know what everything refers to. Only there's one thing wanting ...use P4; $p4 = new P4; $p4->Connect(); for $file (@files) { $fdiffs = ($p4->Run('diff -sa', $file))[0] if ($p4->ErrorCount()) { print $p4->Errors(); } Process($fdiffs, $file); }
Hark! Not only are you back to the problem of parsing stderr, but you also need to map @fdiffs back to @files in order to know which files were ignored.use P4; $p4 = new P4; $p4->Connect(); @fdiffs = $p4->Run('diff -sa', @files); if ($p4->ErrorCount()) { print $p4->Errors(); } for $file (@files) ...