I'm not enamored of formal design engineering; instead, I typically write out little snippets of pseudocode that describe how I want something to work (a "code story"), play a bit with input and output formats, do a bit of coding, and—if I'm not satisfied with how the system is fitting together—go back and rework the code story. For anything larger than a toy application, I implement little bits of the system and test them out in standalone programs before deciding whether to move forward with that part of the design. I keep my notes in a "stream of consciousness" text file, and commit code to my CVS repository often. I try to make all the code visually appealing and elegant. If it isn't elegant, something's wrong with the design, and I go back to the drawing board.
My first design task was to figure out the flow of a typical Bio::Graphics application. I started with the code story shown in Example 12-1.
Example 12-1. Basic story for BioPerl::Graphics use (pseudocode)
1 useBio::Graphics::Panel; 2 @first_set_of_features = get_features_somehow( ); 3 @second_set_of_features = get_more_features_somehow( ); 4 $panel_object = Bio::Graphics::Panel->new(panel_options...) 5 $panel_object->add_track(\@first_set_of_features, track_options...); 6 $panel_object->add_track(\@second_set_of_features, track_options...); 7 print $panel_object->png;
The code story starts out by bringing in the main Bio::Graphics object ...