Edsger Wibe Dijkstra turned out to be known, in particular, as the author of several capacious and expressive statements, outlining the abyss of professional deformation of programmers who prefer one or another uncomfortable programming language. In particular, the following Dijkstra's estimates are well known (I will quote them
on Wikitatnik ):
- "Programming in COBOL cripples the brain, so learning it should be treated as a crime." ("The use of COBOL cripples the mind; its teaching offense should therefore be considered a criminal offense.")
- βIt is almost impossible to teach students who have previously studied Basic to good programming. As potential programmers, they have undergone irreversible mental degradation. β (βAs potential programmers, they are mentally mutilated beyond hope of regeneration.β)
Dijkstra died on August 6, 2002. Today, ten or so years after his death, we are entitled to look around and ask ourselves: how much has the circumstances changed? In other words: but now (in our day) among the widely used programming languages, are there such languages, the use of which implies an almost inevitable risk of noticeable professional deformation for inclined programmers?
I think they are; and these are primarily languages ββthat fall under the definition of
write-only language , that is, they encourage the writing of such source code, the reading and understanding of which is too difficult, unnecessarily difficult (as a rule, even harder than its writing by the author), although in normal languages ββshould be the other way around.
')
The most common of these languages
is Perl .
Be calm: I do not intend to
simply poke a finger in Perl and declare that it is bad. It would be too unconvincing without evidence and details. And that is why, right now, with an example taken from life, I will show you four mechanisms by which Perl influences the programmer's mind and encourages them to
write code that is unsightly
write-only.This example will be fidoshnym.
Three days ago, in the Fidonet ehoconference of the sysops of the fiftieth region, the intention was to switch to such a new format of the list of Fidonet nodes
( English nodelist ), in which the time flags
(in Txy format ) would lie in the main (and not in the user) part of the node description line. One of the sysops suggested creating a nodelist in advance in a new format, so that anyone could check on him the behavior of his system:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β : R50.SysOp ( ) β URL : area://R50.SysOp?msgid=2:5000/111+503b7f4b β : Oleg Redut, 2:5000/111 (27 Aug 12 21:06) β : Vladimir Donskoy β : Txy ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ @REPLY: 2:5020/5480 503a828c @MSGID: 2:5000/111 503b7f4b @CHRS: CP866 2 @TZUTC: 0700 @TID: hpt/w32-mvcdll 1.9.0-cur 12-03-11 (current) , Vladimir! VD>> , - VD>> . AB> - . . :) , . - , . . :) ?.. Oleg ... AKA oleg(&)redut.info AKA ICQ 28852595 β β β GoldED+/W32-MINGW 1.1.5-b20120515 ( ) β Origin: --- ... ... --- (2:5000/111) @PATH: 5000/111 5020/1042 830 βββββββββββββββββββββββββββββββββͺβββ¬ββ£()β ββ¬βββͺββββββββββββββββββββββββββββββββ
I deliberately quoted this letter with all the technical information. At the beginning of the letter you can see the mention of
"hpt / w32", and at the end - the mention of
"GoldED + / W32": it becomes clear that this fidoshnik uses software designed for Win32, that is, it works under Windows.
But what was the response of the Perl programmer in response to this letter:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β : R50.SysOp ( ) β URL : area://R50.SysOp?msgid=2:463/68+503b854d β : Pavel Gulchouck, 2:463/68 (27 Aug 12 17:32) β : Oleg Redut β : Re: Txy ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 27 Aug 12, Oleg Redut ==> Vladimir Donskoy: VD>>> , - VD>>> . AB>> - . . :) OR> , . - OR> , . OR> . :) U,Txy : perl -pe 'next unless /(([^,]*,){6,})U(.*)/; ($l,$u)=($1,$3); while ($u =~ /^(.*,)?(T[A-Xa-x]{2}),?(.*)/) { $l.="$2,"; $u="$1$3" }; $_="${l}U$u\n"; s/,U?,?\s*$/\n/' βββββββββββββββββββββββββββββββββͺβββ¬ββ£()β ββ¬βββͺββββββββββββββββββββββββββββββββ
Two lines of Perl code; and this code, as is not difficult to see, largely falls under the definition of
write-only.But what exactly in Perl does this code do?
First of all, the unlimited abundance of regular expressions. The Perl language is designed in such a way that regular expressions in it are somewhat more convenient to use than a function call. This leads to the fact that the Perl programmer regularly experiences a continuous temptation to type your own (perhaps more adapted for a specific task) regular expression to any simple function (for example, the
split function
, which extracts fragments separated by commas or other characters) instead of to call this function. The source code is
written write-only, because the reader would immediately recognize by the name of the function, what it does here, but by the form of a regular expression, it is almost an order of magnitude more difficult to understand and you have to be careful.
Secondly, the use is not semantic
(something meaningful), but short (in this case - even single-character) variable names. Since the variables created by Pearl themselves have single-character names (like
$ 1 , $ 3 , $ 6 , $ _ ), the habit of daily work with them gradually creates the programmer's feeling that giving up the meaning of a variable in favor of the brevity of its name is
something quite natural
and justified - and therefore, he and his own variables will eventually begin to call one-letter (like
$ l , $ f , $ u ), as it was in the dark and immemorial era of
some Fortran or the first versions of BASIC. The source code is
written write-only because the reader of the code spends an order of magnitude more effort to understand that the
$ u variable contains user flags (which would be immediately understandable if it had the name
$ userflags ), the variable $ f contains the next flag
( $ flag ), the variable $ l contains the beginning of the line
( $ line ) or the list element
( $ list_item ).Third, Perl allows control structures to be written in an unnatural way "statement operator condition" (for example, "
unless condition code" or "
if condition code"). The source code is
written write-only, because the reader of the code first reads the code as equally unconditionally executed as all the preceding lines, but then notices the condition in the same line β which means that it is forced to re-recognize the code it has just read. executable only under this condition. This technique again slows down the reading of the code - however, it is already not an order of magnitude, but only two times; if he were limited to short constructions like
β next unless ...β, then he could be put up with.
Fourth, continuous inhuman efforts (painful at first, and then culminating in joyful success), made in everyday reading of
write-only codes, gradually develop in the programmer a rather unpleasant quality of contempt for other non-programmers, which in terms of Orthodox Christianity can be called pride, and in In terms of Lurkmore zhidoskaschenizm can be called ChSV (sense of grandeur). Programmers who have been subjected to this deformation either sincerely forget that not everyone around is programming in Perl under Linux, or they wanted to spit on the fate of those who do not program in Perl under Linux, or show an active desire
to somehow punish those who do not program in Perl under linux.
Think it over and judge: Will there be a lot of benefit from a recipe consisting of just these two more lines of Perl for the command line?
perl -pe 'next unless /(([^,]*,){6,})U(.*)/; ($l,$u)=($1,$3); while ($u =~ /^(.*,)?(T[A-Xa-x]{2}),?(.*)/) { $l.="$2,"; $u="$1$3" }; $_="${l}U$u\n"; s/,U?,?\s*$/\n/'
It is not difficult to see that the recipe relies on the fact that Perl is already installed and registered in the PATH. This is exactly the case in Linux, but this is usually far from the case in Windows (I purposely indicated to all of you a little higher that the recipient uses Windows). The Perl programmer, however, did not say a word about where to get
perl.exe .It is not hard to guess that the script needs to submit the initial data (nodelist) to the standard input and accept the results of the work (modified nodelist) from the standard output. The Perl programmer, however, did not touch upon this rather simple knowledge, which, however, could easily be unknown or forgotten by the end user.
In addition, the above source code framing with apostrophes does not work in Windows. In other words, if the recipient of the recipe even gets
perl.exe and correctly indicates the
" <input " and " > output " file, it is still waiting for disappointment - about the same as if
on the "C:" drive to issue the command
cd 'Documents and Settings' instead of
cd "Documents and Settings" .
As a result, the code shows the nature of
write-only not only when trying to read it, but also when trying to run it for execution. This effect is somewhat masochistic: first, the programmer fucks and suffers, and as a result, the user is forced to fuck and suffer - not literally, fortunately, but technically.
(By the way, think about it: why is Zaher-Masokhβs teaching called
masochism , not soberism? Isnβt it obvious that the term theherism βwould better correspond to the first - and not the second - part of the authorβs surname of this sexual perversion, and moreover it would be better matched Russian phrase "for dick", having a direct, direct relation to this sexual practice?)
At the end of the nineties in Fidonet there was a common gloomy prophecy: "
Fidonet was created by gays, and his motherfiend would be destroyed ." It was implied, on the one hand, the well-known non-traditional sexual orientation of Jennings (the creator of Fidonet), and on the other hand, the growing number of organized network scum who behave in a wrong way. But over the past few years I have been using my own version of this phrase: β
Fidonet was created by homosexuals, and masochists will destroy it β. It shows some politically incorrect attitude towards homosexuals, but the main thing is the deep conviction that the main problem of modern Fidonet is the deeply ingrained habit of using such extremely inconvenient software, which one sometimes has to have to fuck up and tune into.
Just in case, it is appropriate to emphasize: in the above example, the fault for me is not Pavel Gulchuk (an excellent programmer, a leading developer of binkd supporting the binkp.net domain, and so on and so forth), namely the Perl language, which gradually encourages programmers to writing and distributing
write-only source code Even when the programmer himself is not bad.
This is somewhat reminiscent of the fantastic language (human, not computer) "Newspeak" from George Orwell's novel
"1984" - an artificial language that gradually distorted the way of thinking of a native speaker, leading him to a party way of thinking.
And even more reminiscent of the fantastic language (human, not computer)
βBabylon-17β from the eponymous
novel by Samuel Dilani - an artificial language that, due to its compactness and thoughtfulness, sharply increased the pace of thought of the speaker of the language and the ability to reason language, making it a terrorist and a traitor, acting under the influence of self-hypnosis with erasing memory.
(It is worth noting
that Dilany was also homosexual, and, moreover, black.)