Let's organise a free teach-in
Edmund von der Burg
evdb at ecclestoad.co.uk
Sat Feb 17 13:21:17 GMT 2007
On 16/02/07, Tim Sweetman <ti at lemonia.org> wrote:
> What aspects of Perl require teaching? (Deliberately open-ended question)
I find that is what is usually lacking in mid level programmers is not
syntax and so on but rather how to structure code so that it is easy
to write bigger apps and maintain them.
If it is in line what others have in mind I'd like to see a talk that
explains how do thin, perhaps with a command line utility that lets
you manipulate a fortune file as an example. It would need to be able
to add, delete, search and randomly select a fortune.
This would be comprised of a core module that deals with parsing the
command line arguments and then hands over to plugins to do the actual
work. The actual script would just 'use' the core module and then call
its 'run' method.
In no particular order it would seek to demonstrate the following things:
* code design - thinking about the problem before launching into the code.
* writing modules - put as little code as possible in scripts, as
much as possible in modules (and why).
* plugins - you can have bits of code that extend other code without
requiring any changes to it.
* OO - each plugin inherits from the core module and so has access
to generic functions
* testing - each plugin should have tests, and be written in a
testable way (test first even)
* documentation - the 'help' plugin should be able to parse the POD
of the other plugins to generate help pages.
* Don't Repeat Yourself - there should be no duplication of code.
That last point - DRY - is perhaps the most important. I've so often
sen large collections of scripts that all start with the same twenty
lines that do the same thing (almost). Needless to say small
differences start to creep in (--dryrun or --dry_run) and they turn
into a maintenance nightmare.
Hmm - it looks like I might just have voluteered to do a talk....
In reality I'm evdb at ecclestoad.co.uk - http://ecclestoad.co.uk
More information about the london.pm