6. Popclient becomes Fetchmail
|
6. Popclient se stává fetchmailem
|
The real turning point in the project was when Harry Hochheiser sent
me his scratch code for forwarding mail to the client machine's SMTP
port. I realized almost immediately that a reliable implementation of
this feature would make all the other delivery modes next to obsolete.
|
Skutečně klíčovým okamžikem v projektu byl okamžik, když mi Harry Hochheiser poslal svůj návrh kódu pro přesměrování pošty na SMPT počítače klienta. Já si téměř okamžitě uvědomil, že spolehlivá implementace této funkce učiní ostatní způsoby doručení zastaralé.
|
For many weeks I had been tweaking fetchmail rather incrementally
while feeling like the interface design was serviceable but grubby --
inelegant and with too many exiguous options hanging out all over.
The options to dump fetched mail to a mailbox file or standard output
particularly bothered me, but I couldn't figure out why.
|
Mnoho týdnů jsem měnil fetchmail spíše po částech a cítil jsem, že uživatelské rozhraní slouží svému účelu, ale je nepříjemné a neelegantní. Zejména záplava nastavení pro export stažené pošty do souboru nebo na standardní výstup mě obzvláště tížila, ale já nevěděl proč.
|
What I saw when I thought about SMTP forwarding was that popclient had
been trying to do too many things. It had been designed to be both a
mail transport agent (MTA) and a local delivery agent (MDA). With
SMTP forwarding, it could get out of the MDA business and be a pure
MTA, handing off mail to other programs for local delivery just as
sendmail does.
|
Když jsem přemýšlel o SMPT přesměrování, tak se ukazovalo, že popklient se pokoušel dělat příliš mnoho věcí. Byl navržen zároveň jako mail transport agent (MTA) a local delivery agent (MDA). S SMTP přesměrováním se z něj mohl stát čistý MTA a předávat poštu jiným programům, tak jak to dělá sendmail.
|
Why mess with all the complexity of configuring a mail delivery agent
or setting up lock-and-append on a mailbox when port 25 is almost
guaranteed to be there on any platform with TCP/IP support in the
first place? Especially when this means retrieved mail is guaranteed
to look like normal sender-initiated SMTP mail, which is really what
we want anyway.
|
Proč si přidělávat práci s celou složitostí konfigurace MDA, když port 25 je téměř určitě přítomen na všech platformách podporujících TCP/IP?
|
There are several lessons here. First, this SMTP-forwarding idea was
the biggest single payoff I got from consciously trying to emulate
Linus's methods. A user gave me this terrific idea -- all I had to do
was understand the implications.
|
Zde se můžeme naučit několik lekcí. Zaprvé, nápad se SMPT, to byla největší odměna za to, že jsem se pokoušel napodobit Linusovi metody. Tento skvělý nápad mi poskytl jeden z uživatelů, já pouze musel pochopit jeho důsledky.
|
11. The next best thing to having good ideas is recognizing good
ideas from your users. Sometimes the latter is better.
| 11. Skoro stejně důležité, jako mít dobré nápady, je schopnost rozeznat dobré nápady vašich uživatelů. Občas je to druhé dokonce lepší. |
Interestingly enough, you will quickly find that if you are completely
and self-deprecatingly truthful about how much you owe other people,
the world at large will treat you like you did every bit of the
invention yourself and are just being becomingly modest about your
innate genius. We can all see how well this worked for Linus!
|
Je zajímavé, že pokud jste opravdu k sobě upřímní, rychle zjistíte, jak mnoho dlužíte ostatním lidem, ačkoliv okolní svět vás bude považovat za původce všeho. Vy sami pak následkem toho začnete být skromnější v pohledu na vlastní schopnosti a Linus je toho dokonalým příkladem.
|
(When I gave this paper at the Perl conference in August 1997, Larry
Wall was in the front row. As I got to the last line above he called
out, religious-revival style, ``Tell it, tell it, brother!''. The
whole audience laughed, because they knew it had worked for the
inventor of Perl too.)
|
(Když jsem tento článek četl na konferenci o Perlu v roce 1997, Larry Wall seděl v řadě přede mnou. Když jsem se dostal k řádkům výše uvedeným, zavolal hlasem starých kazatelů "Jen to řekni, řekni bratře!". Celé publikum se smálo, protože vědělo, že vše fungovalo stejně i v případě vynálezce Perlu.
|
After a very few weeks of running the project in the same spirit,
I began to get similar praise not just from my users but from other
people to whom the word leaked out. I stashed away some of that
email; I'll look at it again sometime if I ever start wondering
whether my life has been worthwhile :-).
|
Jen několik málo týdnů po té, co jsem projekt rozběhl, jsem začal získávat podobnou chválu nejen od uživatelů, ale i od dalších lidí, ke kterým se zpráva donesla. Schoval jsem si některé e-maily. Podívám se ně, jestli někdy budu pochybovat, že můj život má smysl.
|
But there are two more fundamental, non-political lessons here that
are general to all kinds of design.
|
Jsou zde ovšem ještě dvě základnější, nepolitické lekce, které jsou společné veškerému designu.
|
12. Often, the most striking and innovative solutions
come from realizing that your concept of the problem was wrong.
| 12. Často to nejzajímavější a nejoriginálnější řešení se zrodí z toho, že si uvědomíte, že vaše chápání problému bylo mylné. |
I had been trying to solve the wrong problem by continuing to develop
popclient as a combined MTA/MDA with all kinds of funky local delivery
modes. Fetchmail's design needed to be rethought from the ground up
as a pure MTA, a part of the normal SMTP-speaking Internet mail path.
|
Já se pokoušel vyřešit nesprávný problém tím, že jsem chtěl popklienta jako kombinovaný MTA/MDA. Fetchmail musel být znovu koncipován od základu jako čistý MTA, součást normálního SMTP.
|
When you hit a wall in development -- when you find yourself hard put
to think past the next patch -- it's often time to ask not whether
you've got the right answer, but whether you're asking the right
question. Perhaps the problem needs to be reframed.
|
Když při vývoji narazíte do zdi, když zjistíte, že vás zajímá jen příští oprava, je často okamžik se zeptat ne na to, zda máte správnou odpověď, ale jestli kladete správnou otázku. Možná je třeba problém reformulovat.
|
Well, I had reframed my problem. Clearly, the right thing to do was
(1) hack SMTP forwarding support into the generic driver, (2) make it
the default mode, and (3) eventually throw out all the other delivery
modes, especially the deliver-to-file and deliver-to-standard-output
options.
|
Já jsem tedy problém reformuloval. Je jasné, že správné bylo 1. přenést podporu SMTP do generického driveru, 2. učinit z něj výchozí mód a 3. nakonec přestat podporovat ostatní možnosti přenosu.
|
I hesitated over step 3 for some time, fearing to upset long-time
popclient users dependent on the alternate delivery mechanisms. In
theory, they could immediately switch to .forward files or their
non-sendmail equivalents to get the same effects. In practice the
transition might have been messy.
|
Nad krokem 3 jsem nějaký čas váhal, obával jsem se, že si rozlobím své staré uživatele, kteří závisejí na těchto mechanismech. Teoreticky jim stačilo přejít na .forward soubory nebo jejich ne-sendmail alternativy, aby získali to, co potřebují. Ve skutečnosti však mohl být tento přechod komplikovaný.
|
But when I did it, the benefits proved huge. The cruftiest parts of
the driver code vanished. Configuration got radically simpler -- no
more grovelling around for the system MDA and user's mailbox, no more
worries about whether the underlying OS supports file locking.
|
Ale když jsem to učinil, zisk byl ohromný. Nejpracnější část kódu zmizela. Konfigurace byla mnohem jednodušší, už žádné starosti o MDA uživatele a jeho poštovní schránku. Žádné starosti s tím, jestli operační systém umožňuje uzamykání souborů.
|
Also, the only way to lose mail vanished. If you specified delivery
to a file and the disk got full, your mail got lost. This can't
happen with SMTP forwarding because your SMTP listener won't return OK
unless the message can be delivered or at least spooled for later
delivery.
|
Rovněž zmizelo jediné riziko ztráty pošty. Pokud jste určili za příjemce pošty soubor a disk se zaplnil, poštu jste ztratili. Se SMTP se to stát nemůže.
|
Also, performance improved (though not so you'd notice it in a single
run). Another not insignificant benefit of this change was that the
manual page got a lot simpler.
|
Zlepšila se i rychlost a významné bylo i zjednodušení manuálu.
|
Later, I had to bring delivery via a user-specified local MDA back in order
to allow handling of some obscure situations involving dynamic SLIP.
But I found a much simpler way to do it.
|
Později jsem musel doplnit některé nestandardní podmínky, ale to už bylo mnohem jednodušší.
|
The moral? Don't hesitate to throw away superannuated features when
you can do it without loss of effectiveness. Antoine de
Saint-Exupery (who was an aviator and aircraft designer when he
wasn't being the author of classic children's books) said:
|
Morální poučení? Neváhejte se rozloučit se vším, co vám nezvyšuje efektivitu. Antoine de
Saint-Exupery (což byl letec a letecký konstruktér, když nepsal klasické dětské knihy) řekl:
|
13. ``Perfection (in design) is achieved not when there is nothing more
to add, but rather when there is nothing more to take away.''
| 13. Konstrukční dokonalosti není dosaženo tehdy, když už není co přidat, ale tehdy, když už nemůžete nic odebrat. |
When your code is getting both better and simpler, that is when you
know it's right. And in the process, the fetchmail
design acquired an identity of its own, different from the ancestral
popclient.
|
Když se Váš kód zároveň zlepšuje a stává jednodušším, potom víte, že jste na správné cestě.
|
It was time for the name change. The new design looked much more like
a dual of sendmail than the old popclient had; both are MTAs, but
where sendmail pushes then delivers, the new popclient pulls then
delivers. So, two months off the blocks, I renamed it fetchmail.
|
Nastal čas pro změnu jména. Nový program vypadal mnohem více jako dvojník sendmailu než starý popklient, a tak jsem jej po dvou měsících přejmenoval na fetchmail.
|