

\documentstyle[twocolumn]{article}

\title{Perl Program Repair Shop \\ 
        {\small and} \\
        Red Flags \\  Table of Contents}

\begin{document}
\maketitle



\medskip
{\bf Program Repair Shop (1--10)}

What is This Class About?~2~-
A Brief Note About 'Conciseness'~3~-
Counting Lines~4~-
Counting Lines of Code: Rules~8~-
Introduction: Families of Variables~9~-
Families of Variables~10

\medskip
{\bf Section 1: Merging Reports (14--68)}

Two-Headed Monster~15~-
Families of Variables~16--25~-
Digression about Directory Names~17~-
7 lines become 5~19~-
{\it Make Relationships Explicit}~20--22~-
Comments~21~-
{\tt GrabFileList}~23~-
{\tt CopyFiles}~26--39~-
Concatenation~28~-
Parameter Passing~38~-
{\tt CreateInput}~41~-
{\tt CreateOutputDir}~45--50~-
Unnecessary Variables~46~-
Diagnostics~48~-
Structure vs. Function~49~-
{\it Minimize Structure}~51~-
{\tt FindLastOut}~52~-
{\tt GetPadString}~55--66~-
The Cardinal Rule of Computer Programming~56~-
Repeated Code is a Mistake~57~-
Repeated Code ~63~-
Reminder~65~-
We're Finished!~67~-
On Design~68

\medskip
{\bf Section 2: Directory Copying (69--102)}

Indentation~70~-
Boolean Values~71~-
Precedence Problem~73~-
Global Variables~74~-
Function Arguments~75~-
Dirhandles~77~-
Repeated Tests~78--94~-
Try it Both Ways~79~-
Error Messages~80~-
Botched Recursion~83~-
Function Conception~84~-
Main Loop~85~-
{\it Don't take two steps forward and one step back}~86~-
5 lines become 0~91~-
Programmers Write Too Much Code~92~-
Do What You Mean~95~-
{\it Say what you Mean}~96~-
{\it Leaning Toothpick Syndrome}~97~-
Temporary Variables are Temporary~98~-
A Note About Portability~99~-
Directory Copier~102

\medskip
{\bf Section 3: Some Miscellaneous Red Flags (103--140)}

{\it \verb+\"+}~104~-
{\tt print print print print print}~106~-
{\it Many Very Long Strings}~107~-
{\it C-style for loop}~108~-
A Lucky Find!~109~-
{\tt my}~110~-
Superstition~111~-
Global Lexicals~113~-
Excessively Decorated Comments~114~-
{\it C-style for Loop}~116~-
Unnecessary Variables~117~-
Single Scalar Variable in Quotes~118~-
Array Length Variables~119~-
Unnecessary Shell Calls~120--126~-
Shell Call Security Disaster~122~-
Capturing the same pattern repeatedly~135~-
{\tt swswsw}~137~-
Randal's Rule~140

\medskip
{\bf Section 4: A CGI Program (141--179)}

{\tt my}~142~-
Use Smaller Scope~143~-
Repeated Data Structure~144--147~-
Try it Both Ways~145--174~-
Avoid Special Cases~150~-
Repeated Code~152--164~-
Special Cases~153~-
Digression: Code and Data Structure Should be in Harmony~154~-
Unnecessary Subroutine~157~-
Special Values~161~-
{\it Don't confuse internal and external representations of data}~162~-
{\tt print\_table}~165--168~-
Tools~167~-
{\tt evaluate\_board}~171~-
Let's Not Be Doctrinaire~173~-
Uniform Data Representations~175~-
{\tt get\_computer\_choice}~176~-
Pause~178~-
Higher-Order Functions~179

\medskip
{\bf Section 5: System Administration (185--215)}

Indentation~186~-
Loop Hoisting~187~-
Pattern Matching~188~-
{\tt \$\#array}~189--193~-
Boolean Context~194~-
Special Cases~195~-
{\it Variable use immediately follows assignment}~197~-
The Result~198~-
{\tt if and else}~199~-
{\tt if or else}~200~-
{\tt else / if}~204~-
The Condition that Ate Michigan~206~-
The Condition that Ate Michigan (Digression)~208--210~-
        if () \{ while () \{ if () \{ if () \{ while () \{ if () \{ ... \} \} \} \} \} \}~209~-
{\tt if-else}~211~-
{\tt unless-else}~214~-
Minimum~215

\medskip
{\bf Section 7: Generating Reports (216--275)}

Families of Variable Names~217~-
Automatic Testing~222~-
{\it Making Two Passes}~224--253~-
Preprocessing~226--229~-
Maintenance Dilemmas~228~-
{\it Avoid Special Cases}~230--255~-
{\it Arbitrary Numeric Constants}~231~-
Flags~233~-
{\it Try it Both Ways}~236--245~-
Punctuation~237~-
{\it Avoid Excess Punctuation}~238~-
The Condition that Ate Michigan~239~-
Extraction~241~-
{\tt cleanup}~242~-
Main Loop Finished~248~-
Missing Element 0~249~-
Repeated Code~251~-
{\tt printout}~252--263~-
{\it Say What You Mean}~254~-
The Maintenance Programmer~256~-
{\it C-Style for Loops}~257~-
{\tt elsif}~258~-
Special Cases~261~-
Generating Reports~271~-
KLOC~272~-
What to Remember~273~-
Thank You ~274~-
Bibliography~275

\medskip
{\bf Section 8: Residue of the Red Flags (277--298)}

Families of Variables~278~-
Compound Compound Compound Statements~280~-
Anecdote About Superstition~281~-
Try it Both Ways~282~-
Avoid Special Cases~284--294~-
Store Related Values Together~285~-
Avoid Families of Variable Names~290~-
{\it Don't take two steps forward and one step back}~291~-
What About Matt Wright?~298

\end{document}
