[prog] Programming for QA folks

Kathryn Andersen kat_lists at katspace.homelinux.org
Sat Jun 16 00:15:04 UTC 2007


On Fri, Jun 15, 2007 at 07:28:48PM +0100, Anna Baik wrote:
> looking at stuff long after I've moved on.  So any general advice on
> good coding standards would be great!

Document, document, document!
That's one place where I love Perl; using Perl's POD markup, a Perl
script can contain its own "man page" (perldoc is your friend!).
Self-documenting code is easier to understand, and therefore easier to
maintain.
 
> I'm not sure whether or to try learning Perl - I get the impression
> that although powerful it can be a bit hard to learn.  Also, I think
> (but am not sure) that it would be more likely that any future testers
> would already know shell scripting but might not know Perl - so that
> would also be a reason to write stuff in Korn shell.  On the other
> hand, I might be totally wrong and it might be *more* likely they'd
> know Perl, not less!

I think they *would* be more likely to know Perl than ksh.

Pros and cons of ksh:
pro:
- it's available on your legacy system
- not as hard to learn

con:
- too many different versions
- not as portable to different systems
- doing anything significant depends on other unix commands which may
  not all behave the same on different systems
- it's old, so not everyone will know it; they're more likely to know
  bash

Pros and cons of Perl:
pro:
- it's available on your legacy system (I assume, otherwise you wouldn't
  be asking about it)
- self-contained
- portable to different systems
- POD makes documenting the scripts much easier (perldoc is your friend)
- more powerful than ksh
- can make use of perl modules (libraries) that others have written
  (CPAN is your friend)
- easier to debug (use strict; use warnings; use diagnostics; and if all
  else fails, the perl debugger is your friend)
- more people will know it than ksh

con:
- harder to learn

A point about Python: though it may be easier to learn, it may simply
not be available on your legacy system.

Two Perl books I'd recommend:
- O'Reilly: Programming Perl (once you get past the basics, great
  reference)
- O'Reilly: Perl Cookbook (full of good and useful examples of code for
  doing specific tasks)

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe


More information about the Programming mailing list