8. A Few More Lessons From Fetchmail
|
8. Několik dalších lekcí z fetchmailu
|
Before we go back to general software-engineering issues, there are
a couple more specific lessons from the fetchmail experience to
ponder.
|
Než se vrátíme k obecným problémům softwarového inženýrství, je třeba se poučit z několika specifických lekcí, které přinesl fetchmail.
|
The rc file syntax includes optional `noise' keywords that are
entirely ignored by the parser. The English-like syntax they allow is
considerably more readable than the traditional terse keyword-value
pairs you get when you strip them all out.
|
Rc syntax zahrnuje nepovinný parametr 'noise', které parser zcela ignoruje. Takovýto anglicky znějící syntax je mnohem čitelnější než tradiční zhuštěné páry parametr=hodnota.
|
These started out as a late-night experiment when I noticed how much
the rc file declarations were beginning to resemble an imperative
minilanguage. (This is also why I changed the original popclient `server'
keyword to `poll').
|
Toto začalo jako noční experiment, když jsem si všiml, jak mnoho deklarace rc souborů připomínají příkazový minimalistický jazyk. (Proto jsem také změnil jeden z původních parametrů popklienta "server" na "poll")
|
It seemed to me that trying to make that imperative minilanguage more
like English might make it easier to use. Now, although I'm a
convinced partisan of the ``make it a language'' school of design as
exemplified by Emacs and HTML and many database engines, I am
not normally a big fan of ``English-like'' syntaxes.
|
Zdálo se mi, že pokud tento jazyk bude více připomínat angličtinu, bude snáze použitelný. Ačkoliv jsem přesvědčený zastánce designerské školy, která se snaží učinit z příkazů jazyk, jako v případě HTML, Emacsu a řady databází, obvykle nemám příliš rád poangličtělý syntax.
|
Traditionally programmers have tended to favor control syntaxes that
are very precise and compact and have no redundancy at all. This is
a cultural legacy from when computing resources were expensive,
so parsing stages had to be as cheap and simple as possible. English,
with about 50% redundancy, looked like a very inappropriate model then.
|
Tradičně programátoři dávají přednost syntaxi, která je velmi přesná a kompaktní. Toto je dědictví z doby, kdy výpočetní zdroje byly drahé, takže procházení souborů muselo být levné a co nejjednodušší. Tehdy se zdála angličtina s 50% přebytkem slov zcela nevhodná.
|
This is not my reason for normally avoiding English-like syntaxes; I
mention it here only to demolish it. With cheap cycles and core,
terseness should not be an end in itself. Nowadays it's more
important for a language to be convenient for humans than to be cheap
for the computer.
|
To ovšem není můj důvod, proč se takovéto anglické syntaxi obvykle vyhýbám. Já ho zmiňuji pouze proto, abych jej vyvrátil. V dnešní době by už stručnost neměla být cílem kvůli sobě samé. Je důležitější, aby jazyk byl pohodlný pro uživatele, ne aby byl levný pro počítač.
|
There are, however, good reasons to be wary. One is the complexity
cost of the parsing stage -- you don't want to raise that to the point
where it's a significant source of bugs and user confusion in itself.
Another is that trying to make a language syntax English-like often
demands that the ``English'' it speaks be bent seriously out of shape,
so much so that the superficial resemblance to natural language is as
confusing as a traditional syntax would have been. (You see this in a
lot of so-called ``fourth generation'' and commercial database-query
languages.)
|
Existují ovšem důvody k obezřetnosti. Jedním z nich je komplexita parsingu. Nechcete její složitost zvýšit na úroveň, kdy se stává zdrojem častých chyb a začne plést i samotné uživatele. Dalším důvodem je, že pokud chcete, aby Váš jazyk zněl jako angličtina, musíte angličtinu značně pokroutit, a to natolik, že tento zpitvořený jazyk je stejně zmatečný, jako tradiční nesrozumitelný syntax. (Typickým příkladem jsou tzv. jazyky čtvrté generace a komerční jazyky pro přístup k databázím.)
|
The fetchmail control syntax seems to avoid these problems because the
language domain is extremely restricted. It's nowhere near a
general-purpose language; the things it says simply are not very
complicated, so there's little potential for confusion in moving
mentally between a tiny subset of English and the actual control
language. I think there may be a wider lesson here:
|
Kontrolní systém fetchmailu se vyhnul těmto potížím proto, že jeho jazyková oblast je nesmírně omezená. Není to zdaleka jazyk obecný, to co říká, není vůbec složité, takže je zde jen malý prostor pro zmatek při myšlenkovém přechodu od jeho miniaturní podmnožiny angličtiny k skutečnému kontrolnímu jazyku. Možná nás to učí další lekci:
|
16. When your language is nowhere near Turing-complete, syntactic
sugar can be your friend.
| 16. Pokud Váš jazyk není zdaleka kompletní (Turig-complete), syntaktický cukr může být přítelem |
Another lesson is about security by obscurity. Some fetchmail users
asked me to change the software to store passwords encrypted in the rc
file, so snoopers wouldn't be able to casually see them.
|
Další lekce je o bezpečnosti přes utajení. Několik uživatelů mne požádalo, abych pozměnil program tak, aby ukládal hesla zašifrovaná v rc souboru a tím zabránil příležitostným čumilům v jejich náhodném odkrytí.
|
I didn't do it, because this doesn't actually add protection.
Anyone who's acquired permissions to read your rc file will
be able to run fetchmail as you anyway -- and if it's your password
they're after, they'd be able to rip the necessary decoder out of
the fetchmail code itself to get it.
|
Já to neudělal, protože tím ve skutečnosti nezískáte žádnou ochranu. Každý, kdo získá přístupová práva ke čtení vašeho rc souboru bude moci sám spustit fetchmail, a pokud chce vaše heslo, získá potřebný dekodér z kódu fetchmailu.
|
All .fetchmailrc password encryption would have done is give a false
sense of security to people who don't think very hard. The general
rule here is:
|
Zašifrování hesla v .fetchmailrc by pouze dalo falešný pocit jistoty lidem, kteří o všem důkladně nepřemýšlejí.
|
17. A security system is only as secure as its secret. Beware of
pseudo-secrets.
| Bezpečtnostní systém je pouze tak bezpečný jako jeho tajemství. Mějte se na pozoru před pseudo tajemstvími. |