[dundee] Defcon-16 Media Archives
Rick Moynihan
rick.moynihan at gmail.com
Thu Mar 12 11:30:34 UTC 2009
2009/3/12 gordon dunlop <astrozubenel at googlemail.com>:
>
>
> 2009/3/12 Rick Moynihan <rick.moynihan at gmail.com>
>>
>> I offer a small improvement:
>>
>> If you're going to write a shell script you might as well include the
>> user commands before hand as part of the script. At least that's what
>> I first thought; however in this simple case you're better writing it
>> on as a one liner:
>>
>> wget -qO - https://www.defcon.org/podcast/defcon-16-video.rss | grep
>> m4v | cut -d '"' -f2 | wget -i -
>>
>> Redirecting everything through stdout/stdin has the advantage of not
>> leaving temporary files on your disk.
>
> That's great Rick if you are writing everything for yourself to enable
> efficiency but when you are writing instructions on the TayLUG for others to
> follow, Nick's more long winded version is preferred. This is due to people
> having different levels of knowledge and experience, you want to write
> instructions that is easy to follow and so that people have a reasonable
> idea of how things are being derived i.e. showing your working, so that they
> can apply this knowledge in other areas. This is only my personal opinion,
> but I prefer doing things so that understanding is achieved in addition to
> an objective being achieved.
>
Yes, readability is always something to strive for; and one liners
frequently become unreadable.
However, in this case the refinement I provided *is* more legible, as
it doesn't make use of any control flow constructs other than the
shell pipe. So I'd guess that many beginners would find the refined
version easier to follow, as Nick's initial version relies on more
complex shell features such as redirecting a file to exec so that it
will re-output through stdin (a trick requiring me to consult the man
pages to understand).
Anyway, the reason I refined the script, was because it appeared
un-edited, i.e. there was room left for further refinement. So I hope
my comments did not come across as critical. I wouldn't have
suggested the improvements had Nick not graciously offered us his
code. Nick did 99% of the work, all I did was the last 1% of
refactoring.
"Perfection is achieved not when you have nothing more to add, but
when you have nothing left to take away."
As for your point about showing your working. Is this not precisely
what this thread is? Does it not demonstrate the process of
refinement?
Anyway, thanks for offering your code Nick! It's much appreciated...
And I think we've all learnt something, me included as I didn't know
about that "exec <" trick. Open source is about giving; something
which isn't easy.... Especially when you know people will comment on
and critique your work.
One thing I've been wanting to do, is start a writers workshop for
software development where people can present their code for
constructive criticism and discussion:
http://www.dreamsongs.org/Files/WritersWorkshops.pdf
I've suggested this a few times to the Scottish Developers, but we've
not started anything yet. If anyone's interested in doing this, let
me know.
R.
More information about the dundee
mailing list