SPUG:Designing Programs

Jay Scherrer jay at scherrer.com
Sat Jan 11 10:58:54 CST 2003


Asim,

All though I'm used to writing full programs in c, I have been trying my hand 
at creating a large program using Perl. You can access our latest cvs files 
at <http://tenforty.sourceforge.net>. The project computes the 1040 income 
tax using Perl and Perl::Tk. To run this version, use the command: 
[user] $ ./tenForty

Jay Scherrer

On Friday 10 January 2003 07:20 pm, Asim Jalis wrote:
> I have a question. How do people design large programs with Perl?
> Do you start typing code? Or do you spend some time designing it
> on paper?
>
Actually this will depend on the project. What I've done is taken the 1040 and 
broke it down into sections ( Label, Filing Status, Exemptions, Income, Agi, 
etc). It is best to design the layout beforehand. Figuring how the over all 
program will flow. Here we use a Main screen that controls the other 
subroutines, and controls the final out put. Keep in mind when creating these 
larger programs the use of "use" and "require"  when pulling in the different 
modules helps quite a bit. With Practical Tax we call: 
use Tenforty;  # because this module will be used globally.
require "agi.pl" # because this will only be used when needed and then 
discarded.

I have found a big performance gain doing so, and it's a lot easier to keep 
control of the variables.
    
> If you design it on paper, how do you do it? Do you define the
> functions and what they will do and then flesh this out till you
> have pinned down the whole program? Do you first break the
> program down into modules and then flesh out each module?
>

If I'm writing from scratch, I will use the semantic programing style and 
write an outline of the overall function/program. Reviewing the outline the 
will reveal witch parts act globally and witch parts act temporally.
 
> Do you draw diagrams?
>
Using fig and dia has helped tremendously especially when trying express my 
visions to the other developers.

> Or is it something completely different?
>
> Do you use any kind of OO design ideas?
>

OO plays a big role. Especially when separating the GUI from the main module/ 
modules.

> I am particularly interested in Perl and Perl design experience
> and ideas.
>
>
> Asim
> _______________________________________________
> spug-list mailing list
> spug-list at mail.pm.org
> http://mail.pm.org/mailman/listinfo/spug-list




More information about the spug-list mailing list